Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views21 pages

Final MD Tutorial

This GROMACS tutorial details the author's personal journey in learning Molecular Dynamics simulation and aims to assist beginners with a comprehensive guide. It covers the installation of GROMACS on Windows and Linux, preparation of ligands, generation of topology files, system creation, energy minimization, and equilibration steps. The document provides practical commands and tips for troubleshooting common issues encountered during the simulation process.

Uploaded by

learnwithlogan19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views21 pages

Final MD Tutorial

This GROMACS tutorial details the author's personal journey in learning Molecular Dynamics simulation and aims to assist beginners with a comprehensive guide. It covers the installation of GROMACS on Windows and Linux, preparation of ligands, generation of topology files, system creation, energy minimization, and equilibration steps. The document provides practical commands and tips for troubleshooting common issues encountered during the simulation process.

Uploaded by

learnwithlogan19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

GROMACS Tutorial

My journey

When I first began learning Molecular Dynamics (MD) simulation, I had no idea
where to start. I was fascinated by the idea of simulating molecules and proteins in motion
—but getting there wasn’t easy.

I taught myself GROMACS from scratch. It took me a lot of time, patience, and trial-and-
error. Honestly, I faced countless installation issues, confusing errors, and dead ends that
made me want to give up more than once. But slowly, step by step, I figured it out.

That’s exactly why I made this PDF. I wanted to create something that could help others like
me, especially those just starting out. This guide walks you through the installation process,
basic setup, and a simple simulation workflow, in a way that’s clear and practical. It’s the
guide I wish I had when I started. If you’re struggling or stuck at any point, don’t worry—
you’re not alone. And if you need help, feel free to reach out using the contact info I’ve
added at the end of this guide.

Before starting I like to thank DweipayanG (https://github.com/DweipayanG) for creating


the files necessary for simulation and Dr. Manik Ghosh, associate professor at BIT, Mesra,
for making me create this MD tutorial for you.

With out further ado, let’s get started and enjoy the journey!

1) Installation
a) Installing Software
i) If you are using Linux OS, you can directly proceed with the Installation of Gromacs,
but if you want to use GROMACS in Windows, you have to install Ubuntu (Latest
Version) from the Microsoft Store.
GROMACS Tutorial

ii) After installing the latest version, you have to turn on some (following) features on
your Windows.
iii) Open Turn Windows features on or off from the control panel

iv) Then check the box of “Virtual machine Platform” and “Windows Subsystem for
Linux” this will enable you to work with Ubuntu OS

v) Then you need to restart the PC


vi) After Restarting you need to open the installed ubuntu and specify the username
and password
vii) Once you completed the details you can proceed with installation of GROMACS
GROMACS Tutorial

b) Installing GROMACS
i) Before installing GROMACS you have to install the essential modules like GCC,
CMAKE etc., since Ubuntu is freshly installed.
ii) Use the following codes to install the essential files,

sudo apt get update
sudo apt get upgrade
sudo apt get install build-essential cmake git


iii) Once you have installed the essential modules download the latest version of
GROMACS tar file from GROMACS website (https://ftp.gromacs.org/gromacs )
GROMACS Tutorial

iv) After downloading the tar file use command “cd” to change directory to the location
of the downloaded file
Eg. cd /mnt/(path to your folder)

v) Follow the following commands for Dirty Installation


tar -xvzf gromacs-2025.2.tar.gz
cd gromacs-2025.2
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON
make -j$(nproc)
sudo make install
source /usr/local/gromacs/bin/GMXRC

vi) For installation of GROMACS with GPU support you should have good GPU and CUDA
support. If you want to install GROMACS with GPU support, feel free to contact
(https://www.linkedin.com/in/loganathan-kumaravel-380119201/)
GROMACS Tutorial

vii) After Installation type “gmx --version” to know whether it is installed correctly or
not. If it shows as below it indicates we are successfully installed the GROMACS.

NOTE: If you face any error, it may be a simple thing, so don’t get frustrated, ask
ChatGPT for help 😊

c) Download the essential files for simulation


i) https://github.com/DweipayanG/GROMACS-Protein-Ligand/tree/main download all
the files from this GitHUB. (Thanks to https://github.com/DweipayanG )
ii) Place everything on the working directory.
iii) Also download Charmm36ff (https://mackerell.umaryland.edu/download.php?
filename=CHARMM_ff_params_files/charmm36-jul2022.ff.tgz )
iv) Download the PDB editor such as Chimera for editing of structures.

