### Navigation

- index
- modules |
- next |
- previous |
- MDAnalysis 0.7.7 documentation »
- 5. Coordinates modules »

# 5.14. XYZ trajectory reader — `MDAnalysis.coordinates.XYZ`

Resources: the XYZ format was taken from http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/xyzplugin.html and is therefore compatible with VMD (you need a PDB or PSF file to define the topology, just as here)

- comments are not allowed in the XYZ file
- the atom name (first column) is ignored
- the coordinates are assumed to be space-delimited rather than fixed width (this may cause issues - see below)
- all fields to the right of the z-coordinate are ignored
- it is assumed that the coordinates are in Angstroms
- the unitcell information is all zeros since this is not recorded in the XYZ format
- the length of a timestep can be set by passing the delta argument, it’s assumed to be in ps (default: 1 ps)

There appears to be no rigid format definition so it is likely users will need to tweak this Class.

class `MDAnalysis.coordinates.XYZ.``XYZReader`(xyzfilename, **kwargs)

  Reads from an XYZ file

  Data : | ts Timestep object containing coordinates of current frame
  Methods : | `len(xyz)` return number of frames in xyz `for ts in xyz:` iterate through trajectory

  File format: http://www.ks.uiuc.edu/Research/vmd/plugins/molfile/xyzplugin.html

  Validation: the geometric centre of 1284 atoms was calculated over 500 frames using both MDAnalysis and a VMD Tcl script. There was exact agreement (measured to 3DP). bzipped and gzipped versions of the XYZ file were also tested

  `close`()

    Close xyz trajectory file if it was open.

  `numatoms`

    number of atoms in a frame

  `rewind`()

    reposition on first frame

### Navigation

- index
- modules |
- next |
- previous |
- MDAnalysis 0.7.7 documentation »
- 5. Coordinates modules »