# pymatgen.io.xyz module

Module implementing an XYZ file object class.

class XYZ(mol: pymatgen.core.structure.Molecule, coord_precision: int = 6)

  Bases: `object`

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

  Note

  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.

  Parameters

    - mol – Input molecule or list of molecules

    - coord_precision – Precision to be used for coordinates.

  property all_molecules

    Returns all the frames of molecule associated with this XYZ.

  as_dataframe()

    Generates a coordinates data frame with columns: atom, x, y, and z In case of multiple frame XYZ, returns the last frame.

    Returns

      pandas.DataFrame

  static from_file(filename)

    Creates XYZ object from a file.

    Parameters

      filename – XYZ filename

    Returns

      XYZ object

  static from_string(contents)

    Creates XYZ object from a string.

    Parameters

      contents – String representing an XYZ file.

    Returns

      XYZ object

  property molecule: pymatgen.core.structure.Molecule

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

  write_file(filename)

    Writes XYZ to file.

    Parameters

      filename – File name of output file.