Hi Gustavo

raw_mol = Chem.MolFromXYZFile('acetate.xyz<http://acetate.xyz/>')
mol = Chem.Mol(raw_mol)
rdDetermineBonds.DetermineBonds(mol,charge=-1)

Best regards, Jan

On 7 Apr 2023, at 22.57, Gustavo Seabra 
<gustavo.sea...@gmail.com<mailto:gustavo.sea...@gmail.com>> wrote:

Hi everyone,

I'm having difficulties using RDKit to read molecules from an XYZ file, and I 
would really appreciate some help.

The problem is that whenever i read a molecule from an XYZ file, I get just a 
disconnected clump of atoms, not a molecule. For example: the following code:

import rdkit
from rdkit import Chem
from rdkit.Chem import Draw, rdmolfiles
mol = Chem.MolFromSmiles('COC1=C(O)C[C@@](O)(CO)CC1=O')
mol = Chem.AddHs(mol)
mol

<image.png>

Chem.AllChem.EmbedMolecule(mol)
Chem.MolToXYZFile(mol, "rdkit_mol.xyz<http://rdkit_mol.xyz/>")
mol2 = Chem.MolFromXYZFile('rdkit_mol.xyz<http://rdkit_mol.xyz/>')
mol2
<image.png>
Is there a bug on the XYZ code, or am I missing something?

Thanks!
--
Gustavo Seabra.
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to