class XYZ(mol, coord_precision=6)[source]

Bases: object

Basic class for importing and exporting Molecules or Structures in XYZ format.

Parameters:mol – Input molecule or list of molecules


Exporting periodic structures in the XYZ format will lose information about the periodicity. Essentially, only cartesian coordinates are written in this format and no information is retained about the lattice.


Returns all the frames of molecule associated with this XYZ.

static from_file(filename)[source]

Creates XYZ object from a file.

Parameters:filename – XYZ filename
Returns:XYZ object
static from_string(contents)[source]

Creates XYZ object from a string.

Parameters:contents – String representing an XYZ file.
Returns:XYZ object

Returns molecule associated with this XYZ. In case multiple frame XYZ, returns the last frame.


Writes XYZ to file.

Parameters:filename – File name of output file.