6.20. TRZ trajectory I/O —
Data are read and written in binary representation but because this depends on the machine hardware architecture, MDAnalysis always reads and writes TRZ trajectories in little-endian byte order.
- class MDAnalysis.coordinates.TRZ.TRZReader(trzfilename, n_atoms=None, **kwargs)
Reads an IBIsCO or YASP trajectory file
Binary TRZ trajectories are always assumed to be written in little-endian byte order and are read as such.
Changed in version 0.11.0: Frames now 0-based instead of 1-based. Extra data (Temperature, Energies, Pressures, etc) now read into ts.data dictionary. Now passes a weakref of self to ts (ts._reader).
Changed in version 1.0.1: Now checks for the correct n_atoms on reading and can raise
Changed in version 2.1.0: TRZReader now returns a default
dtof 1.0 when it cannot be obtained from the difference between two frames.
Creates a TRZ Reader
ValueError – If n_atoms or the number of atoms in the topology file do not match the number of atoms in the trajectory.
- Writer(filename, n_atoms=None)
A trajectory writer with the same properties as this trajectory.
Close trz file if it was open
- property delta
MD integration timestep
- property n_atoms
Number of atoms in a frame
- property n_frames
Total number of frames in a trajectory
Open the trajectory file
- property skip_timestep
Timesteps between trajectory frames
- class MDAnalysis.coordinates.TRZ.TRZWriter(filename, n_atoms, title='TRZ', convert_units=True)
Writes a TRZ format trajectory.
Binary TRZ trajectories are always written in little-endian byte order.
Create a TRZWriter
filename (str) – name of output file
n_atoms (int) – number of atoms in trajectory
title (str (optional)) – title of the trajectory; the title must be 80 characters or shorter, a longer title raises a ValueError exception.
convert_units (bool (optional)) – units are converted to the MDAnalysis base format; [
Close if it was open