5.16. TRZ trajectory I/O — MDAnalysis.coordinates.TRZ¶
Classes to read IBIsCO / YASP binary trajectories.
Reads coordinates, velocities and more (see attributes of the
Timestep).
-
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
timeis set, then dt will be ignored. - time_offset (float, optional) – The starting time from which to calculate time (ps)
- versionchanged (.) – 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
Data: - ts
Timestepobject containing coordinates of current frame
-
``len(trz)`` returns the number of frames
-
``for ts in trz`` iterates through the trajectory
-
``for ts in trz[start stop:skip]`` iterate through a trajectory using slicing
-
``trz[i]`` random access of a trajectory frame
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* – name of input file
- *n_atoms* – number of atoms in trajectory, must taken from topology file!
- *convert_units* – converts units to MDAnalysis defaults
-
delta¶ MD integration timestep
-
n_atoms¶ Number of atoms in a frame
-
n_frames¶ Total number of frames in a trajectory
-
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.
-
``W = TRZWriter(trzfilename, n_atoms, title='TRZ')``
Create a TRZWriter
Parameters: - *filename* – name of output file
- *n_atoms* – number of atoms in trajectory
Keywords: - title
title of the trajectory; the title must be 80 characters or shorter, a longer title raises a ValueError exception.
- convert_units
units are converted to the MDAnalysis base format;
Noneselects the value ofMDAnalysis.core.flags[‘convert_lengths’]. (see Flags)
-
-
class
MDAnalysis.coordinates.TRZ.TRZReader(trzfilename, n_atoms=None, **kwargs)[source] Reads an IBIsCO or YASP trajectory file
Data: - ts
Timestepobject containing coordinates of current frame
-
``len(trz)`` returns the number of frames
-
``for ts in trz`` iterates through the trajectory
-
``for ts in trz[start stop:skip]`` iterate through a trajectory using slicing
-
``trz[i]`` random access of a trajectory frame
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* – name of input file
- *n_atoms* – number of atoms in trajectory, must taken from topology file!
- *convert_units* – converts units to MDAnalysis defaults
-
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.
-
``W = TRZWriter(trzfilename, n_atoms, title='TRZ')``
Create a TRZWriter
Parameters: - *filename* – name of output file
- *n_atoms* – number of atoms in trajectory
Keywords: - title
title of the trajectory; the title must be 80 characters or shorter, a longer title raises a ValueError exception.
- convert_units
units are converted to the MDAnalysis base format;
Noneselects the value ofMDAnalysis.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
timeis set, then dt will be ignored. - time_offset (float, optional) – The starting time from which to calculate time (ps)
- versionchanged (.) – 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].