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
Describe the bug
Fluorescein's lactone form has a carbon that at first glance appears chiral, but is the molecule is actually achiral because of symmetry:
The tetrahedral carbon in the center shared by both the 3-ring system and the 2-ring system is achiral because of the symmetry of the 3-membered ring system. However, rdkit.Chem.AssignStereochemistry(rdmol, force=True, flagPossibleStereoCenters=True) flags it as a possible stereocenter. This means that if it is not given stereochemistry in an input, it will erroneously raise an error. More concerningly, SDFs written out by RDKit do not flag this stereochemistry, and so the same SDF cannot be loaded (modulo the allow_undefined_stereo argument)
---------------------------------------------------------------------------UndefinedStereochemistryErrorTraceback (mostrecentcalllast)
CellIn[60], line31mol.from_smiles('c1ccc2c(c1)C(=O)O[C@]23c4ccc(cc4Oc5c3ccc(c5)O)O')
2mol.to_file("temp.sdf", "SDF")
---->3mol2=Molecule.from_file("temp.sdf", "SDF")
File [~/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/topology/molecule.py:3820](http://localhost:8888/home/joshmitchell/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/topology/molecule.py#line=3819), in FrozenMolecule.from_file(cls, file_path, file_format, toolkit_registry, allow_undefined_stereo)3818ifisinstance(file_path, pathlib.Path):
3819file_path=file_path.as_posix()
->3820mols=toolkit.from_file( # type: ignore[call-arg]3821file_path,
3822file_format=file_format,
3823allow_undefined_stereo=allow_undefined_stereo,
3824_cls=cls,
3825 )
3826elifhasattr(file_path, "read"):
3827file_obj=file_pathFile [~/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/utils/rdkit_wrapper.py:1075](http://localhost:8888/home/joshmitchell/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/utils/rdkit_wrapper.py#line=1074), in RDKitToolkitWrapper.from_file(self, file_path, file_format, allow_undefined_stereo, _cls)1071if (file_format=="MOL") or (file_format=="SDF"):
1072sdf_supplier=Chem.ForwardSDMolSupplier(
1073file_path, removeHs=False, sanitize=False, strictParsing=True1074 )
->1075mols.extend(
1076self._process_sdf_supplier(
1077sdf_supplier,
1078allow_undefined_stereo=allow_undefined_stereo,
1079_cls=_cls,
1080 )
1081 )
1083eliffile_format=="SMI":
1084# TODO: We have to do some special stuff when we import SMILES (currently1085# just adding H's, but could get fancier in the future). It might be1086# worthwhile to parse the SMILES file ourselves and pass each SMILES1087# through the from_smiles function instead1088forrdmolinChem.SmilesMolSupplier(file_path, titleLine=False):
File [~/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/utils/rdkit_wrapper.py:1028](http://localhost:8888/home/joshmitchell/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/utils/rdkit_wrapper.py#line=1027), in RDKitToolkitWrapper._process_sdf_supplier(self, sdf_supplier, allow_undefined_stereo, _cls)1026continue1027Chem.SetAromaticity(rdmol, Chem.AromaticityModel.AROMATICITY_MDL)
->1028mol=self.from_rdkit(
1029rdmol, allow_undefined_stereo=allow_undefined_stereo, _cls=_cls1030 )
1031yieldmolFile [~/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/utils/rdkit_wrapper.py:2307](http://localhost:8888/home/joshmitchell/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/utils/rdkit_wrapper.py#line=2306), in RDKitToolkitWrapper.from_rdkit(self, rdmol, allow_undefined_stereo, hydrogens_are_explicit, _cls)2305# Check for undefined stereochemistry.2306ifnotallow_undefined_stereo:
->2307self._detect_undefined_stereo(
2308rdmol,
2309err_msg_prefix="Unable to make OFFMol from RDMol: ",
2310 )
2312# Create a new OpenFF Molecule2313offmol=_cls()
File [~/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/utils/rdkit_wrapper.py:3265](http://localhost:8888/home/joshmitchell/Documents/openff/openff-pablo/.soap/test/lib/python3.11/site-packages/openff/toolkit/utils/rdkit_wrapper.py#line=3264), in RDKitToolkitWrapper._detect_undefined_stereo(cls, rdmol, err_msg_prefix)3259atom1, atom2=bond.GetBeginAtom(), bond.GetEndAtom()
3260msg+= (
3261f" - Bond {undefined_bond_idx} (atoms {atom1.GetIdx()}-{atom2.GetIdx()} of element "3262f"({atom1.GetSymbol()}-{atom2.GetSymbol()})\n"3263 )
->3265raiseUndefinedStereochemistryError(err_msg_prefix+msg)
UndefinedStereochemistryError: UnabletomakeOFFMolfromRDMol: RDMolhasunspecifiedstereochemistry. RDMolname: Undefinedchiralcentersare:
-AtomC (index24)
micromamba list
List of packages in environment: "/home/joshmitchell/Documents/openff/openff-pablo/.soap/test"
Describe the bug
Fluorescein's lactone form has a carbon that at first glance appears chiral, but is the molecule is actually achiral because of symmetry:
The tetrahedral carbon in the center shared by both the 3-ring system and the 2-ring system is achiral because of the symmetry of the 3-membered ring system. However,
rdkit.Chem.AssignStereochemistry(rdmol, force=True, flagPossibleStereoCenters=True)
flags it as a possible stereocenter. This means that if it is not given stereochemistry in an input, it will erroneously raise an error. More concerningly, SDFs written out by RDKit do not flag this stereochemistry, and so the same SDF cannot be loaded (modulo theallow_undefined_stereo
argument)To Reproduce
Output
micromamba list
The text was updated successfully, but these errors were encountered: