6.18. TNG trajectory files — MDAnalysis.coordinates.TNG

The TNG format [Lundborg2014] is a format used in GROMACS for storage of trajectory and topology information. The TNG format allows a wide range of compression algorithms and unlike the compressed XTC format can also store velocities and forces in addition to positions.

The classes in this module are based on the pytng package for reading TNG files. The reader is directed to the pytng documentation for further reading about how pytng works under the hood. Pytng is an optional dependency and must be installed to use this Reader. Use of the reader without pytng installed will raise an ImportError. The variable HAS_PYTNG indicates whether this module has pytng availble.

In addition to particle-dependent trajectory information like positions, forces and velocities, the TNG format can store trajectory metadata and other arbitrary time dependent data. Additional information can range from the virial and pressure components to the molecular topology of the system. This is enabled by a block based system in which binary flags indicate the presence or absence of various data blocks. The structure of a TNG file is provided in the TNG specification. The TNG paper [Lundborg2014] and the pytng documentation are also good resources. The user is encouraged to read the full list of TNG blocks to understand the full power of the TNG format.

6.18.1. Current Limitations

Currently there is only a Reader for TNG files and no Writer. This will depend on upstream changes in pytng. Additionally, it is not currently possible to read the molecular topology from a TNG file.

There are also some limitations to reading TNG files with pytng. Currently we do not allow data to be read off stride. In essence this means that all of the critical trajectory data (positions, box, velocities (if present), forces (if present)) must share the same stride in trajectory integrator steps. These critical blocks in the TNG file are henceforth called special blocks. Optional blocks (all blocks that are not special blocks) will not be read if they do not share an integrator step with, or are not divisible by the shared integrator step of the special blocks.


[Lundborg2014] (1,2,3)

Magnus Lundborg, Rossen Apostolov, Daniel Spångberg, Anders Gärdenäs, David van der Spoel, and Erik Lindahl. An efficient and extensible format, library, and api for binary trajectory data from molecular simulations. Journal of Computational Chemistry, 35(3):260–269, 2014. URL: https://onlinelibrary.wiley.com/doi/abs/10.1002/jcc.23495, doi:https://doi.org/10.1002/jcc.23495.