qml.qchem.read_structure¶
-
read_structure
(filepath, outpath='.')[source]¶ Read 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. Additionally, the new file
structure.xyz
, containing the input geometry, is created in a directory with path given byoutpath
.- 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
symbols of the atoms in the molecule and a 1D array with their positions in atomic units.
- Return type
tuple[list, array]
Example
>>> symbols, coordinates = read_structure('h2.xyz') >>> print(symbols, coordinates) ['H', 'H'] [0. 0. -0.66140414 0. 0. 0.66140414]