mdtraj.load_hdf5

mdtraj.load_hdf5(filename, stride=None, atom_indices=None, frame=None)

Load an MDTraj hdf5 trajectory file from disk.

Parameters
filenamestr

String filename of HDF Trajectory file.

strideint, default=None

Only read every stride-th frame

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.

See also

mdtraj.HDF5TrajectoryFile

Low level interface to HDF5 files

Examples

>>> import mdtraj as md
>>> traj = md.load_hdf5('output.h5')
>>> print traj
<mdtraj.Trajectory with 500 frames, 423 atoms at 0x110740a90>
>>> traj2 = md.load_hdf5('output.h5', stride=2, top='topology.pdb')
>>> print traj2
<mdtraj.Trajectory with 250 frames, 423 atoms at 0x11136e410>