Open LilDojd opened 3 months ago
All explicit hydrogens are conserved when converting to OpenFF Molecule
Molecule
OFFMolecule is constructed directly from SmallMoleculeComponent._rdkit with __init__:
OFFMolecule
SmallMoleculeComponent._rdkit
__init__
https://github.com/OpenFreeEnergy/gufe/blob/29f98ec0227ed9f30ea6b84096dc13818a9ac8d3/gufe/components/smallmoleculecomponent.py#L183-L196
This essentially calls
OFFMolecule.from_rdkit(rdmol, allow_undefined_stereo=True, hydrogens_are_explicit=False)
Use .from_rdkit() constructor directly with hydrogens_are_explicit set to True
.from_rdkit()
hydrogens_are_explicit
gdp = SmallMoleculeComponent.from_sdf_file("gdp_correct.sdf") gdp.to_openff().to_file("gdp_ugly.sdf", "sdf")
> gdp_ugly.sdf:
I know this particular SDF has incorrect bond orders, but I think users' input protonation state should still generally be respected
Expected Behavior
All explicit hydrogens are conserved when converting to OpenFF
Molecule
Current Behavior
OFFMolecule
is constructed directly fromSmallMoleculeComponent._rdkit
with__init__
:https://github.com/OpenFreeEnergy/gufe/blob/29f98ec0227ed9f30ea6b84096dc13818a9ac8d3/gufe/components/smallmoleculecomponent.py#L183-L196
This essentially calls
which leads to rdkit adding hydrogensPossible Solution
Use
.from_rdkit()
constructor directly withhydrogens_are_explicit
set to TrueSteps to Reproduce
> gdp_ugly.sdf: