mdtraj.load_xyz

mdtraj.load_xyz(filename, top=None, stride=None, atom_indices=None, frame=None)[source]

Load a xyz trajectory file.

While there is no universal standard for this format, this plugin adheres to the same format as the VMD plugin:

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

Most notably, units are in angstroms and anything past the ‘z’ field is ignored.

Parameters:
  • filename (path-like) – Path of xyz trajectory file.

  • top ({str, Trajectory, Topology}) – The xyz format does not contain topology information. Pass in either the path to a pdb file, a trajectory, or a topology to supply this information.

  • stride (int, default=None) – Only read every stride-th frame

  • atom_indices (array_like, optional) – If not none, then read only a subset of the atoms coordinates from the file.

  • frame (int, optional) – Use this option to load only a single frame from a trajectory on disk. If frame is None, the default, the entire trajectory will be loaded. If supplied, stride will be ignored.

Returns:

trajectory – The resulting trajectory, as an md.Trajectory object.

Return type:

md.Trajectory

See also

mdtraj.XYZTrajectoryFile

Low level interface to xyz files