qml.qchem.read_structure

read_structure(filepath, outpath='.')[source]

Reads the molecular structure from a file and creates a list containing the symbol and Cartesian coordinates of the atomic species.

The xyz format is supported out of the box. If Open Babel is installed, any format recognized by Open Babel is also supported. Additionally, the new file structure.xyz, containing the geometry of the molecule, is created in a directory with path given by outpath.

Open Babel can be installed using apt if on Ubuntu:

sudo apt install openbabel

or using Anaconda:

conda install -c conda-forge openbabel

See the Open Babel documentation for more details on installation.

Example usage:

>>> read_structure('h2_ref.xyz')
[['H', (0.0, 0.0, -0.35)], ['H', (0.0, 0.0, 0.35)]]
Parameters
  • filepath (str) – name of the molecular structure file in the working directory or the full path to the file if it is located in a different folder

  • outpath (str) – path to the output directory

Returns

for each atomic species, a list containing the symbol and the Cartesian coordinates

Return type

list