mdtraj.load_frame

mdtraj.load_frame(filename, index, top=None, atom_indices=None, **kwargs)[source]

Load a single frame from a trajectory file

Parameters:
  • filename (path-like) – Path to the trajectory file on disk

  • index (int) – Load the index-th frame from the specified file

  • top ({str, Trajectory, Topology}) – Most trajectory formats do not contain topology information. Pass in either the path to a RCSB PDB file, a trajectory, or a topology to supply this information.

  • atom_indices (array_like, optional) – If not none, then read only a subset of the atoms coordinates from the file. These indices are zero-based (not 1 based, as used by the PDB format).

Examples

>>> import mdtraj as md
>>> first_frame = md.load_frame('traj.h5', 0)
>>> print first_frame
<mdtraj.Trajectory with 1 frames, 22 atoms>

See also

load, load_frame

Returns:

trajectory – The resulting conformation, as an md.Trajectory object containing a single frame.

Return type:

md.Trajectory