How to create an index file in GROMACS for MD simulation?

Dr. Muniba Faiza
4 Min Read

MD simulation is a tricky technique if you don’t understand what you are doing through various parameters and algorithms in GROMACS [1]. 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.

While you have to restrain some groups or atoms or residues during simulation, you need an index file. GROMACS has default groups but it may be possible that the group you are working with is not separately mentioned in the index file. Therefore, you have to create one specifying the group protein or residues or atoms to restrain. In such a case, without using this file you may encounter some errors. For example,

“Fatal error:

Group Protein referenced in the .mdp file was not found in the index file.

Group names must match either [moleculetype] names or custom index group

names, in which case you must supply an index file to the ‘-n’ option

of grompp.”

Here, you must create an index file and pass it to the grompp command for the MD run.

Creating an index file

To create an index file, we will use the make_ndx module of GROMACS. Open the terminal (Ctrl+Alt+T) and type the following command:

$ gmx make_ndx –f protein.pdb –o protein.ndx

It will display the default groups. If you can find your group in the displayed list then select it (there are barely minimum chances of that).

Now, to create a new group of atoms (let’s say), type the following command.

$ a PO4

It will add this new group to the list of all default groups.

If you want to add a few residues, then type this:

$ r 45 56 58 78 106 180

For example, previously it was showing 11 default groups, not it will show 12 as shown below.

12 r 45 56 58 78 106 180: 53 atoms

It shows you a default name for this group (i.e., r_45_56_58_78_106_180). You can rename it as ‘residues‘ using the following command:

$ name 12 rest_residues

Now, it will show you all 12 groups on the list. Finally, quit by typing q

Using the index file

Now pass this index file to the grompp command as shown below:

$ gmx grompp -f md.mdp -c npt.gro -t npt.cpt -p topol.top -n protein.ndx -o md_0_1.tpr

This is not necessary that you create this file before this command only. You can create this before nvt or npt simulation also.

If error persists

To this point, your error should be gone. But in some cases, it may reappear, then you have to freeze these residues by adding a few lines in the md.mdp file.

Open the md.mdp file and add the following lines:

energygrps_excl = rest_residues rest_residues rest_residues SOL ! To remove computation of nonbonding interactions between the frozen groups with each other and surroundings (i.e. the solvent, SOL)
freezegrps = rest_residues ! Index group to freeze
freezedim = Y Y Y ! Freeze this group in all directions, x, y, and z

Now use the grompp command as explained above.


References

  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.

Further Reading

Installing Gromacs on Ubuntu for MD Simulation

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

Tutorial: Molecular dynamics (MD) simulation using Gromacs

Tutorial: MD Simulation of a Protein-Ligand Complex using GROMACS

Method-1: Installing GROMACS on Ubuntu with CUDA GPU Support

Tutorial: MD Simulation of small organic molecules using GROMACS

MD Simulation using GROMACS: Things to remember

Share This Article
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
Leave a Comment

Leave a Reply