Interface for reading and writing to a GROMACS TRR file. This is a file-like objec that supports both reading and writing. It also supports the context manager protocol, so you can use it with the python ‘with’ statement.
The conventional units in the TRR file are nanometers and picoseconds. The format only supports saving coordinates, the time, the md step, and the unit cell parametrs (box vectors)
| Parameters: | filename : str 
 mode : {‘r’, ‘w’} 
 force_overwrite : bool 
 | 
|---|---|
| Other Parameters: | |
| min_chunk_size : int, default=100 
 chunk_size_multiplier, int, default=1.5 
 | |
See also
Examples
>>> # load up the data from a trr
>>> with XTCTrajectoryFile('traj.trr') as f:
>>>    xyz, time, step, box, lambdas = f.read()
x.__init__(...) initializes x; see help(type(x)) for signature
Methods
| close | Close the TRR file | 
| read([n_frames, stride, atom_indices]) | Read data from a TRR file | 
| seek | Move to a new file position | 
| tell | Current file position | 
| write(xyz[, time, step, box, lambd]) | Write data to a TRR file | 
Attributes
| distance_unit | 
Close the TRR file
Read data from a TRR file
| Parameters: | n_frames : int, None 
 stride : int, optional 
 atom_indices : array_like, optional 
 | 
|---|---|
| Returns: | xyz : np.ndarray, shape=(n_frames, n_atoms, 3), dtype=np.float32 
 time : np.ndarray, shape=(n_frames), dtype=np.float32 
 step : np.ndarray, shape=(n_frames), dtype=np.int32 
 box : np.ndarray, shape=(n_frames, 3, 3), dtype=np.float32 
 lambd : np.ndarray, shape=(n_frames), dtype=np.float32 
 | 
Move to a new file position
| Parameters: | offset : int 
 whence : {0, 1, 2} 
 | 
|---|
Current file position
| Returns: | offset : int 
 | 
|---|
Write data to a TRR file
| Parameters: | xyz : np.ndarray, dtype=np.float32, shape=(n_frames, n_atoms, 3) 
 time : np.ndarray, dtype=float32, shape=(n_frames), optional 
 step : np.ndarray, dtype=int32, shape=(n_frames), optional 
 box : np.ndarray, dtype=float32, shape=(n_frames, 3, 3), optional 
 lambd : np.ndarray, dtype=np.float32, shape=(n_frames), optional 
 | 
|---|