Managing long simulations

GROMACS version:2020.3

Hello
I’m trying to run 500ns simulation but willing to split the trajectory into 10 continuous simulations (50ns for each one).
in order to do that for each simulation I’ve created a tpr file using the same md.mdp file by looping on

for ((i = 1 ; i <= 10 ; i++)); do

gmx grompp -f md.mdp -c md.tpr -o md_{i}.tpr -t md_{i}.cpt -p topol.top

then running the simulation by

gmx mdrun -s md_{i}.tpr -o md_{i}.trr -cpo md_$((i+1)).cpt

are the trajectories that I got continuing each other? is it the right way to split a simulation?

Best regards,
Gil

Maybe it would be easier to first run your single, regular job for 500 ns, and then use the -b/-e options of gmx trjcat to concatenate the trajectories in 50 ns blocks?

Your version would be a bit harder to restart correctly since the script starts from 1 each time it is evoked. You’d have to check the latest one and restart the loop from the correct iteration.

Best,
Miłosz

Thank you for your reply Miłosz!
I would like to created them separately so I’ll be able to restart the simulation from any point if necessary

regards,
Gil

Your loop just runs multiple simulations from the same starting point. If you want to do intervals of 50 ns, then:

  1. Use grompp and mdrun to run a 50-ns MD simulation.
  2. Use convert-tpr to increase the number of steps in the first .tpr file and use mdrun -cpi to start from the previous .cpt file.
  3. Repeat step 2 as needed

If the only thing you need is intermediate checkpoints, consider adding -cpnum to your mdrun command - this will keep numbered .cpt files instead of overwriting them. You can specify the interval between saving consecutive .cpts with -cpt (default is 15 minutes).

Alternatively, if you want the velocities at exact timesteps but don’t care about exact continuation of thermostats/barostats, set nstvout and nstxout to e.g. 500000 in your .mdp, and every 1 ns your coordinates/velocities will be saved to the .trr file. From there, you can read the velocities & positions using grompp.

Otherwise, go for Justin’s solution which should work the way you originally intended.