How to set up a GROMACS simulation with a molecule parametrized in SwissParam

This tutorial shows how to use SwissParam to setup a molecular dynamics simulation of a protein with a small-molecule ligand in GROMACS, using the CHARMM forcefield. When using the CHARMM forcefield in GROMACS, please cite [1]. When using SwissParam, please cite [2] and [3].

As a particular example, we look at the protein trypsin with its aminomethylcyclohexane (AMC) ligand, as taken from the PDB entry 1TNG.

  1. Separate the original pdb file into two pdb files, one for the protein and one for the small molecule.
  2. protein.pdb
  3. Open the ligand_raw.pdb file in UCSF chimera. Choose Tools > Structure Editing > addH. Save as .mol2 file
  4. ligand.mol2
    For alternative methods to get a .mol2 file for your ligand, see the useful links section in the SwissParam webpage

  5. Go to SwissParam and submit the ligand.mol2 file. You will get the output in the results page. Uncompress the archive :
  6. > tar -xf results.tar.gz
    For this tutorial using GROMACS, you will only need the pdb file (with hydrogens) and the .itp file with the GROMACS topology of the ligand :
  7. Generate a GROMACS topology for the protein without the ligand. This particular system includes a calcium ion. It has to be renamed in the pdb file to match the CHARMM terminology. In the protein.pdb file, change the calcium atom name and the residue name to CAL :
  8. HETATM 2013 CAL CAL A 901 37.738 24.784 36.891 1.00 18.31 CA
    Then run the pdb2gmx program from the GROMACS suite:
    > gmx pdb2gmx -f protein.pdb -ff charmm27 -water tip3p -ignh -o conf.pdb -nochargegrp
  9. Modify the file generated by pdb2gmx. In the "Include chain topologies" section, add the following statement, before all other lines referring to the protein or ions :
  10. > #include "ligand.itp"
    This statement has to be at this precise position in the file because it contains [atomtypes] and [pairtypes] sections which have to appear in the topology before any [moleculetype] section. Then, in the [molecules] section, right after lines indicating the number of protein and ion molecules, add the following line :
    > ligand 1
    If there are crystal water molecules in the structure, there will be a line indicating the number of solvent molecules (SOL) in the topology. In this case, the line above should be inserted before any SOL lines. See below for an example file.

  11. Merge the protein and ligand coordinates. Insert the ATOM lines from the ligand.pdb into the conf.pdb file, right after the line for the ion CAL. Atoms will be automatically renumbered in the next step.

  12. Now we are back to the usual GROMACS setup procedure.
  13. > gmx editconf -f conf.pdb -o boxed.gro -c -d 1.2 -bt octahedron
    > gmx solvate -cs -cp boxed.gro -o solvated.gro -p
    If you have an appropriate input file em.mdp for an energy minimization in GROMACS, you can then run
    > gmx grompp -f em.mdp -c solvated.gro -p
  14. It is possible to include position restraints on the ligand by using the POSRES_LIGAND flag. In the case where both protein and ligand atoms should be restrained, the corresponding line in the em.mdp file would read :
  15. > define = -DPOSRES -DPOSRES_LIGAND


  • To verify that your solvated molecule looks good in its octahedric box, you have to remember that gromacs always works internally with an equivalent triclinic unit cell. To see the octahedron, you will have to transform your coordinates (after having run grompp), using :
  • > gmx trjconv -s topol.tpr -f solvated.gro -o compact.gro -ur compact -pbc mol
  • It can happen that there is more that one small molecule in your system. Due to the fact that all [atomtypes] and [pairtypes] sections have to come before any [moleculetype] section, it is not possible to sequentially include two or more .itp files created by SwissParam. Instead, you will have to manually merge the contents of those itp files, such that the right order of sections is maintained.

Example file

; Include forcefield parameters
#include "charmm27.ff/forcefield.itp"

; Include chain topologies
#include "ligand.itp"
#include "topol_Protein_chain_A.itp"
#include "topol_Ion_chain_A2.itp"

; Include water topology
#include "charmm27.ff/tip3p.itp"

; Position restraint for each water oxygen
[ position_restraints ]
; i funct fcx fcy fcz
1 1 1000 1000 1000

; Include topology for ions
#include "charmm27.ff/ions.itp"

[ system ]
; Name
TRYPSIN in water

[ molecules ]
; Compound #mols
Protein_chain_A 1
Ion_chain_A2 1
ligand 1
SOL 163
SOL 11430


  1. Bugnon M, Goullieux M, Röhrig UF, Perez MAS, Daina A, Michielin O, Zoete V. SwissParam 2023: a modern web-based tool for efficient small molecule parameterization. J. Chem. Inf. Model., 2023
  2. Zoete V, Cuendet MA, Grosdidier A, Michielin O. SwissParam: a fast force field generation tool for small organic molecules. J. Comput. Chem., 2011, 32(11), 2359-68.
  3. P. Bjelkmar, P. Larsson, M. A. Cuendet, B. Hess, E. Lindahl, Implementation of the CHARMM Force Field in GROMACS: Analysis of Protein Stability Effects from Correction Maps, Virtual Interaction Sites, and Water Models, J. Chem. Theory Comput., 2010, 6(2), 459-466.