This guide walks through the standard GROMACS workflow for a protein–ligand complex. It assumes GROMACS 2021 or later and the CHARMM36 force field, with ligand parameters generated by CGenFF. The commands show the structure of each step; adapt file names, force-field name and group numbers to your system. If you are new to the field, start with what molecular dynamics simulation is.
1. Prepare the protein
Download the structure from the PDB, remove waters and ligands you do not need, and repair missing atoms or loops. Check protonation states (histidine in particular) at your target pH.
gmx pdb2gmx -f protein.pdb -o protein.gro -p topol.top -water tip3p -ff charmm36-jul2022 -ignh
Use the name of the CHARMM36 force-field folder installed with your GROMACS copy.
2. Prepare the ligand
Add hydrogens to the ligand and save it as a .mol2 file with correct bond orders. Submit it to the CGenFF server, or use a tool that wraps it, and convert the output to GROMACS format (lig.itp, lig.prm, lig.gro). Check the penalty scores reported by CGenFF: high penalties on charges or dihedrals mean the parameters need validation.
Include the ligand in the topology after the force-field include, then add it to the molecule list:
#include "charmm36-jul2022.ff/forcefield.itp"
#include "lig.prm" ; ligand parameters, before any [ moleculetype ]
#include "lig.itp"
...
[ molecules ]
Protein_chain_A 1
LIG 1
Merge the coordinates by pasting the ligand atoms into protein.gro and updating the atom count on line 2.
3. Define the box and solvate
gmx editconf -f complex.gro -o box.gro -c -d 1.0 -bt dodecahedron
gmx solvate -cp box.gro -cs spc216.gro -o solv.gro -p topol.top
A distance of at least 1.0 nm between the solute and the box edge is a common minimum. A dodecahedron needs fewer water molecules than a cube for the same separation.
4. Add ions
gmx grompp -f ions.mdp -c solv.gro -p topol.top -o ions.tpr
gmx genion -s ions.tpr -o solv_ions.gro -p topol.top -pname NA -nname CL -neutral -conc 0.15
Choose the solvent group when prompted. This neutralises the system and sets a 0.15 M salt concentration.
5. Create an index file
gmx make_ndx -f solv_ions.gro -o index.ndx
Create a combined group such as Protein_LIG and a Water_and_ions group. They are used for temperature coupling and later analysis.
6. Energy minimisation
gmx grompp -f em.mdp -c solv_ions.gro -p topol.top -o em.tpr
gmx mdrun -deffnm em
Minimisation removes bad contacts. It should converge with a maximum force below the tolerance (commonly 1000 kJ/mol/nm).
7. NVT and NPT equilibration
Equilibrate temperature first, then pressure, holding the heavy atoms of the solute with position restraints so the solvent relaxes around them.
gmx grompp -f nvt.mdp -c em.gro -r em.gro -p topol.top -n index.ndx -o nvt.tpr
gmx mdrun -deffnm nvt
gmx grompp -f npt.mdp -c nvt.gro -r nvt.gro -t nvt.cpt -p topol.top -n index.ndx -o npt.tpr
gmx mdrun -deffnm npt
Typical lengths are 100 ps for NVT and 100 to 1000 ps for NPT. Check that temperature, pressure and density have stabilised before continuing:
gmx energy -f nvt.edr -o temperature.xvg
gmx energy -f npt.edr -o density.xvg
8. Production run
Key md.mdp settings for CHARMM36 are:
integrator = md
dt = 0.002
constraints = h-bonds
cutoff-scheme = Verlet
vdwtype = cutoff
vdw-modifier = force-switch
rvdw-switch = 1.0
rvdw = 1.2
coulombtype = PME
rcoulomb = 1.2
tcoupl = V-rescale
pcoupl = C-rescale
gmx grompp -f md.mdp -c npt.gro -t npt.cpt -p topol.top -n index.ndx -o md.tpr
gmx mdrun -deffnm md
For a 100 ns run at 2 fs, set nsteps = 50000000. Use several replicas with different starting velocities (gen_seed) so you can judge how reproducible the results are.
9. Process the trajectory
Remove periodic-boundary artefacts and fit to the starting structure before analysis:
gmx trjconv -s md.tpr -f md.xtc -o md_noPBC.xtc -pbc mol -center
gmx trjconv -s md.tpr -f md_noPBC.xtc -o md_fit.xtc -fit rot+trans
10. Analyse the results
From md_fit.xtc you can compute:
- RMSD and RMSF, covered in RMSD and RMSF analysis in GROMACS
- Radius of gyration and SASA
- Hydrogen bonds and protein–ligand contacts
- MM-PBSA binding free energy
- PCA and the free-energy landscape
The output is written as .xvg files; see how to read and plot XVG files.
Common problems
- grompp warns about net charge. Add ions with
genion -neutral, and check the ligand charge in the.itpfile. - LINCS warnings or a crash during equilibration. Re-run minimisation, check the ligand topology, and equilibrate with a smaller time step or stronger restraints.
- The ligand leaves the pocket. This may be real, or the starting pose may be poor. Check the docking pose and run replicas before drawing conclusions.