2) SIMULATION
a) Preparation of Ligand
i) Open the best docking pose of the complex in Chimera.
ii) Delete the receptor and add hydrogens to the Ligand and save it alone as “LIG.mol2”
format.
iii) Open the LIG file in notepad, make sure this "@<TRIPOS>MOLECULE" is your first
line.
iv) There will be name of the pdb as xxx.pdb or something, just replace it with LIG
GROMACS Tutorial

v) To avoid the error bond order of the LIG file is ordered by following command in the
ubuntu.

perl sort_mol2_bonds.pl LIG.mol2 LIG.mol2

vi) Next to obtain parameter file for LIG we have to upload it on the SwissParam webite
(Old version) (https://old.swissparam.ch/ )
GROMACS Tutorial

vii) Download the LIG.zip from the website extract all the 6 files (except LIG.mol2) from
the zip file to the working directory.

b) Generation of Topology
i) A topology file in GROMACS (.top) defines the molecular structure, including atoms,
bonds, and force field parameters. It specifies how molecules are built and interact
in the simulation. It is essential for energy calculations and is usually generated from
tools like
ii) pdb2gmx or external ligand topology generators.
GROMACS Tutorial

iii) To create topology, we need protein structure so open the best dock pose in the
chimera and delete the non-standard atoms (water, ions, ligand) only leaving the
receptor alone, do dock prep and save it as REC.pdb
iv) Make sure GROMACS is sourced by using the cmd “gmx --version” if not, source it
using this cmd “source /usr/local/gromacs/bin/GMXRC”
v) Convertion of PDB to GRO will automatically generate topology file for it use
following command

gmx pdb2gmx -f REC.pdb -ignh

vi) What this command will do is, it will convert the pdb format into gmx format with
specified force field and water model.
vii) You have to specify the which force field you want to use, (do literature before
selecting any). I am good with Charmm36ff which we downloaded on initial stage.
1(Charmm36)
viii)Next, we have to select the water model, same as ff you have to do literature survey
to select the water model you want, I am going with TIP3P water model.
1(TIP3P)
ix) Once you selected the ff and water model it will create topology file for the protein.
x) Next, we need to convert the LIG.mol2 into LIG.gro by command below.

gmx editconf -f LIG.pdb -o LIG.gro
GROMACS Tutorial

xi) Open the LIG.gro file in txt editor and copy all the contents from the 3 rd line to the 2nd
last line leaving the last line and paste it in the conf.gro file as shown below
GROMACS Tutorial

xii) Also update number of atoms of conf.gro by addinng the number of atom from
second line of LIG.gro file
eg. sec line of conf is 5721 and sec line of LIG file is 31, you have to change that into
5748+31 that is “3779” and save the file.

xiii)Then add the ligand parameter files to the topology file by following steps
xiv)Open the topology file in your folder, you can see

(Include forcefield parameters


#include "xxxxxxxxxx.itp")

Add following sentence below it

; Include ligand topology


#include "LIG.itp"

GROMACS Tutorial

xv) Next at the bottom of the topology file you will find

(Protein_chain_A 1)

Add the following below to it,

LIG 1

xvi)Until now we made a topology file for the complex, next we can proceed with
simulations.

c) SYSTEM CREATION
i) Now we are going to create a system for simulation

gmx editconf -f conf.gro -d 1.0 -bt triclinic -o box.gro

This command creates a triclinic simulation box around the molecule in conf.gro, leaving
1.0 nm space between the molecule and the box edges. The output box.gro contains the
structure centered in the box, ready for solvation.

ii) Next, we have to add the solvents



gmx solvate -cp box.gro -cs spc216.gro -p topol.top -o box_sol.gro

GROMACS Tutorial

This command fills the simulation box (box.gro) with water molecules using the
spc216.gro water model. It updates the topology file (topol.top) with the number of
water molecules added and saves the solvated system as box_sol.gro

iii) Next, we need to add ions to mimic the real environment. Make sure that IONS.mdp
is in your working directory.

gmx grompp -f ions.mdp -c box_sol.gro -maxwarn 2 -p topol.top -o ION.tpr

This command generates a binary input file (ION.tpr) needed for the ion addition step. It
uses the molecular dynamics parameters from ions.mdp, the solvated structure
box_sol.gro, and the topology file topol.top. The -maxwarn 2 option allows the process
to continue even if there are up to two warnings.

gmx genion -s ION.tpr -p topol.top -conc 0.1 -neutral -o box_sol_ion.gro

This command adds ions to the system. It uses the input file ION.tpr and adds enough
ions to neutralize the system (-neutral) and reach a salt concentration of 0.1 mol/L (-
conc 0.1). The updated structure with ions is saved as box_sol_ion.gro, and the topology
file topol.top is updated accordingly.

Then you need to select where you have to place the NA and CL ions, mostly it would be
solvent molecule since that’s how our biological system looks.
GROMACS Tutorial

Select 15

d) Energy Minimization
i) Energy Minimization is done to remove any bad contacts, steric clashes, or
unrealistic geometries that may have formed during the setup (like adding water or
ions). These could cause instability or errors when starting the simulation. EM gently
relaxes the system into a low-energy state, making it physically reasonable and
stable for further steps like equilibration and production runs.

gmx grompp -f EM.mdp -c box_sol_ion.gro -maxwarn 2 -p topol.top -o EM.tpr

ii) This command prepares the input file EM.tpr for the energy minimization step. It
uses the parameter file EM.mdp, the ionized structure box_sol_ion.gro, and the
topology topol.top. The -maxwarn 2 option allows the process to continue even if
there are up to two warnings.

gmx mdrun -v -deffnm EM

iii) This command runs the energy minimization simulation using the input files
generated earlier. The -v option enables verbose output (shows progress), -deffnm
EM tells GROMACS to use EM.tpr and name all output files with the prefix EM
GROMACS Tutorial

iv) You will get a output as energies.

e) Equilibration
i) NVT or NPT equilibration, we want the solvent (water and ions) to relax around the
solute (protein or complex) without letting the solute move too much.
ii) The position restraint prevents large, unnatural movements by applying a gentle
force that keeps atoms near their starting positions.
iii) Since we added Ligand after topology generation, we need to make position restraint
file for Ligand and we need to update topology manually. As a first step we have to
make index file file for the Ligand.

gmx make_ndx -f LIG.gro -o index_LIG.ndx

This command is utilized to generate a personalized index file. It processes the
structure file LIG.gro and enables you to interactively specify certain atom or
molecule groups (such as the ligand). The outcome is stored as index_LIG.ndx, which
can later be utilized for analysis or imposing restraints.
GROMACS Tutorial
GROMACS Tutorial

Select
> 0 & ! a H*
and quit by typing q
iv) We have made separate index for Ligand now we need to generate the porse itp file
for it

gmx genrestr -f LIG.gro -n index_LIG.ndx -o posre_LIG.itp -fc 1000 1000 1000

> select group "3"



The above command will generate a pos restraint file for ligand.

v) Now update the topology file as follows

after

; Include Position restraint file
#ifdef POSRES
#include "posre.itp"

add this

; Ligand position restraints
#ifdef POSRES
#include "posre_LIG.itp"
#endif

vi) Next Make index file for the system


gmx make_ndx -f EM.gro -o index.ndx

> 1 | 13
>q

GROMACS Tutorial

vii) Then run the NVT equilibration, make sure you make the necessary changes in the
NVT.mdp file (I am going for 100ps with 50000 steps)

gmx grompp -f NVT.mdp -c EM.gro -r EM.gro -p topol.top -n index.ndx -maxwarn 2 -o NVT.tpr

The above command prepares the input file NVT.tpr for the constant volume (NVT)
equilibration step. It uses final file of previous step (EM.gro)

gmx mdrun -v -deffnm NVT

This command runs the NVT equilibration using the input file NVT.tpr. The -v option
shows progress during the run, and -deffnm NVT sets the prefix for all output files
(e.g., NVT.edr, NVT.trr, NVT.gro).

viii)Do the same for NPT equilibration.



gmx grompp -f NPT.mdp -c NVT.gro -r NVT.gro -p topol.top -n index.ndx maxwarn 2 -o
NPT.tpr

The above command is for generating NPT.tpr
GROMACS Tutorial


gmx mdrun -v -deffnm NPT

This command runs the NPT equilibration using the input file NPT.tpr, and saves the
results file in the name of NPT

ix) Once you completed the NPT and Equilibration it’s time for the OG simulation of the
system.

f) Molecular Dynamic simulations


i) Make sure you have the MD.mdp in your directory, edit it accordingly. Change the
steps and timeframes as per your need eg. 50000000 step is equal to 100ns

gmx grompp -f MD.mdp -c NPT.gro -t NPT.cpt -p topol.top -n index.ndx -maxwarn 2 -o MD.tpr

This command prepares the input file MD.tpr for the final production molecular
dynamics run.

gmx mdrun -deffnm MD

