Connect with us

MD Simulation

Tutorial: MD Simulation of small organic molecules using GROMACS



MD Simulation of small molecules

GROMACS [1] offers a vast range of functions when it comes to molecular dynamics simulation. Today, we are going to explore it for the simulation of small organic molecules.

In this tutorial, we are going to simulate ascorbic acid using GROMACS. We need to generate a topology for the molecule, then the resultant files will be used for simulation. It requires a bit of modification of the files as explained in the following sections.

1. Obtaining the molecule structure

You can either draw your molecule using different software such as Marvin Sketch or download it from Pubchem if available. We need the structure in mol2 format for topology generation. So, export your molecule in PDB and mol2 format. If you have a PDB file, then you can use Pymol for file conversion. But be careful while you are drawing your structure yourself. Because it may lead to several errors such as ‘UNKNOWN BOND_ATOMTYPE’, etc., during the simulation process.

2. Preparing force field

You can select an appropriate force field according to your molecule. We are going to use the CHARMM36 force field.

$ wget 

$ tar xvzf charmm36-jul2020.ff.tgz

You will see a subdirectory “charmm36-jul2020.ff” created in your working directory.

3. Preparing the molecule

I have downloaded the molecule from Pubchem in SDF format and then converted it into mol2 format using Avogadro [2, 3] as shown below:

  1. Open Avogadro
  2. Open --> asc.pdb
  3. Go to Build --> Add Hydrogens
  4. Go to File --> Save as --> SYBYL mol2
  5. Save it as asc.mol2.

The asc.mol2 file needs to be corrected before subjecting to topology generation.

Open the asc.mol2 file in an editor and do the following:

  1. Replace “*****” with asc as shown below (after step-4).
  2. Make sure the residue name and numbers are the same.
  3. Look into the @<TRIPOS>BOND section. We need to correct the bond order using a Perl script available here.
  4. Run the Perl script as $ perl asc.mol2 asc_clean.mol2

For more details on this, read our previous article Tutorial: MD Simulation of a Protein-Ligand Complex using GROMACS. Read the topology generation of the ligand section.

Now, this cleaned file (asc_clean.mol2) will be used for topology generation.

4. Generating topology of the molecule

There are different programs available to generate the topology of molecules according to the force field you choose. For more details, read the above-mentioned article.

Since we are using the CHARMM force field, therefore, we will use the CGenff web server [4].

Register and create a free account on the CGenFF server. After uploading and submitting the asc_clean.mol2 file, it will give the asc_clean.str file as output. Download the file.

Now, since the asc topology is in CHARMM format, we need to convert in gmx to use in GROMACS for simulation. For that, download the “” script from here and run it as shown below. If you have python3 on your system, then use another script. Download it from here. Remember it also requires another package called NetworkX.

$ python asc asc_clean.mol2 asc_clean.str charmm36-jul2020.ff

If there is no error, it will display a message as shown below:

============ DONE ============
Conversion complete.
The molecule topology has been written to asc.itp
Additional parameters needed by the molecule are written to asc.prm, which needs to be included in the system .top
============ DONE ============

The topology and parameters of the molecule are written to asc.itp and asc.prm.

5. Defining box

We need our mol2 file in PDB format for the following command. Therefore, convert asc_clean.mol2 file into asc_clean.pdb. Now, we need to define a box around our molecule.

$ gmx editconf -f asc_clean.pdb -o asc.gro -box 3 3 3

6. Solvating the molecule

You may want to solvate your molecule in mixed solvents. Read this article for mixed solvents. Follow Step 4. in that tutorial for solvating using mixed solvents.

In this tutorial, we are using water only.

$ gmx solvate -cp asc.gro -cs spc216.gro -o asc_solv.gro -p

The added water molecules will reflect in the topology file (

7. Energy Minimization

For this, an input parameter file is required, that can be downloaded from here. You might have to adjust some parameters in this file according to your simulating conditions.

$ gmx grompp -f em.mdp -c asc_solv.gro -p

Now, run the energy minimization using mdrun.

$ gmx mdrun -v

It will be finished in a few steps depending upon the number of steps provided. In order to know, whether the energy minimization was run successfully, the potential energy must be negative and Fmax must be less than 1000 KJ/mol/nm which was set as the maximum force in the em.mdp file.

You don’t need to perform NPT and NVT ensembles for small organic molecules. So, we will skip those steps.

8. Running MD Simulation

We will need an input file md.mdp which can be downloaded from here. We will run a 1 ns MD simulation which is just for the purpose of demonstration otherwise, optimally, 30 ns or 50/60 ns MD simulation is done. 30 ns should be enough but if RMSD is not a straight line then increase the duration of the MD run.

For more details regarding the number of steps, look into the previous tutorial [5].

$ gmx grompp -f md.mdp -c asc_solv.gro -p -o md_0_1.tpr

$ gmx mdrun -v

Since MD run takes a long time to finish, therefore, you would like to run for which you can use nohup command as shown below:

$ nohup gmx mdrun -v -deffnm md_0_1

You can check the status by using the command $ jobs or $ top.

This ends the simulation of small organic molecules using GROMACS. Wait for the job to finish and analyze the results.


  1. Abraham, M. J., Murtola, T., Schulz, R., Páll, S., Smith, J. C., Hess, B., & Lindahl, E. (2015). GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers. SoftwareX1, 19-25.
  2. Avogadro: an open-source molecular builder and visualization tool. Version 1.XX.
  3. Marcus D Hanwell, Donald E Curtis, David C Lonie, Tim Vandermeersch, Eva Zurek and Geoffrey R Hutchison; “Avogadro: An advanced semantic chemical editor, visualization, and analysis platform” Journal of Cheminformatics 2012, 4:17.
  4. Vanommeslaeghe, K., Hatcher, E., Acharya, C., Kundu, S., Zhong, S., Shim, J., … & Mackerell Jr, A. D. (2010). CHARMM general force field: A force field for drug‐like molecules compatible with the CHARMM all‐atom additive biological force fields. Journal of computational chemistry31(4), 671-690.
  5. Muniba Faiza (2019). Tutorial: Molecular dynamics (MD) simulation using Gromacs. Bioinformatics Review, 5 (12). (

Dr. Muniba is a Bioinformatician based in New Delhi, India. She has completed her PhD in Bioinformatics from South China University of Technology, Guangzhou, China. She has cutting edge knowledge of bioinformatics tools, algorithms, and drug designing. When she is not reading she is found enjoying with the family. Know more about Muniba

MD Simulation

How to install GROMACS on Apple M1 (MacOS)?



Installing GROMACS on Apple M1 (MacOS)

We have provided a few articles on GROMACS installation on Ubuntu. In this article, we are going to install GROMACS [1] on Mac OS. (more…)

Continue Reading

MD Simulation

How to take snapshots of structure at specific times in GROMACS?



How to take snapshots of structure at specific times in GROMACS?

It is important to see the behavior of protein during an MD simulation. This can be achieved by taking snapshots in the form of PDB format. In this article, we have provided a few commands that you can use to take snapshots of a complete system or protein during MD simulation. (more…)

Continue Reading

MD Simulation

GROMACS: Uses & Applications



GROMACS: Uses & Applications

GROMACS stands for GROningen MAchine for Chemical Simulations [1]. It is a very popular and one of the most widely used open-source bioinformatics software. It is generally used for molecular dynamics simulation of macromolecules. In this article, we will explain its uses and applications in bioinformatics studies. (more…)

Continue Reading