Generate Gromacs Topology File

Classes

class gentop.SystemTopology(gro, ff='gaff', restraints=False, xlink=False, xlinked_top_name='assembly.itp', fix_residues=False)
__init__(gro, ff='gaff', restraints=False, xlink=False, xlinked_top_name='assembly.itp', fix_residues=False)

Read coordinate file, identify and count different residues, and figure out where inidividual residue topologies are located

Parameters:
  • gro (str) – coordinate file for which to create topology
  • ff (str) – forcefield to use
  • restraints (bool) – True if there are any position restraints
  • xlink (bool) – True if system is cross-linked (Topology is specialized in this case)
  • xlinked_top_name (str) – Name of topology describing cross-linked system (include full path if not located in same directory where this script is run)
add_residue(residue, n=1, write=False, topname='topol.top', top_description='Simulation Box')

Add molecule(s) of a single residue to the topology

Parameters:
  • residue (LLC_Membranes.llclib.topology.Residue object) – name of residue object
  • n (int) – number of molecules to add
  • write (bool) – write new topology file
  • topname (str) – name of output topology if written
  • top_description (str) – system description to be written into top if desired
remove_residue(residue, n=1, write=False, topname='topol.top', top_description='Simulation Box')

Remove a residue from the topology

Parameters:
  • residue (LLC_Membranes.llclib.topology.Residue object) – name of residue object
  • n (int) – number of molecules to add
  • write (bool) – write new topology file
  • topname (str) – name of output topology if written
  • top_description (str) – system description to be written into top if desired
write_top(name='topol.top', description='Simulation Box', restrained_top_name='restrained.itp')

Write out the topology in appropriate GROMACS format

Parameters:
  • name (str) – name of output topology file
  • description (str) – Description to add to [ system ] section of topology
  • restrained_top_name (str) – Name of topology file that includes position restraints (TODO: add this to __init__)

Command Line Functionality

One can run this as a script from the command line as follows. However, in most cases it is probably more convenient to use input.py

Generate topology file from coordinate file.

usage: gentop.py [-h] [-g GRO] [-o OUTPUT] [-d DESCRIPTION] [-ff FORCEFIELD]
                 [-xlink] [-xlink_topname XLINK_TOPNAME]

Named Arguments

-g, --gro Name of coordinate file to write topology file for
-o, --output

Name of topology to output

Default: “topol.top”

-d, --description
 

Description of system to put under [ system ] directive

Default: “Simulation box”

-ff, --forcefield
 

Name of forcefield to use

Default: “gaff”

-xlink

Create topology for cross-linked system

Default: False

-xlink_topname

Name of cross-linked topology

Default: “assembly.itp”