We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This illustrates the problem:
In [1]: from rdkit import Chem ...: mol = Chem.MolFromMolBlock(""" ...: RDKit 2D ...: ...: 7 8 0 0 1 0 0 0 0 0999 V2000 ...: 5.0014 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 ...: 4.1764 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 ...: 3.3514 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 ...: 2.9389 1.1271 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 ...: 3.3514 1.8412 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 ...: 4.1764 1.8412 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 ...: 4.5889 1.1271 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 ...: 2 1 1 1 ...: 7 1 1 1 ...: 2 3 1 0 ...: 2 7 1 0 ...: 3 4 1 0 ...: 4 5 1 0 ...: 5 6 1 0 ...: 7 6 1 0 ...: M END ...: """) ...: res = Chem.AddHs(mol, explicitOnly=False, addCoords=True, onlyOnAtoms=[1, 6]) ...: print(Chem.MolToMolBlock(res)) RDKit 2D 9 10 0 0 1 0 0 0 0 0999 V2000 5.0014 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 4.1764 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 3.3514 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 2.9389 1.1271 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 3.3514 1.8412 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 4.1764 1.8412 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 4.5889 1.1271 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 nan nan nan H 0 0 0 0 0 0 0 0 0 0 0 0 3.7229 0.6270 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 2 1 1 0 7 1 1 0 2 3 1 0 2 7 1 0 3 4 1 0 4 5 1 0 5 6 1 0 7 6 1 0 2 8 1 1 7 9 1 6 M END
This is apparently happening because atoms 0, 1 and 6 are perfectly aligned:
If coordinates are regenerated, so that they are no longer perectly aligned, all is fine:
In [2]: params = Chem.rdCoordGen.CoordGenParams() ...: Chem.rdCoordGen.AddCoords(mol, params) ...: print(Chem.MolToMolBlock(mol)) RDKit 2D 7 8 0 0 1 0 0 0 0 0999 V2000 -1.4846 -0.0011 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 -0.6190 0.4995 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 0.2466 1.0003 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 1.1130 0.5009 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 1.1138 -0.4991 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 0.2482 -0.9997 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 -0.6182 -0.5005 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 2 1 1 1 7 1 1 1 2 3 1 0 2 7 1 0 3 4 1 0 4 5 1 0 5 6 1 0 7 6 1 0 M END In [3]: res = Chem.AddHs(mol, explicitOnly=False, addCoords=True, onlyOnAtoms=[1, 6]) ...: print(Chem.MolToMolBlock(res)) RDKit 2D 9 10 0 0 1 0 0 0 0 0999 V2000 -1.4846 -0.0011 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 -0.6190 0.4995 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 0.2466 1.0003 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 1.1130 0.5009 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 1.1138 -0.4991 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 0.2482 -0.9997 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 -0.6182 -0.5005 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 -1.1197 1.3651 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 -0.1189 0.3659 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 2 1 1 0 7 1 1 0 2 3 1 0 2 7 1 0 3 4 1 0 4 5 1 0 5 6 1 0 7 6 1 0 2 8 1 6 7 9 1 6 M END
The text was updated successfully, but these errors were encountered:
Addresses #3854 (#3855)
bd71248
* add fix * add test * fix the referenced issue Co-authored-by: Greg Landrum <greg.landrum@gmail.com>
422a327
reapply the fix for rdkit#3854
067c8f5
Fixes 3879: bad placement of Hs with fused rings (#3899)
9277bd5
* backup * Fixes #3879 also simplifies the code to place Hs * switch to bisecting the angle * reapply the fix for #3854
Successfully merging a pull request may close this issue.
This illustrates the problem:
This is apparently happening because atoms 0, 1 and 6 are perfectly aligned:
If coordinates are regenerated, so that they are no longer perectly aligned, all is fine:
The text was updated successfully, but these errors were encountered: