4.22. Utility functions for the TPR topology parser¶
The MDAnalysis.topology.tpr
module contains classes and
functions on which the Gromacs TPR topology reader
TPRParser
is built.
4.22.1. TPR support¶
The MDAnalysis.topology.tpr
module is required for the
MDAnalysis.topology.TPRParser
module.
-
MDAnalysis.topology.tpr.
SUPPORTED_VERSIONS
= (58, 73, 83)¶ tuple() -> empty tuple tuple(iterable) -> tuple initialized from iterable’s items
If the argument is a tuple, the return value is the same object.
Sub-modules
4.22.2. TPRParser settings¶
Definition of constants.
The currently read file format versions are defined in
SUPPORTED_VERSIONS
.
-
MDAnalysis.topology.tpr.setting.
SUPPORTED_VERSIONS
= (58, 73, 83)¶ Gromacs TPR file format versions that can be read by the TPRParser.
-
MDAnalysis.topology.tpr.setting.
ftupd
= [(20, 3), (20, 4), (20, 5), (34, 6), (43, 7), (43, 8), (70, 9), (76, 12), (30, 13), (30, 14), (30, 15), (34, 16), (43, 17), (26, 20), (26, 22), (43, 23), (65, 24), (60, 25), (61, 26), (61, 27), (72, 28), (72, 29), (41, 32), (41, 33), (32, 37), (32, 41), (32, 42), (46, 43), (30, 44), (36, 46), (22, 50), (22, 51), (22, 52), (26, 55), (26, 56), (49, 66), (50, 67), (46, 68), (20, 69), (46, 73), (69, 75), (66, 76), (54, 78), (76, 47), (79, 81), (79, 82), (79, 83), (79, 84), (79, 85), (54, 78)]¶ Function types from
<gromacs_dir>/src/gmxlib/tpxio.c
-
MDAnalysis.topology.tpr.setting.
interaction_types
= [('BONDS', 'Bond', 2), ('G96BONDS', 'G96Bond', 2), ('MORSE', 'Morse', 2), ('CUBICBONDS', 'Cubic Bonds', 2), ('CONNBONDS', 'Connect Bonds', 2), ('HARMONIC', 'Harmonic Pot.', 2), ('FENEBONDS', 'FENE Bonds', 2), ('TABBONDS', 'Tab. Bonds', 2), ('TABBONDSNC', 'Tab. Bonds NC', 2), ('RESTRAINTPOT', 'Restraint Pot.', 2), ('ANGLES', 'Angle', 3), ('G96ANGLES', 'G96Angle', 3), ('LINEAR_ANGLES', 'Lin. Angle', 3), ('CROSS_BOND_BOND', 'Bond-Cross', 3), ('CROSS_BOND_ANGLE', 'BA-Cross', 3), ('UREY_BRADLEY', 'U-B', 3), ('QANGLES', 'Quartic Angles', 3), ('TABANGLES', 'Tab. Angles', 3), ('PDIHS', 'Proper Dih.', 4), ('RBDIHS', 'Ryckaert-Bell.', 4), ('FOURDIHS', 'Fourier Dih.', 4), ('IDIHS', 'Improper Dih.', 4), ('PIDIHS', 'Improper Dih.', 4), ('TABDIHS', 'Tab. Dih.', 4), ('CMAP', 'CMAP Dih.', 5), ('GB12', 'GB 1-2 Pol.', 2), ('GB13', 'GB 1-3 Pol.', 2), ('GB14', 'GB 1-4 Pol.', 2), ('GBPOL', 'GB Polarization', None), ('NPSOLVATION', 'Nonpolar Sol.', None), ('LJ14', 'LJ-14', 2), ('COUL14', 'Coulomb-14', None), ('LJC14_Q', 'LJC-14 q', 2), ('LJC_NB', 'LJC Pairs NB', 2), ('LJ_SR', 'LJ (SR)', 2), ('BHAM', 'Buck.ham (SR)', 2), ('LJ_LR', 'LJ (LR)', None), ('BHAM_LR', 'Buck.ham (LR)', None), ('DISPCORR', 'Disper. corr.', None), ('COUL_SR', 'Coulomb (SR)', None), ('COUL_LR', 'Coulomb (LR)', None), ('RF_EXCL', 'RF excl.', None), ('COUL_RECIP', 'Coul. recip.', None), ('DPD', 'DPD', None), ('POLARIZATION', 'Polarization', 2), ('WATERPOL', 'Water Pol.', 5), ('THOLE', 'Thole Pol.', 4), ('ANHARM_POL', 'Anharm. Pol.', 2), ('POSRES', 'Position Rest.', 1), ('DISRES', 'Dis. Rest.', 2), ('DISRESVIOL', 'D.R.Viol. (nm)', None), ('ORIRES', 'Orient. Rest.', 2), ('ORDEV', 'Ori. R. RMSD', None), ('ANGRES', 'Angle Rest.', 4), ('ANGRESZ', 'Angle Rest. Z', 2), ('DIHRES', 'Dih. Rest.', 4), ('DIHRESVIOL', 'Dih. Rest. Viol.', None), ('CONSTR', 'Constraint', 2), ('CONSTRNC', 'Constr. No Conn.', 2), ('SETTLE', 'Settle', 3), ('VSITE2', 'Virtual site 2', 3), ('VSITE3', 'Virtual site 3', 4), ('VSITE3FD', 'Virtual site 3fd', 4), ('VSITE3FAD', 'Virtual site 3fad', 4), ('VSITE3OUT', 'Virtual site 3out', 4), ('VSITE4FD', 'Virtual site 4fd', 5), ('VSITE4FDN', 'Virtual site 4fdn', 5), ('VSITEN', 'Virtual site N', 2), ('COM_PULL', 'COM Pull En.', None), ('EQM', 'Quantum En.', None), ('EPOT', 'Potential', None), ('EKIN', 'Kinetic En.', None), ('ETOT', 'Total Energy', None), ('ECONS', 'Conserved En.', None), ('TEMP', 'Temperature', None), ('VTEMP', 'Vir. Temp. (not used)', None), ('PDISPCORR', 'Pres. DC', None), ('PRES', 'Pressure', None), ('DH/DL_CON', 'dH/dl constr.', None), ('DV/DL', 'dVremain/dl', None), ('DK/DL', 'dEkin/dl', None), ('DVC/DL', 'dVcoul/dl', None), ('DVV/DL', 'dVvdw/dl', None), ('DVB/DL', 'dVbonded/dl', None), ('DVR/DL', 'dVrestraint/dl', None), ('DVT/DL', 'dVtemperature/dl', None)]¶ Interaction types from
<gromacs_dir>/gmxlib/ifunc.c
4.22.3. Class definitions for the TPRParser¶
-
class
MDAnalysis.topology.tpr.obj.
Atom
(m, q, mB, qB, tp, typeB, ptype, resind, atomnumber)¶ -
atomnumber
¶ Alias for field number 8
-
m
¶ Alias for field number 0
-
mB
¶ Alias for field number 2
-
ptype
¶ Alias for field number 6
-
q
¶ Alias for field number 1
-
qB
¶ Alias for field number 3
-
resind
¶ Alias for field number 7
-
tp
¶ Alias for field number 4
-
typeB
¶ Alias for field number 5
-
-
class
MDAnalysis.topology.tpr.obj.
Atoms
(atoms, nr, nres, type, typeB, atomnames, resnames)¶ -
atomnames
¶ Alias for field number 5
-
atoms
¶ Alias for field number 0
-
nr
¶ Alias for field number 1
-
nres
¶ Alias for field number 2
-
resnames
¶ Alias for field number 6
-
type
¶ Alias for field number 3
-
typeB
¶ Alias for field number 4
-
-
class
MDAnalysis.topology.tpr.obj.
Box
(size, rel, v)¶ -
rel
¶ Alias for field number 1
-
size
¶ Alias for field number 0
-
v
¶ Alias for field number 2
-
-
class
MDAnalysis.topology.tpr.obj.
Ilist
(nr, ik, iatoms)¶ -
iatoms
¶ Alias for field number 2
-
ik
¶ Alias for field number 1
-
nr
¶ Alias for field number 0
-
-
class
MDAnalysis.topology.tpr.obj.
InteractionKind
(name, long_name, natoms)[source]¶ natoms: number of atoms involved in this type of interaction
-
class
MDAnalysis.topology.tpr.obj.
Molblock
(molb_type, molb_nmol, molb_natoms_mol, molb_nposres_xA, molb_nposres_xB)¶ -
molb_natoms_mol
¶ Alias for field number 2
-
molb_nmol
¶ Alias for field number 1
-
molb_nposres_xA
¶ Alias for field number 3
-
molb_nposres_xB
¶ Alias for field number 4
-
molb_type
¶ Alias for field number 0
-
-
class
MDAnalysis.topology.tpr.obj.
MoleculeKind
(name, atomkinds, bonds=None, angles=None, dihe=None, impr=None, donors=None, acceptors=None)[source]¶
-
class
MDAnalysis.topology.tpr.obj.
Mtop
(nmoltype, moltypes, nmolblock)¶ -
moltypes
¶ Alias for field number 1
-
nmolblock
¶ Alias for field number 2
-
nmoltype
¶ Alias for field number 0
-
-
class
MDAnalysis.topology.tpr.obj.
Params
(atnr, ntypes, functype, reppow, fudgeQQ, iparams)¶ -
atnr
¶ Alias for field number 0
-
fudgeQQ
¶ Alias for field number 4
-
functype
¶ Alias for field number 2
-
iparams
¶ Alias for field number 5
-
ntypes
¶ Alias for field number 1
-
reppow
¶ Alias for field number 3
-
-
class
MDAnalysis.topology.tpr.obj.
TPRTopology
(atoms, bonds, angles, dihe, impr)¶ -
angles
¶ Alias for field number 2
-
atoms
¶ Alias for field number 0
-
bonds
¶ Alias for field number 1
-
dihe
¶ Alias for field number 3
-
impr
¶ Alias for field number 4
-
-
class
MDAnalysis.topology.tpr.obj.
TpxHeader
(number, ver_str, precision, fver, fgen, file_tag, natoms, ngtc, fep_state, lamb, bIr, bTop, bX, bV, bF, bBox)¶ -
bBox
¶ Alias for field number 15
-
bF
¶ Alias for field number 14
-
bIr
¶ Alias for field number 10
-
bTop
¶ Alias for field number 11
-
bV
¶ Alias for field number 13
-
bX
¶ Alias for field number 12
-
fep_state
¶ Alias for field number 8
-
fgen
¶ Alias for field number 4
-
file_tag
¶ Alias for field number 5
-
fver
¶ Alias for field number 3
-
lamb
¶ Alias for field number 9
-
natoms
¶ Alias for field number 6
-
ngtc
¶ Alias for field number 7
-
number
¶ Alias for field number 0
-
precision
¶ Alias for field number 2
-
ver_str
¶ Alias for field number 1
-
4.22.4. Utilities for the TPRParser¶
Function calling order:
(TPRParser.py call do_mtop)
do_mtop -> do_symtab
-> do_ffparams -> do_iparams
-> do_moltype -> do_atoms -> do_atom
-> do_resinfo
-> do_ilists
-> do_block
-> do_blocka
-> do_molblock
Then compose the stuffs in the format MDAnalysis.Universe
reads in.
The module also contains the do_inputrec()
to read the TPR header with.
-
MDAnalysis.topology.tpr.utils.
define_unpack_real
(prec, data)[source]¶ Define an unpack_real method of data based on the float precision used