6.21. TRZ trajectory I/O — MDAnalysis.coordinates.TRZ

Classes to read IBIsCO / YASP TRZ binary trajectories, including coordinates, velocities and more (see attributes of the Timestep).

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.

6.21.1. Classes

class MDAnalysis.coordinates.TRZ.Timestep(n_atoms, **kwargs)[source]

TRZ custom Timestep

Create a Timestep, representing a frame of a trajectory

Parameters:
  • n_atoms (int) – The total number of atoms this Timestep describes
  • positions (bool, optional) – Whether this Timestep has position information [True]
  • velocities (bool (optional)) – Whether this Timestep has velocity information [False]
  • forces (bool (optional)) – Whether this Timestep has force information [False]
  • reader (Reader (optional)) – A weak reference to the owning Reader. Used for when attributes require trajectory manipulation (e.g. dt)
  • dt (float (optional)) – The time difference between frames (ps). If time is set, then dt will be ignored.
  • time_offset (float (optional)) – The starting time from which to calculate time (in ps)

Changed in version 0.11.0: Added keywords for positions, velocities and forces. Can add and remove position/velocity/force information by using the has_* attribute.

frame

Index of current frame number (0 based)

time

Current system time in ps

n_atoms

Number of atoms in the frame (will be constant throughout trajectory)

pressure

System pressure in pascals

pressure_tensor

Array containing pressure tensors in order: xx, xy, yy, xz, yz, zz

total_energy

Hamiltonian for the system in kJ/mol

potential_energy

Potential energy of the system in kJ/mol

kinetic_energy

Kinetic energy of the system in kJ/mol

temperature

Temperature of the system in Kelvin

dimensions

Unit cell dimensions [A,B,C,alpha,beta,gamma].

class MDAnalysis.coordinates.TRZ.TRZReader(trzfilename, n_atoms=None, **kwargs)[source]

Reads an IBIsCO or YASP trajectory file

ts

Timestep object containing coordinates of current frame

Type:TRZ.Timestep

Note

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).

Creates a TRZ Reader

Parameters:
  • trzfilename (str) – name of input file
  • n_atoms (int) – number of atoms in trajectory, must be taken from topology file!
  • convert_units (bool (optional)) – converts units to MDAnalysis defaults
Writer(filename, n_atoms=None)[source]

A trajectory writer with the same properties as this trajectory.

close()[source]

Close trz file if it was open

delta

MD integration timestep

n_atoms

Number of atoms in a frame

n_frames

Total number of frames in a trajectory

open_trajectory()[source]

Open the trajectory file

skip_timestep

Timesteps between trajectory frames

class MDAnalysis.coordinates.TRZ.TRZWriter(filename, n_atoms, title='TRZ', convert_units=None)[source]

Writes a TRZ format trajectory.

Note

Binary TRZ trajectories are always written in little-endian byte order.

Create a TRZWriter

Parameters:
  • 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; None selects the value of MDAnalysis.core.flags [‘convert_lengths’]. (see Flags)
close()[source]

Close if it was open

class MDAnalysis.coordinates.TRZ.TRZReader(trzfilename, n_atoms=None, **kwargs)[source]

Reads an IBIsCO or YASP trajectory file

ts

Timestep object containing coordinates of current frame

Type:TRZ.Timestep

Note

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).

Creates a TRZ Reader

Parameters:
  • trzfilename (str) – name of input file
  • n_atoms (int) – number of atoms in trajectory, must be taken from topology file!
  • convert_units (bool (optional)) – converts units to MDAnalysis defaults
Writer(filename, n_atoms=None)[source]

A trajectory writer with the same properties as this trajectory.

close()[source]

Close trz file if it was open

delta

MD integration timestep

n_atoms

Number of atoms in a frame

n_frames

Total number of frames in a trajectory

open_trajectory()[source]

Open the trajectory file

skip_timestep

Timesteps between trajectory frames

class MDAnalysis.coordinates.TRZ.TRZWriter(filename, n_atoms, title='TRZ', convert_units=None)[source]

Writes a TRZ format trajectory.

Note

Binary TRZ trajectories are always written in little-endian byte order.

Create a TRZWriter

Parameters:
  • 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; None selects the value of MDAnalysis.core.flags [‘convert_lengths’]. (see Flags)
close()[source]

Close if it was open

class MDAnalysis.coordinates.TRZ.Timestep(n_atoms, **kwargs)[source]

TRZ custom Timestep

Create a Timestep, representing a frame of a trajectory

Parameters:
  • n_atoms (int) – The total number of atoms this Timestep describes
  • positions (bool, optional) – Whether this Timestep has position information [True]
  • velocities (bool (optional)) – Whether this Timestep has velocity information [False]
  • forces (bool (optional)) – Whether this Timestep has force information [False]
  • reader (Reader (optional)) – A weak reference to the owning Reader. Used for when attributes require trajectory manipulation (e.g. dt)
  • dt (float (optional)) – The time difference between frames (ps). If time is set, then dt will be ignored.
  • time_offset (float (optional)) – The starting time from which to calculate time (in ps)

Changed in version 0.11.0: Added keywords for positions, velocities and forces. Can add and remove position/velocity/force information by using the has_* attribute.

dimensions

Unit cell dimensions [A,B,C,alpha,beta,gamma].