Connect with us

MD Simulation

How to generate topology of small molecules & ligands for MD Simulation?



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.

We are going to generate topologies of small molecules for their MD simulation and for the ligands that are present in complexes that are further subjected to MD simulation.

A) For small-molecule MD simulation

1. Obtaining the molecule

If your molecule is available in Pubchem, then download the 3D structure in .sdf format. Otherwise, you will have to draw one. For that, you can use software such as ChemDraw, Marvinsketch, etc.

1.1. Downloading structure from Pubchem

  1. Go to Pubchem.
  2. Search for a molecule/compound of your interest.
  3. Click on the ‘Download‘ button.
  4. Download the 3D conformer in SDF format.

We need the structure in the PDB format. For this purpose, use Pymol as shown below.

  1. Go to File --> Open. Select the molecule downloaded in SDF format.
  2. Go to Export Molecule --> PDB Options --> Write CONECT records for all bonds. You can deselect the next checkbox (i.e., ‘Write segment identifier (segi) column‘).
  3. Click Save. Select PDB from file type dropdown.

Now you have generated the PDB file of your molecule successfully.

1.2. Drawing the structure

To draw a molecular structure, you can use Pymol, Avogadro, Chemdraw, and so on. In this tutorial, we will be using Pymol [1]. Follow this tutorial for building molecules in Pymol. Don’t forget to export your molecule in PDB format.

2. Preparing the molecule

Now that we have our molecule in PDB, we can easily convert this molecule in mol2 format. For this purpose, we will use Avogadro [2, 3].

Note: Since this tutorial is based on the generation of topology using CGenFF, therefore, the force field required for MD simulation will be CHARMM. If you are going to use any other force field, then you will have to use another webserver for topology generation. To know about these webservers, read this article.

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

2.1. Correcting mol2 file

Now, before generating the topology of this molecule, we need to correct this mol2 file.

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

  1. Replace “*****” with molecule name (it can be any short name of the molecule). The detailed figures are shown in previous article.
  2. Make sure the residue name and numbers are the same.
  3. Look into the @<TRIPOS>BOND section. Now correct the bond order using a Perl script available here.
  4. Run the Perl script as $ perl molecule.mol2 molecule_clean.mol2

This file (molecule_clean.mol2) can finally be used to generate topology.

3. Generating topology of small molecule

Register and create a free account on the CGenFF server [4]. After uploading and submitting your clean file, it will give an output .str file (in this case, molecule_clean.str). Download this file.

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

$ python <molecule_name> molecule_clean.mol2 molecule_clean.str charmm36-jul2020.ff

You will find two new files in your working directory: molecule.itp molecule.prm.

B) For a complex simulation

1. Extracting the ligand

Let’s suppose our protein filename is protein.pdb. Open a terminal (Ctrl+Alt+T) and type the following command:

$ grep ligand_name protein.pdb > ligand.pdb

Now, remove all ligand’s name lines from the protein.pdb file.

2. Preparing the ligand file

Now you will need this ligand.pdb file in mol2 format. For that, you can follow the same steps as shown above for small molecules under the section of ‘Preparing the molecule‘ (section 2.).

2.1. Correcting the ligand file

To correct the ligand file, you can follow the same procedure as shown above in section 2.1. After you have successfully, corrected your ligand file (ligand_clean.mol2), you can proceed to topology generation of the ligand.

3. Generating the topology of ligand

Upload your corrected mol2 file on the CGenFF server and wait for the resultant file (ligand_clean.str). Further, correct your .str file using the following command:

$ python ligand_name ligand_clean.mol2 ligand_clean.str charmm36-jul2020.ff

Now, you have successfully generated the topology of your ligand. For further steps on MD simulation of a protein-ligand complex, read this tutorial.


  1. The PyMOL Molecular Graphics System, Version 1.2r3pre, Schrödinger, LLC.
  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.

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