5.1.4.5.1. Gromacs TOP file format
5.1.4.5.1.1. Classes
- class gromacs.fileformats.top.TOP(fname)[source]
Class to make a TOP object from a GROMACS processed.top file
The force-field and molecules data is exposed as python object.
Note
Only processed.top files generated by GROMACS ‘grompp -pp’ are supported - the usual topol.top files are not supported (yet!)
Initialize the TOP structure.
- Arguments:
- fname
name of the processed.top file
- class gromacs.fileformats.top.SystemToGroTop(system, outfile='output.top', multiple_output=False)[source]
Converter class - represent TOP objects as GROMACS topology file.
Initialize GROMACS topology writer.
- Arguments:
- system
blocks.System
object, containing the topology- outfile
name of the file to write to
- multiple_output
if True, write moleculetypes to separate files, named mol_MOLNAME.itp (default: False)
5.1.4.5.1.2. History
Sources adapted from code by Reza Salari https://github.com/resal81/PyTopol
5.1.4.5.1.3. Example: Read a processed.top file and scale charges
Run grompp -pp
to produce a processed.top from conf.gro, grompp.mdp and topol.top files:
$ grompp -pp
This file now containts all the force-field information:
from gromacs.fileformats import TOP
top = TOP("processed.top")
Scale the LJ epsilon by an arbitrary number, here 0.9
scaling = 0.9
for at in top.atomtypes:
at.gromacs['param']['lje'] *= scaling
Write out the scaled down topology:
top.write("output.top")
Note
You can use this to prepare a series of top files for Hamiltonian Replica
Exchange (HREX) simulations. See scripts/gw-partial_tempering.py
for an example.