ii) Now you take rest for a while, talk to your friends, connect with nature, even go for
holiday trip if you have money. Because it will talk more time to complete.

3) RESULTS ANALYSIS
a) Converstion of MD.xtc to MD_Center.xtc
i) Before making output for the RMSD, RMSF and any other we have to convert the
trajectory of protein to be in the center for visualization.

gmx trjconv -s MD.tpr -f MD.xtc -o MD_center.xtc -center -pbc mol -ur compact

This command changes the trajectory into compact one in which protein will be in the
center for better visualization and video making. On next step, choose protein for center
and system for output.

ii) After converting the trajectory extract the initial pose by following command


GROMACS Tutorial

gmx trjconv -s MD.tpr -f MD_center.xtc -o start.pdb -dump 0



iii) Once you have saved the start.pdb in VMD or PyMol and then add the
MD_center.xtc file into it. By this you will get a video of your MD simulations.

b) RMSD Calculation
i) To get the rmsd use the followinf command

gmx rms -s MD.tpr -f MD_center.xtc -o rmsd.xvg -tu ns

This GROMACS command calculates the RMSD of atomic positions over time using
the centered trajectory (MD_center.xtc) and the reference structure from MD.tpr.
The result is saved in rmsd.xvg, with time expressed in nanoseconds (-tu ns).

ii) Select the molecule of interest for example if you want rmsd of the protein, select
backbone for LSF and select protein for the next group. If you want ligand rmsd with
respect to protein, select protein backbone and ligand.

c) RMSF calculation
i) RMSF stands for Root Mean Square Fluctuation. It measures how much each atom
or residue in a molecule (usually a protein) fluctuates around its average position
during a molecular dynamics (MD) simulation.

gmx rmsf -s MD.tpr -f MD_center.xtc -o rmsf.xvg -res

This command generates the rmsf.xvg file of the simulation which has fluctuations of
the protein in residue level

ii) Select Protein or C-alpha for RMSF calculation

d) SASA and RoG analysis


i) SASA quantifies the molecular surface area available to the solvent, reflecting folding
and exposure to the solvent. RoG (Radius of Gyration) indicates the density of a
molecule, where smaller values suggest a more compact configuration. Both are
utilized to evaluate structural stability and conformational alterations during
simulations.

gmx gyrate -s MD.tpr -f MD_center.xtc -o gyrate1.xvg -tu ns #for RoG

gmx SASA -s MD.tpr -f MD_center.xtc -o gyrate1.xvg -tu ns #for SASA



GROMACS Tutorial

ii) Usually, Protein’s RoG and SASA will be analyzed most of the time so select the
protein group respectively.

e) H-Bond analysis

i) Analysis of H-bonds (Hydrogen bonds) in molecular dynamics aids in identifying and


monitoring hydrogen bonds between atoms over time, such as those found within a
protein or between a protein and a ligand. These bonds are essential for the stability,
specificity, and function of molecules.

gmx hbond -s MD.tpr -f MD_center.xtc -num hb.xvg -tu ns

ii) Select the protein and ligand groups for H-Bond

4) Plotting the graph

i) For plotting the graph, you can use many software or R, however I use Grace which is
a free and easy to use software.
ii) Use the following command to install XMGrace

sudo apt update
sudo apt install xmgrace -y

iii) Once you have installed the XmGrace, use the following command to get the results
in a graph.

xmgrace (name of the xvg file).xvg

eg. If your file name is rmsd.xvg for protein and li_rmsd.xvg for ligand you can use
following command to open it in a single plot.

xmgrace rmsd.xvg li_rmsd.xvg

GROMACS Tutorial

Hope you guys understand how to do MD simulation in GROMACS and I hope you will do
good use of it.

“If you want to shine like a sun, first burn like a sun”
-APJ Adbul Kalam

References

1. DweipayanG. (2023). GROMACS-Protein-Ligand (Version main) [Source code]. GitHub.


https://github.com/DweipayanG/GROMACS-Protein-Ligand
2. GROMACS Development Team. (2025). GROMACS Installation Guide. GROMACS
Documentation. https://manual.gromacs.org/current/install-guide/index.html
3. BioExcel – Centre of Excellence for Computational Biomolecular Research. (n.d.).
GROMACS community and resources. Retrieved July 29, 2025, from
https://gromacs.bioexcel.eu/

Connect with me

Loganathan Kumaravel

LinkedIn: www.linkedin.com/in/loganathan-kumaravel-380119201

YouTube: https://www.youtube.com/@LearnWithLogan_MD

E-mail: [email protected]

You might also like