How to continue a simulation when suddenly stopped?

GROMACS version:2019
GROMACS modification: Yes/No
Hi everyone,
I’m running .sh file like below and the simulation is stopped at step 100300. How should I change the command to restore simulation from step 100300 without having to rerun from step 1?

"for ((i=0;i<=1;i=i+1))
do
gmx grompp -f nvt.mdp -r em.gro -c em.gro -p top.top -o nvt_${i}.tpr

gmx mdrun -nt 40 -deffnm nvt_${i} -v	

gmx grompp -f npt.mdp -r nvt_${i}.gro -c nvt_${i}.gro -t nvt_${i}.cpt -p top.top -o npt_${i}.tpr

gmx mdrun -nt 40 -deffnm npt_${i} -v

gmx grompp -f md.mdp -r npt_${i}.gro -c npt_${i}.gro -t npt_${i}.cpt -p top.top -o md_${i}.tpr

gmx mdrun -nt 40 -deffnm md_${i} -v

done"

You can restart from the latest checkpoint if you add -cpt as option, e.g.
gmx mdrun -nt 40 -deffnm md_${i} -v -cpt
Since you are running with the -deffnm option I would suggest that you first check the name of the checkpoint file (called .cpt) and specify that as name to the -cpt option. Because, if the checkpoint file cannot be found it will start over from the beginning. Even if the files from the previous run are copied beforehand your current checkpoint file might get overwritten, it’s nice not complicate things further and possibly have to restart things from the beginning.

If you really want to be on the safe side you could make a copy of your previous files first.

Thanks for you reply

I tried as suggested. When I tried, it still started over from the beginning, although I specify name for -cpt option.

I realize that the cpt file is only created when a command is completed. If the simulation suddenly stops, I can not find cpt file created. Is there any way to write the cpt file for each 1000 steps or solve this problem?

Please suggest.
Regards,
Nhina

I see that I made a typo in my previous instructions. I meant that the -cpi should be used and can also specify the checkpoint file name. I’m sorry about that.

By default a checkpoint file is written every 15 minutes. This can be changed with the cpt option (the option use suggested by mistake in my previous post).

I hope it works better with the correct options.