GROMACS  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 http://mackerell.umaryland.edu/download.php?filename=CHARMM_ff_params_files/charmm36-jul2020.ff.tgz
$ 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:
- Open Avogadro
Open --> asc.pdb
- Go to
Build --> Add Hydrogens
- Go to
File --> Save as --> SYBYL mol2
- 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:
- Replace “*****” with asc as shown below (after step-4).
- Make sure the residue name and numbers are the same.
- Look into the @<TRIPOS>BOND section. We need to correct the bond order using a Perl script available here.
- Run the Perl script as
$ perl sort_mol2_bonds.pl 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 .
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 “cgenff_charmm2gmx.py” 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 cgenff_charmm2gmx.py 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 asc.top
The added water molecules will reflect in the topology file (asc.top).
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 asc.top
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 .
$ gmx grompp -f md.mdp -c asc_solv.gro -p asc.top -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
This ends the simulation of small organic molecules using GROMACS. Wait for the job to finish and analyze the results.
- 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. SoftwareX, 1, 19-25.
- Avogadro: an open-source molecular builder and visualization tool. Version 1.XX. http://avogadro.cc/
- 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.
- 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 chemistry, 31(4), 671-690.
- Muniba Faiza (2019). Tutorial: Molecular dynamics (MD) simulation using Gromacs. Bioinformatics Review, 5 (12). (https://bioinformaticsreview.com/20191210/tutorial-molecular-dynamics-md-simulation-using-gromacs/?v=c86ee0d9d7ed)
Easy installation of GROMACS on Ubuntu 18.04 & 20.04
We have provided several articles on GROMACS  installation on Ubuntu including the easy installation method for GROMACS version 5.x.x. In this article, we will provide shell scripts to install the latest (2021 series) of GROMACS on Ubuntu 18.04 and 20.04. (more…)
How to create an index file in GROMACS for MD simulation?
MD simulation is a tricky technique if you don’t understand what you are doing through various parameters and algorithms in GROMACS . That may lead to several errors. In this article, we are going to create an index file for the protein groups in GROMACS to solve such errors. (more…)
How to generate topology of small molecules & ligands for MD Simulation?
Generating the topology of small molecules/ligands is an important step in molecular dynamics (MD) Simulation. We explained it in previous articles as part of MD simulation tutorials. In this article, we will explain how can you generate the topology of ligands for MD simulation of complex or small molecules only. (more…)