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

Reads the structure of the polyatomic system 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 input geometry, 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.

Parameters
• filepath (str) – name of the molecular structure file in the working directory or the absolute 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

Example

>>> read_structure('h2_ref.xyz')
[['H', (0.0, 0.0, -0.35)], ['H', (0.0, 0.0, 0.35)]]