Open wutobias opened 2 years ago
Thanks for the report @wutobias. I recall seeing something like this before and will look into the root cause here.
cc #412 #472
And (whether or not this is the root cause of this issue) I'd strongly recommend upgrading from 0.10.2 to the newest OFF toolkit release (either 0.10.6 if you need the old API, or 0.11.1 if not). There have been several critical bugfixes since 0.10.2. For example, Sage doesn't correctly apply TIP3P charges to water in 0.10.2.
And (whether or not this is the root cause of this issue) I'd strongly recommend upgrading from 0.10.2 to the newest OFF toolkit release (either 0.10.6 if you need the old API, or 0.11.1 if not). There have been several critical bugfixes since 0.10.2. For example, Sage doesn't correctly apply TIP3P charges to water in 0.10.2.
Thanks. These are very useful comments. For this issue however, neither v0.10.6 nor 0.11.1 resolve the problem.
I've found that both removing AddHs or setting the explicitOnly
kwarg to true seems to resolves this issue. But I have no idea why this makes a difference. The output molecules do seem to have the expected chemical graph though (all Hs explicit).
rdmol = Chem.MolFromSmiles("CCCC")
rdmol = Chem.AddHs(rdmol, explicitOnly=True)
for i, a in enumerate(rdmol.GetAtoms()):
a.SetAtomMapNum(i)
offmol = Molecule.from_rdkit(rdmol)
works
rdmol = Chem.MolFromSmiles("CCCC")
#rdmol = Chem.AddHs(rdmol)
for i, a in enumerate(rdmol.GetAtoms()):
a.SetAtomMapNum(i)
offmol = Molecule.from_rdkit(rdmol)
also works.
Would either of these work for you in the short term, @wutobias? Either way I'm going to keep digging into the root cause (probably something to do with our handling of implicit Hs in RDMols)
Would either of these work for you in the short term, @wutobias?
Yes, that works for me in the short term. Thanks for looking into it!
Describe the bug I have an rdkit molecule object in which I have to set custom
SetAtomMapNum
for all atoms. Whenever I want to parse that rdkit object to an openff-toolkit Molecule object, I get anUndefinedStereochemistryError
. This happens for molecules who don't even have steorecenters by construction and only if I add hydrogen atoms to them. If I set every atommap to0
on every atom, the erroneous behaviour is not observed.To Reproduce
Output
Computing environment (please complete the following information):
5.15.0-46-generic #49~20.04.1-Ubuntu SMP Thu Aug 4 19:15:44 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
conda list
:Additional context