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: | filename : str
n_atoms : int
mode : {‘r’, ‘w’}
has_box = ‘detect’
force_overwrite : bool
|
---|
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 |
Close the mdcrd file
Read a trajectory from a mdcrd file
Parameters: | topology : Topology
n_frames : int, optional
stride : np.ndarray, optional
atom_indices : array_like, optional
|
---|---|
Returns: | trajectory : Trajectory
|
Read data from a mdcrd file
Parameters: | n_frames : int, None
stride : np.ndarray, optional
atom_indices : array_like, optional
|
---|---|
Returns: | xyz : np.ndarray, shape=(n_frames, n_atoms, 3), dtype=np.float32
cell_lengths : {np.ndarray, None}
|
Write one or more frames of data to a mdcrd file
Parameters: | xyz : np.ndarray, shape=(n_frames, n_atoms, 3)
cell_lengths : np.ndarray, shape=(n_frames, 3), dtype=float32, optional
|
---|
Move to a new file position
Parameters: | offset : int
whence : {0, 1, 2}
|
---|
Current file position
Returns: | offset : int
|
---|