-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
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
SDF and MOL file reader import errors in xtb Version 6.2 RC2 #26
Comments
Thanks for reporting. There is indeed a bug in the released version, which should be fixed by #4. |
I would very much appreciate having your recommendations as separate issues, since I cannot come up if a single pull request addressing all of them. Maybe a few thoughts here
Let's sum this up:
|
IMHO, if a 2D case or an SDF is supplied without explicit hydrogens, I'd suggest calling |
@awvwgk thank you for the additional comments, I will open individual requests with the new version. As you mentioned, not everything will be doable, but I have a test pipeline of a couple thousand of structures I want to send through. I will see what problems remain open after the patch. In the mean time I will just use the coord (tmol) input. |
I've run through ~100k compounds using XYZ from Open Babel, but I have a validation set I've been using for holdout that I can run ~70k optimization + Hessian. |
@ghutchis will you be able to share the results and your methods? I am using either bash shell scripts or some single liner constructs that may add some penalty to the overall computational time. For example using the C60 fullerene data from Comprehensive theoretical study of all 1812 C60 isomers [XYZ] one can calculate single point energies with a wonderful speedup factor of 80 in 0.7 seconds for each molecule on a node with 44 CPUs/88 threads. The final time boils down to 22 min for 1812 molecules, based on the really awesome scaling of xtb.
Of course once we calculate opt-freq we need to store the data, but I guess even 100k molecules should be doable in a couple of hours on multiple nodes. I wonder if one could pipe the SDF conversions from Open Babel directly to xtb and then extract the energies or other values one the fly. Its probably best done with the python API? I have not looked into that yet. |
@tobigithub - this seems outside the discussion on this issue. Feel free to contact me. At the moment, the data isn't public, but we should be making several GFN-related manuscripts and data sets available soon. We generally use Python, but your shell script is similar and won't add much overhead. |
- PDB reader will try to read atom types from atom name - VASP reader will keep information on the input format - SDF reader will save information on atom tags - SDF reader will warn if hydrogen atoms are missing, fixes #26
I guess we are almost there, see #30. So there are a few open questions here, I need a reliable way to determine:
If it is not easily possible, I will go with garbage in / garbage out here. |
A SDF is supposed to note whether it's a 2D depiction or a 3D coordinates (that might be flat): Note that in the 2nd line, a 2D depiction ends in '2D' and a 3D depiction ends in '3D' As far as hydrogen atoms, I'd probably go with 'we're going to run what you sent us' - maybe with a warning if the charge/spin seem weird. One request though would be to add up the formal charges in a SDF file from the M CHG lines: M CHG 1 3 -1 I'd have to check on the radical options (M RAD), but there are a lot more cases with formal charges (e.g., amino acids, side chains, etc.) M ISO might be useful for some purposes too. |
@awvwgk I think that is something to check with tests, while it is impossible to cover all MDL MOL definitions, it will still leave room for errors. But covering 90% of the correct cases should be fine. Meaning if molecules pass openbabel or molconvert they are fine, If xtb accepts molecules that do not pass a openbabel conversion something is wrong. Plus xtb should be able to calculate energies for a random selection of good molecules such as those below. Data sources of good molecules can be PubChem, EBI, HMDB, NCI |
A way to determine if a structure is 2D in MOL or SDF is that a single column's coordinates sum equals zero. In the case below, the z-axis is zero. It could also be x or y but most packages just zero out the z-axis. While there could be other cases (rotation along a specific bond) this is 99% never the case. I am sure there are matrix operations to test for all cases, but the sum of z-axis coordinates equals zero is a good test for having 2D molecules. Its what most of the software tools do. Another observation is that xtb actually handles 2D molecules quite well. So it might not be a big issue, but additional tests are required. I am running the CHEBI molecules (https://www.ebi.ac.uk/chebi/downloadsForward.do) with a single energy point calculation to see if something is wrong.
|
The test would be for organic compounds, most commonly carbon bound to hydrogen, nitrogen, oxygen, sulfur. So I would not be concerned with exotic cases, including metals or single elements. Elements CHNSOP are enough. Elements such as SNP will have multiple valencies, but here one could use the most common valence states for each element. The cheapest way would be to test if there is any carbon at all, short of fullerenes and pure carbon compounds. A way to test would be via Lewis and Senior rules and check that against the charge. See |
- add type-bound procedures for tb_molecule class - generic reader from unit - generic writer to unit - allow additional tags on atoms - molfile/SDF specific tags - PDB specific tags - allow meta data stored along with the molecule - VASP input format information - SDF info block (raw string block) - rework backend reader/writer for common formats (remove rewind statements) - Turbomole coordinate format - xyz coordinate format - molfile coordinate format - SDF coordinate format (see #26) - VASP coordinate format - PDB coordinate format - add topology information to molecule class (new topology class) - add fragment information to molecule class (new fragment class)
Intro
I highly appreciate the MOL and SDF file reader and import, because it narrows the gap between cheminformatics with millions of molecules from PubChem and ChemSpider and the quantum chemistry world. So instead of going via information devoid xyz or coord files, the SDF and mol files can be enriched directly with meta information (energies, fukui indices, EA, HOMO-LUMO gaps etc). While we have tools to convert files (OpenBabel, ChemAxon molconvert) the direct calculation on MOL and SDF files is a really important feature, because it will allow for easier workflows and finally also broader use within the community. I am writing this somewhat lengthy intro because it is easy to just get rid of problematic features by excluding them, but that is not my intention.
Describe the bug
The mol/sdf file reader is reading only very specifically formatted molecules, but throws errors on correctly formatted standard MOL (MDL V2000) formatted files. This applies to simple molecules, not exotic SDF options. When it does that it actually leads to many different errors, from falsely breaking bonds to throwing errors regarding atom numbers and optimization failures. I am also adding additional recommendations, or if needed can file them as individual issues?
To Reproduce
Steps to reproduce the behavior:
XTB version: Version 6.2 RC2 (SAW190805)
I checked and converted most molecules with OpenBabel and ChemAxon mview and molconvert. These tools have been used to convert millions/billions of connection tables. They are pretty robust. Case 2-6 shows the errors.
Case 1 (Expected computational behavior):
Warning, this is a faulty SDF/mol molecule recreated from the xtb documentation, it can not be imported by OpenBabel or by MarvinView. There are not enough spaces after the atom coordinates (x y z O), therefore the molecules is corrupt. The xtb file reader probably just reads coordinates.
Case 2 (C6H6-m213-2D.sdf) benzene standard and error free 2D formatted mod/sdf file:
Case 3 (C6H6-m213-aroma.sdf) (benzene aromatized bonds):
Case 4 (water-chemaxon.sdf) (correctly formatted SDF) atom number mismatch:
Case 5 (xtb water-openbabel-2D.sdf) (correctly formatted 2D SDF):
Case 6 (xtb water-openbabel-3D.sdf) (correctly formatted 3D SDF):
This case is interesting, because a different energy is presented, even with --opt extreme options. When compared to the working h2o.sdf example from the handbook, the energy is different and somewhat interesting the optimization failed, even when repeated.
Please provide all input and output file such that we confirm your report.
See attached. XTB-sdf-issues.zip contains the examples shown here.
Additional recommendations
Additional context
original MDL V2000 format definitions (CTF file formats)
http://c4.cabrillo.edu/404/ctfile.pdf
ChemAxon structure checker, a software that detects errors in SDF/MOL files
https://docs.chemaxon.com/display/docs/Checker+List
OpenBabel Doc
https://buildmedia.readthedocs.org/media/pdf/open-babel/latest/open-babel.pdf
OpenBabel installation
http://openbabel.org/wiki/Category:Installation
ChemAxon molconvert
https://chemaxon.com/marvin-archive/latest/help/applications/molconvert.html
SDF error checker
http://www.nonlinear.com/progenesis/sdf-studio/v0.9/faq/sdf-file-format-guidance.aspx
command line parameters to convert or split a single multi-molecule SDF to multiple mol/sdf/tmol
The text was updated successfully, but these errors were encountered: