-
Notifications
You must be signed in to change notification settings - Fork 70
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 file is empty while converting from xyz file #40
Comments
I recommend you set up a virtual environment for Python and use the attached With the requirements resolved this possibly works for you, as it did for me by $ python ./xyz2mol.py ./molecule_1.txt -o sdf > molecule_1.sdf calling for Python 3.11.4 and RDKit (version 2023.03.1) -- both provided by the repositories of Linux Debian 13/trixie, branch testing. molecule_1.sdf.txt Two side notes:
|
xyz2mol is now implemented in RDKit (see the readme file), so I don't really maintain xyz2mol actively. But do let me know if the RDKit implementation is not working for you. |
@jhjensen2 The additional entry Independent from this, I wrote a new moderator script xyz2mol_2.py -- which for now only provides the conversion to .sdf -- to interact with the current version of RDKit (2023.03.2) available via pip. RDKit as currently packaged by DebiChem for Linux 13/Trixie (and other distributions which benefit this effort, e.g. Ubuntu) is version 2022.09.3 (tracker); here, your approach with an amended dependency |
@brunocalcada If your setup allows to set up a virtual environment to fetch current RDKit 2023.03.2, the attached moderator script may be helpful for you. |
@nbehrnd thank you so much for your reply. After some testing it worked perfectly, even in the environment that I already had with rdkit. |
The same for me. 1)empty file if use installed xyz2mol via conda
xyz file about 1.5 MB - contains more than 4 columns:
p.s.
|
@jhjensen2 thank you for your feedback previously. In the last days I'm exploring the RDKit functions to what my goal is: convertion of an xyz to sdf with all the info. When you say that xyz2mol is already implemented in RDKit you mean through the MolFromXYZFile as mentioned in the ReadMe file? Example generated through xyz2mol.py: Thank you in advance for any feedback :) |
@brunocalcada If you want RDKit to add the bonds, the first snippet of code is the show case how to interact with RDKit, i.e. raw_mol = Chem.MolFromXYZFile('acetate.xyz')
mol = Chem.Mol(raw_mol)
rdDetermineBonds.DetermineBonds(mol,charge=-1) I read your .sdf file about 3-methyl-1H-benzimidazole-2-thione. It is written in the elder V2000 dialect and already contains both atomic coordinates (atom block) and bond information (bond block; here: line 24 is the first line to watch): first atom, second atom (both represented by their atomic index assigned), and corresponding bond information (e.g., bond order 1, 2, 3). Wikipedia briefly compiles both the v2000 and v3000 standard syntax here. If you want to delve deeper into the syntax, the page equally links to the pdf on archive for the detailed documentation by Biovia here, a document which was fetched in August 2021. |
@nbehrnd thank you so much for your reply. Perhaps it is easier if I share the structure where I'm facing some issues. Any insight and guidance is much appreciated, thank you. |
Your molecule works fine for me. Are you using a +1 charge? |
@jhjensen2 thanks for answering. Considering that you mentioned the charge, I did try with it and without it and the strcuture generated is exactly the same. Perhaps not in my case because I don't do any step in between the conversion from xyz to sdf (e.g. Add Hs or optimization). |
@brunocalcada I agree with you on the part that the current appetizing snippet of code is a bit short. To ease the initial use, I filed PR #42 a couple of minutes ago. This equally provides a link to the corresponding RDKit blog post with additional examples of application. With this edited script, both the reference file about the acetate anion, as well as your test structure (I presume equally charged -1) were processed smoothly. But the functionality already was available earlier, not "just" by RDKit 2023.09.5 fetched and used now/today. |
Hi all,
Trying to use xyz2mol to convert xyz files to sdf, however the result is an empty file without any error whatsoever.
Annexed you can find the molecule that i want to convert (it is a txt so i could annex here) and I'm using the following line directly in the terminal:
xyz2mol molecule_1.xyz -o sdf > molecule_1_from_xyz.sdf
xyz2mol version: 0.1.2
Thank you in advance :)
molecule_1.txt
The text was updated successfully, but these errors were encountered: