Our blog

Follow us on other social networks.

GROMACS Tips and Tricks: How to Extend and Continue a Molecular Dynamics Simulation

Molecular dynamics simulations are an essential tool for studying the behavior of biological systems. However, these simulations can take a long time to run, and it can be frustrating when they don’t complete successfully.

 Fortunately, GROMACS provides a way to extend and continue unfinished simulations using checkpoint files.

To extend a GROMACS simulation, you can use the checkpoint file saved at the end of the simulation to restart or extend the simulation with the same parameters and number of processors 1. Here are the steps to extend the simulation:

Use the gmx convert-tpr tool to extend the simulation. For example, to extend the simulation by 10000 steps, run the following command:

gmx convert-tpr -s previous.tpr -extend 10000 -o next.tpr

Start the simulation using the new .tpr file and the checkpoint file ( .cpt ) from the previous simulation. For example, run the following command:

gmx mdrun -s next.tpr -cpi state.cpt

Please note that you must start the job with the same hardware resources (CPUs or GPUs) as the original job.

 If you want to change the parameters or the number of CPUs, you can start a new simulation from the output .gro file, but this will not strictly continue the previous simulation because the velocity information is saved in the .cpt file but not in the .gro file.

If for some reason your simulation stopped, and you want to restore it, don’t worry. By default, GROMACS writes a checkpoint file of your system in the cpt format ( md.cpt) every 15 minutes. It also automatically backs up the previous checkpoint as md_prev.cpt. The checkpoint files contain a complete description of the system storing the coordinates and velocities of the system at full precision. Therefore, you can always continue the simulation from the last checkpoint exactly as if the interruption never occurred. To do that, you only need to pass it to the gmx mdrun with the -cpi flag. Here is an example:

gmx mdrun -v -deffnm md -cpi md.cpt (-cpt 5)

The -v makes the command verbose. It is useful to make clearer what the program is actually doing while running. The -deffnm option is followed by the prefix of the tpr file we are using. This will generate files having the same prefix. We will continue the simulation from the md.cpt provided via the -cpi flag. Optional You can change the frequency of the checkpoint output. -cpt 5 will write a checkpoint file every 5 minutes. Just in case. The simulation will proceed from the checkpoint you selected until the end. The total simulation time will be the one you specified in the original mdp file you used to create the tpr file. Note that if you restart different simulations from the same checkpoint you will find that the continuations will diverge from each other. This is due to the limited precision of computers at our disposal. In principle, you should be able to exactly reproduce the same results with an optimal computer having unlimited precision. Despite this, different trajectories are all equally valid and none of them is better than the others. So don’t worry about this.

Pars Silico Molecular Dynamics Simulation Services

Experience the power of simulation with our molecular dynamics services at molecular dynamics simulation services at Pars Silico Bioinformatics Laboratory. Our advanced computational techniques allow you to observe and analyze molecular interactions in unprecedented detail.

Tags: GROMACS, Molecular dynamics

NAMD GROMACS Molecular dynamics

A Comprehensive Comparison of GROMACS and NAMD for Biomolecular Simulations

Have you ever wondered how scientists and researchers are able to uncover the mysteries of...

Read more

Rational Drug Design CADD

Understanding the Step-by-Step Process of Rational Drug Design

Rational drug design, an integral component of the drug discovery process, has catalyzed major...

Read more

LLMs chatgpt Drug design

The Future of Pharmaceuticals: Large Language Models in Drug Design

The pharmaceutical industry stands on the brink of a paradigm shift, with the introduction...

Read more