Trajectory Reference

Loading molecular dynamics trajectories is easy with MDTraj.

>>> import mdtraj as md
>>> t = md.load('trajectory.pdb')

The function mdtraj.load() will automatically detect the appropriate format based on the filename extension. The supported formats are all listed below in the format-specific loaders. The return value of mdtraj.load() is an mdtraj.Trajectory object.

While mdtraj.load() will read an entire trajectory into memory, other functions like mdtraj.iterload() and mdtraj.open() are available for working with trajectories in chunks, without loading them entirely into memory all at once.

Internal representation

Trajectory(xyz, topology[, time, …])

Container object for a molecular dynamics trajectory

Topology()

Topology stores the topological information about a system.

Format-agnostic loading functions

load(filename_or_filenames[, …])

Load a trajectory from one or more files on disk.

iterload(filename[, chunk])

An iterator over a trajectory from one or more files on disk, in fragments

load_frame(filename, index[, top, atom_indices])

Load a single frame from a trajectory file

open(filename[, mode, force_overwrite])

Open a trajectory file-like object

join(trajs[, check_topology, …])

Concatenate multiple trajectories into one long trajectory

Format-specific loading functions

load_binpos(filename[, top, stride, …])

Load an AMBER .binpos file from disk.

load_lh5(filename[, top, stride, …])

Load an deprecated MSMBuilder2 LH5 trajectory file.

load_pdb(filename[, stride, atom_indices, …])

Load a RCSB Protein Data Bank file from disk.

load_xml(filename[, top])

Load a single conformation from an OpenMM XML file.

load_arc(filename[, stride, atom_indices, frame])

Load a TINKER .arc file from disk.

load_dcd(filename[, top, stride, …])

Load an DCD file from disk.

load_dtr(filename[, top, stride, …])

Load a dtr file from disk.

load_hdf5(filename[, stride, atom_indices, …])

Load an MDTraj hdf5 trajectory file from disk.

load_netcdf(filename[, top, stride, …])

Load an AMBER NetCDF file.

load_trr(filename[, top, stride, …])

Load a Gromacs TRR file from disk.

load_xtc(filename[, top, stride, …])

Load a Gromacs XTC file from disk.

load_prmtop(filename, \*\*kwargs)

Load an AMBER prmtop topology file from disk.

load_xyz(filename[, top, stride, …])

Load a xyz trajectory file.

load_lammpstrj(filename[, top, stride, …])

Load a LAMMPS trajectory file.

load_hoomdxml(filename[, top])

Load a single conformation from an HOOMD-Blue XML file.