6.18. Gromacs portable run input TPR format parser

6.18.1. Classes

class MDAnalysis.topology.TPRParser.TPRParser(filename)[source]

Read topology information from a Gromacs TPR file.

parse(**kwargs)[source]

Parse a Gromacs TPR file into a MDAnalysis internal topology structure.

Returns:structure
Return type:dict

6.18.2. Development notes

The TPR reader is a pure-python implementation of a basic TPR parser. Currently the following sections of the topology are parsed:

  • Atoms: number, name, type, resname, resid, segid, mass, charge, [residue, segment, radius, bfactor, resnum, moltype]
  • Bonds
  • Angels
  • Dihedrals
  • Impropers

This tpr parser is written according to the following files

  • gromacs_dir/src/kernel/gmxdump.c
  • gromacs_dir/src/gmxlib/tpxio.c (the most important one)
  • gromacs_dir/src/gmxlib/gmxfio_rw.c
  • gromacs_dir/src/gmxlib/gmxfio_xdr.c
  • gromacs_dir/include/gmxfiofio.h

or their equivalent in more recent versions of Gromacs.

The function read_tpxheader() is based on the TPRReaderDevelopment notes. Functions with names starting with read_ or do_ are trying to be similar to those in gmxdump.c or tpxio.c, those with extract_ are new.

Wherever fver_err(fver) is used, it means the tpx version problem has not been solved. Versions prior to Gromacs 4.0.x are not supported.