# Gmx mdrun -rerun to rerun the simulation starting from any time

**URL:** <https://gromacs.bioexcel.eu/t/gmx-mdrun-rerun-to-rerun-the-simulation-starting-from-any-time/8451>\
**Category:** User discussions\
**Created:** [February 28, 2024, 6:01am UTC](https://gromacs.bioexcel.eu/t/gmx-mdrun-rerun-to-rerun-the-simulation-starting-from-any-time/8451 "2024-02-28T06:01:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bjw-noonan](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@bjw-noonan](https://gromacs.bioexcel.eu/u/bjw-noonan)\
**Post date:** [February 28, 2024, 6:01am UTC](https://gromacs.bioexcel.eu/t/gmx-mdrun-rerun-to-rerun-the-simulation-starting-from-any-time/8451/1 "2024-02-28T06:01:00Z")

</div>

GROMACS version: 2023  
GROMACS modification: Yes - Patched with Plumed v2.7

Dear Developers,

I need to do a gmx mdrun -rerun across fixed time increments. So I need to rerun from t=0-500 ns, change some settings in Plumed, and rerun from t=500-750 ns, change settings again, and run from t=750-1200 ns. I am doing this to regenerate the HILLS files.

I have this script, however the simulation does not restart from the checkpoint as no checkpoint was written.  
for i in {00…11}; do cd $i; mpirun -np 204 gmx\_mpi mdrun -v -deffnm meta -o meta-rerun.trr -plumed plumed-rerun.dat -rerun -ntomp 1 -pf meta\_pullf.xvg -px meta\_pullx.xvg -nsteps 125000000 -cpt 0.5 -cpo meta-rerun.cpt; cd …/; done

sed -i ‘s/HEIGHT=4.2/HEIGHT=21/g’ ./??/plumed-rerun.dat  
sed -i ‘s/BIASFACTOR=10/BIASFACTOR=50/g’ ./??/plumed-rerun.dat

for i in {00…11}; do cd $i; mpirun -np 204 gmx\_mpi mdrun -v -deffnm meta -o meta-rerun.trr -plumed plumed-rerun.dat -rerun -ntomp 1 -pf meta\_pullf.xvg -px meta\_pullx.xvg -nsteps 187500000 -cpt 0.5 -cpo meta-rerun.cpt -cpi meta-rerun.cpt; cd …/; done

sed -i ‘s/BIASFACTOR=50/BIASFACTOR=30/g’ ./??/plumed-rerun.dat

for i in {00…11}; do cd $i; mpirun -np 204 gmx\_mpi mdrun -v -deffnm meta -o meta-rerun.trr -plumed plumed-rerun.dat -rerun -ntomp 1 -pf meta\_pullf.xvg -px meta\_pullx.xvg -nsteps 300000000 -cpt 0.5 -cpo meta-rerun.cpt -cpi meta-rerun.cpt; cd …/; done

I can think of a couple other solutions: (1) I break the trajectory into the chunks I want and do a rerun on those chunks. (2) use the current approach but tell GROMACS to begin at the time I want, and rerun for the number of steps I want.

I do not think (2) is possible.  
If I do (1) will this append to the HILLS file correctly? Or will the HILLS file be re-written?

Kind Regards,  
Billy

---

<div class="post-metadata">

**Author:** ![bjw-noonan](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@bjw-noonan](https://gromacs.bioexcel.eu/u/bjw-noonan)\
**Post date:** [February 28, 2024, 6:25am UTC](https://gromacs.bioexcel.eu/t/gmx-mdrun-rerun-to-rerun-the-simulation-starting-from-any-time/8451/2 "2024-02-28T06:25:13Z")

</div>

Dear All,

Have fixed my problem. Option 1 works with RESTART on the first line of the Plumed file.

Kind Regards,  
Billy
