You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we parse a Mol block in which some atom has it's total valence specified, RDKit parses this valence into the molTotValence. After the parsing finishes, it uses the property to adjust Hydrogens on the atom(s) to match the specified valence, but the property is never cleared, and may "leak" if we export the molecule. It usually doesn't because most of the output formats in RDKit don't support atom properties, but CXSMILES does:
In [1]: mb = """
...: RDKit 2D
...:
...: 0 0 0 0 0 0 0 0 0 0999 V3000
...: M V30 BEGIN CTAB
...: M V30 COUNTS 1 0 0 0 0
...: M V30 BEGIN ATOM
...: M V30 1 N -3.657143 -0.742857 0.000000 0 CHG=1 VAL=4
...: M V30 END ATOM
...: M V30 END CTAB
...: M END"""
In [2]: m = Chem.MolFromMolBlock(mb)
In [3]: Chem.MolToCXSmiles(m)
Out[3]: '[NH4+] |(-3.65714,-0.742857,),atomProp:0.molTotValence.4|'
The problem with this, besides propagating a property that the molecule didn't have in the first place, is that running some operations (e.g. a reaction) on the structure might change the total valence on the atom, but the property would still specify the initial value, as there isn't any code to update the property.
I think we should clear the molTotValence property once we have adjusted Hydrogens to match the valence in the postprocessing.
The text was updated successfully, but these errors were encountered:
When we parse a Mol block in which some atom has it's total valence specified, RDKit parses this valence into the
molTotValence
. After the parsing finishes, it uses the property to adjust Hydrogens on the atom(s) to match the specified valence, but the property is never cleared, and may "leak" if we export the molecule. It usually doesn't because most of the output formats in RDKit don't support atom properties, but CXSMILES does:The problem with this, besides propagating a property that the molecule didn't have in the first place, is that running some operations (e.g. a reaction) on the structure might change the total valence on the atom, but the property would still specify the initial value, as there isn't any code to update the property.
I think we should clear the
molTotValence
property once we have adjusted Hydrogens to match the valence in the postprocessing.The text was updated successfully, but these errors were encountered: