mdtraj.formats.GroTrajectoryFile

class mdtraj.formats.GroTrajectoryFile(filename, mode='r', force_overwrite=True)

Interface for reading and writing to GROMACS GRO files.

Parameters
filenamestr

The filename to open. A path to a file on disk.

mode{‘r’, ‘w’}

The mode in which to open the file, either ‘r’ for read or ‘w’ for write.

force_overwritebool

If opened in write mode, and a file by the name of filename already exists on disk, should we overwrite it?

See also

load_gro

High-level wrapper that returns a md.Trajectory

Attributes
n_atomsint

The number of atoms in the file

topologymd.Topology

The topology. TODO(rmcgibbo) note about chain

Methods

close(self)

Close the file

read(self[, n_frames, stride, atom_indices])

Read data from a molecular dynamics trajectory in the GROMACS GRO format.

read_as_traj(self[, n_frames, stride, …])

Read a trajectory from a gro file

seek(self, offset[, whence])

Move to a new file position

tell(self)

Current file position

write(self, coordinates, topology[, time, …])

Write one or more frames of a molecular dynamics trajectory to disk in the GROMACS GRO format.

__init__(self, filename, mode='r', force_overwrite=True)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, filename[, mode, force_overwrite])

Initialize self.

close(self)

Close the file

read(self[, n_frames, stride, atom_indices])

Read data from a molecular dynamics trajectory in the GROMACS GRO format.

read_as_traj(self[, n_frames, stride, …])

Read a trajectory from a gro file

seek(self, offset[, whence])

Move to a new file position

tell(self)

Current file position

write(self, coordinates, topology[, time, …])

Write one or more frames of a molecular dynamics trajectory to disk in the GROMACS GRO format.

Attributes

distance_unit