mdtraj.load_xtc(filename, top=None, stride=None, atom_indices=None, frame=None)

Load a Gromacs XTC file from disk.

The .xtc format is a cross-platform compressed binary trajectory format produced by the gromacs software that stores atomic coordinates, box vectors, and time information. It is lossy (storing coordinates to about 1e-3 A) and extremely space-efficient.

Parameters
filenamestr

Filename (string) of xtc trajectory.

top{str, Trajectory, Topology}

The XTC format does not contain topology information. Pass in either the path to a RCSB PDB file, a trajectory, or a topology to supply this information.

strideint, default=None

atom_indicesarray_like, optional

If not none, then read only a subset of the atoms coordinates from the file. This may be slightly slower than the standard read because it requires an extra copy, but will save memory.

frameint, 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
trajectorymd.Trajectory

The resulting trajectory, as an md.Trajectory object.

mdtraj.XTCTrajectoryFile
>>> import mdtraj as md