Reads the structure of the polyatomic system from a file and returns a list with the symbols of the atoms in the molecule and a 1D array with their positions \([x_1, y_1, z_1, x_2, y_2, z_2, \dots]\) in atomic units (Bohr radius = 1).
The atomic coordinates in the file must be in Angstroms. 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
Open Babel can be installed using
aptif 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.
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
symbols of the atoms in the molecule and a 1D array with their positions in atomic units.
- Return type
>>> symbols, coordinates = read_structure('h2.xyz') >>> print(symbols, coordinates) ['H', 'H'] [0. 0. -0.66140414 0. 0. 0.66140414]