rdkit / rdkit

The official sources for the RDKit library
BSD 3-Clause "New" or "Revised" License
2.63k stars 875 forks source link

GetImplicitValence() is 0 for each atom when loading from inchi #4633

Closed kienerj closed 2 years ago

kienerj commented 3 years ago

Describe the bug

When loading a molecule from a standard inchi string, each atoms GetImplicitValence() is 0.

Loading the same molecule from smiles gives correct implicit valence.

To Reproduce

m = Chem.MolFromInchi('InChI=1S/C8H8O3/c1-11-8-4-6(5-9)2-3-7(8)10/h2-5,10H,1H3')
for atom in m.GetAtoms():
    print (atom.GetImplicitValence())

prints only 0.

m = Chem.MolFromSmiles('OC1=CC=C(C=C1OC)C=O')
for atom in m.GetAtoms():
    print (atom.GetImplicitValence())

prints actually implicit valence

Expected behavior Same as when loading from smiles or molblock which both work as expected

Configuration (please complete the following information):

kienerj commented 2 years ago

OK, I see that with inchi, Hs are explicit so it does make sense but at first it entirely confusing as the SMILES and inchi come from the same source or shall I say same drawing without any explicit Hs.