# Extending simulation

**URL:** <https://gromacs.bioexcel.eu/t/extending-simulation/5736>\
**Category:** User discussions\
**Created:** [February 6, 2023, 6:21pm UTC](https://gromacs.bioexcel.eu/t/extending-simulation/5736 "2023-02-06T18:21:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blablablablablablab](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@blablablablablablab](https://gromacs.bioexcel.eu/u/blablablablablablab)\
**Post date:** [February 6, 2023, 6:21pm UTC](https://gromacs.bioexcel.eu/t/extending-simulation/5736/1 "2023-02-06T18:21:12Z")

</div>

GROMACS version: .tpr with 2020.4 , setup with older version.  
GROMACS modification: Yes  
Here post your question : I am doing a 900ns simulation , max time allowed in my server is 2 days ; so I am dividing it up into 20ns simulations . Is there an easier way to start the next 20 nano second simulation without having to rename the mdp names ? for the next 20 ns simulation do I use the previous .cpt file as an input for mdrun -deffnm ?

---

<div class="post-metadata">

**Author:** ![pjohansson](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/pjohansson/32/316_2.png) [@pjohansson](https://gromacs.bioexcel.eu/u/pjohansson)\
**Post date:** [February 6, 2023, 9:53pm UTC](https://gromacs.bioexcel.eu/t/extending-simulation/5736/2 "2023-02-06T21:53:59Z")

</div>

Hi,

You can continue a simulation from its last checkpoint with the `mdrun` flag `-cpi`. You should then also ensure that Gromacs stops before the alloted time with `-maxh 48` (to stop it before 48 hours have passed). With this you won’t have to manually split the simulation into smaller parts, just let Gromacs do that work for you.\*

So, simply change your run command to `gmx mdrun -cpi -maxh 48` (plus any other flags).

Petter

* * *

\* If you absolutely **do** want to split the simulation into 20 ns steps by yourself you can use the final saved checkpoint as input for your new simulation when running `grompp`, use the `-t` flag to select the `.cpt` file from your previous step (by default this is `state.cpt`). But unless you really want to do this I’d say it’s much worse than just extending the simulation with `-cpi`: it’s much easier to make a mistake when running `grompp`, and you need to keep track of all simulation files by yourself and manually stitch trajectories and energy files.

---

<div class="post-metadata">

**Author:** ![kyrstyno](https://avatars.discourse-cdn.com/v4/letter/k/d07c76/32.png) [@kyrstyno](https://gromacs.bioexcel.eu/u/kyrstyno)\
**Post date:** [June 21, 2023, 6:37pm UTC](https://gromacs.bioexcel.eu/t/extending-simulation/5736/3 "2023-06-21T18:37:10Z")

</div>

If one does split the simulation into 20 ns steps and use grompp -t \*.cpt file from the previous step, is the trajectory somehow inaccurate?

In the GROMACS 2022 documentation under gmx grompp, it is stated that " `gmx grompp` can be used to restart simulations (preserving continuity) by supplying just a checkpoint file with `-t`. However, for simply changing the number of run steps to extend a run, using [gmx convert-tpr](https://manual.gromacs.org/2022/onlinehelp/gmx-convert-tpr.html) is more convenient than `gmx grompp`. You then supply the old checkpoint file directly to [gmx mdrun](https://manual.gromacs.org/2022/onlinehelp/gmx-mdrun.html) with `-cpi`. If you wish to change the ensemble or things like output frequency, then supplying the checkpoint file to `gmx grompp` with `-t` along with a new [.mdp](https://manual.gromacs.org/2022/reference-manual/file-formats.html#mdp) file with `-f` is the recommended procedure. Actually preserving the ensemble (if possible) still requires passing the checkpoint file to [gmx mdrun](https://manual.gromacs.org/2022/onlinehelp/gmx-mdrun.html) `-cpi`."

Why does preserving the ensemble require passing the checkpoint file to gmx mdrun? I am just wondering why wanting to change something like output frequency would mean that it is necessary to sacrifice the correctness of the ensemble. Would it still be suitable for equilibrating a system to break a simulation down into 20 ns simulations with gmx grompp -t new mdp file without passing -cpi to gmx mdrun?
