Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Produce a more informative error when someone asks RDKit to load mol2 #407

Closed
j-wags opened this issue Aug 30, 2019 · 1 comment · Fixed by #425
Closed

Produce a more informative error when someone asks RDKit to load mol2 #407

j-wags opened this issue Aug 30, 2019 · 1 comment · Fixed by #425

Comments

@j-wags
Copy link
Member

j-wags commented Aug 30, 2019

Is your feature request related to a problem? Please describe.
_From @dfhahn _
Another issue I've come across as a newbie @jeffrey Wagner
I want to import a mol2 file without having openeye installed. This is not supported as we heard in your demo talk. However, the error message should mention this. Otherwise people think it is an error and might start doing stuff like I did (and which is not healthy I guess):

from rdkit.Chem import AllChem
from simtk.openmm.app import PDBFile
from openforcefield.topology import Molecule, Topology
from openforcefield.typing.engines.smirnoff import ForceField

romol = AllChem.MolFromMol2File(ligand_path)
ligand = Molecule.from_rdkit(romol)

Describe the solution you'd like
We could catch the specific text of this error in Molecule.from_file, and add to the error message

@j-wags
Copy link
Member Author

j-wags commented Sep 21, 2019

#425 adds substantially to the error message.
NotImplementedError: No toolkits in registry can read file ligand1.mol2 (format MOL2). Supported formats in the provided ToolkitRegistry are {'The RDKit': ['SDF', 'MOL', 'SMI'], 'AmberTools': []}. RDKit does not fully support input of molecules from mol2 format unless they have Corina atom types, and this is not common in the simulation community. For this reason, the Open Force Field Toolkit does not use RDKit to read .mol2. Consider reading from SDF instead. If you would like to attempt to use RDKit to read mol2 anyway, you can load the molecule of interest into an RDKit molecule and use openforcefield.topology.Molecule.from_rdkit, but we do not recommend this.

j-wags added a commit that referenced this issue Sep 21, 2019
@j-wags j-wags mentioned this issue Sep 21, 2019
10 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant