mdtraj.formats.MDCRDTrajectoryFile¶
-
class
mdtraj.formats.
MDCRDTrajectoryFile
(filename, n_atoms=None, mode='r', has_box='detect', force_overwrite=True)¶ Interface for reading and writing to an AMBER mdcrd files. This is a file-like object, that both reading or writing depending on the mode flag. It implements the context manager protocol, so you can also use it with the python ‘with’ statement.
The conventional units in the mdcrd file are angstroms. The format only supports storing the cartesian coordinates and box lengths.
- Parameters
- filenamestr
The filename to open. A path to a file on disk.
- n_atomsint
The number of atoms in the system. This is _required_ when mode == ‘r’ and irrelevant when mode == ‘w’.
- mode{‘r’, ‘w’}
The mode in which to open the file, either ‘r’ for read or ‘w’ for write.
- has_box = ‘detect’
Does the mdcrd file contain box length information? This is optional when mode == ‘r’ (and irrelevant when mode == ‘w’). The presence or absence of box information can generally be inferred from the file, but there might be corner cases in which this is not possible, because of limitations in the mdcrd format.
- force_overwritebool
If opened in write mode, and a file by the name of filename already exists on disk, should we overwrite it?
Methods
close
()Close the mdcrd file
read
([n_frames, stride, atom_indices])Read data from a mdcrd file
read_as_traj
(topology[, n_frames, stride, …])Read a trajectory from a mdcrd file
seek
(offset[, whence])Move to a new file position
tell
()Current file position
write
(xyz[, cell_lengths])Write one or more frames of data to a mdcrd file
-
__init__
(filename, n_atoms=None, mode='r', has_box='detect', force_overwrite=True)¶ Open an AMBER mdcrd file for reading/writing.
Methods
__init__
(filename[, n_atoms, mode, has_box, …])Open an AMBER mdcrd file for reading/writing.
close
()Close the mdcrd file
read
([n_frames, stride, atom_indices])Read data from a mdcrd file
read_as_traj
(topology[, n_frames, stride, …])Read a trajectory from a mdcrd file
seek
(offset[, whence])Move to a new file position
tell
()Current file position
write
(xyz[, cell_lengths])Write one or more frames of data to a mdcrd file
Attributes
distance_unit