2
$\begingroup$

I am trying to create a SMILES representation starting from a .xyz molecule description (positions + symbols) read as ASE Atoms.

How can I convert a given molecule as a SMILES string ?

$\endgroup$
1
  • 3
    $\begingroup$ Does it have to be using ASE only? If you have the .xyz file, a solution using RDKit is: from rdkit import Chem, molecule = Chem.MolFromXYZFile('your_file.xyz'), smiles = Chem.MolToSmiles(molecule), print(smiles) $\endgroup$ Jun 9, 2023 at 2:39

1 Answer 1

1
$\begingroup$

In .xyz file there are only atom types and cartesian coordinates of a molecule, so it is generally not able to determine SMILES of that molecule unless you know all chemical bonds present in it.

However, there is a tool called xyz2mol which helps this kind of task - it assigns possible chemical bonds with given .xyz file, and outputs molecule with topology.

To directly obtain SMILES, you can install the package as described in its Github repo and invoke the script as:

xyz2mol.py your_molecule.xyz
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .