GenTopo: A python tool kit for generating gromacs topology template

GenTopo: A python toolkit for generating gromacs topology template.


Code link: GitHub - masrul/GenTopo


For non-standard Force-field (which cannot be invoked through pdb2gmx), this tool can be used to generate gromacs topology template. It uses slightly different approach than x2top. It requires a PDB file of the molecule, which has two extra entries after the 80th column/character respectively atomTypes and charges. An example PDB file can be found in Example/test.pdb. It is recommended to have connectivity information in the PDB file, but not mandatory. If connectivity is missing, then the code will generate connectivity information using the heuristic of Van der Waals radius of atoms. In addition to internal coordinates, it also creates all required bondTypes, angleTypes, and dihedralTypes. GenTopo is independent of particular force filed, it simply creates template. User needs to provide required parameters once template is created. An example topology template created by GenTopo can be found in Example/

# File name: Example/
# python 

from GenTopo.Coord import PDBobj
from GenTopo.Graph import MolGraph
from GenTopo.GMXTopo import Topo

# load a PDB file
mol = PDBobj("test.pdb") 

# Create a Molecular Graph for generating bond, angles, dihedral etc. 
graph = MolGraph(mol, guessImpropers=True)

# Now create gromacs topology by passing mol and graph 
gmx = Topo(mol, graph)

# write topology file 


  • PDB to gromacs template

  • Generates internal coordinates

    • Bonds
    • Angles
    • Dihedrals
    • Pairs (1-4)
    • Improper dihedrals (for aromatic molecule)
  • Generates types

    • Bonds types
    • Angle types
    • Dihedral types
  • Support periodic molecule


git clone 
cd GenTopo
pip install . 

Contact Person: Masrul Huda