How to extract a proper structure from the trajectory to restart simulation?

GROMACS version: 2019.3
GROMACS modification: No
Here post your question
I was trying to extract a structure of the system from the trajectory to continue an interrupted simulation. Since the simulation was not completed and the .gro file of final state was not generated, there seemed no way to directly continue the simulation with a new .mdp file (I wanted to renew the mdp settings since the initial simulation somehow blowed up at a late stage). Therefore I tried to obtain a .gro file for restart by using the “Save Coordinates” function after having loaded the .xtc file to the system in VMD. However, the .gro file generated was not recognized by GROMACS with the error like this:

But the coordinates in the .gro file seem fine to me despite several zeros in the last line. I tried to have deleted these zeros but still did not avoid this error.

Furthermore, I would also like to ask about the possible reasons for a simulation to blow up at a late stage, for instance, after 40 ns in this situation. I think if there are common problems, for example, in the starting structure or mdp settings, it should have blowed up much earlier.

Many thanks in advance for any advice on this problem.

Your simulation may be blown up due to several reasons that create instability in the simulation. For example, the system may not be well energy minimized and/or equilibrated. Errors in the temperature and/or pressure coupling. Compilation error in the GROMACS installation process or something else.

However, cpt file (named like state.cpt or something *.cpt) is generated and updated during any GROMACS simulation. (The previous state cpt file can be found in the directory too. )

You can use the cpt file to restart the md simulation as in this way,

gmx mdrun -deffnm md -s md.tpr -cpi state.cpt

If the log files are crashed and can not be appended, you can use -noappend flag with this command,

gmx mdrun -deffnm md -s md.tpr -cpi state.cpt -noappend

If the other files including trajectory files were crashed, better to start the simulation from the beginning by checking the mdp options and input structures.

Search Google as “Managing long simulation GROMACS”.

If you want to isolate a frame in the trajectory you can use gmx trjconv with -dump <time of the frame in ps). See gmx trjconv options.
However, it would not be recommended to start from a frame (in gro or pdb) generated in an invalid simulation. Also, try to use newer versions of GROMACS.

This is not a valid way to restart an MD simulation. It must be restarted using a cpt file.

I understand the way of using .cpt file to continue an interrupted simulation, but this is performed with the same .mdp file, while I want to change mdp settings. There seems no way to continue a simulation with a different .mdp file unless it is completed with a .gro file generated so that grompp can be used.

I understand the common reasons for a simulation to blow up, however they should cause errors at a early stage, don’t they? The energy minimization and NPT equilibration steps of this simulation looked fine and they did not cause error for 40 ns! Regarding couplings, I used V-rescale with tau-t = 0.5 ps and P-R with tau-p = 5 ps, which I suppose are fine?

Sometimes, compilation errors may present in your GROMACS package.
Also, as I know simulations would crash due to higher pressure scaling by Parrinello-Rahman Barrostat. In my membrane simulations, warnings about pressure scaling more than 1% have come after even 20ns. In one of my membrane simulations, that warning came even after I have done equilibration MD runs in 6 steps for about 50 ns of the total time. However, I haven’t get that kind of warning when I’m using C-rescale as the barostat even for the production runs. It is a new barostat (introduced in 2020) and available in later GROMACS versions. If your simulation was crashed due to a pressure scaling problem, you could solve the problem by using C-rescale. However, better to try newer versions.
Check the log file for the information about the termination.

You can use “gmx trjconv” with “-dump” flag to extract one frame from the trajectory.

I did not get errors of pressure scaling, instead the errors were these occurring subsequently:

Have you ever encountered a situation like this? I think the error primarily came from unsettled water molecules.

But yes I understand that C-rescale is a better barostat, just that my group has not transferred to the newer version of GROMACS yet, still it seems necessary. Thanks for your advice!

I have not encountered this kind of thing yet. Also, I can’t give direct advice as I’m not a professional. However, I suspect your energy minimization and equilibration steps wouldn’t be sufficient to build a good system for the production MD run.
Sometimes, you may solve your problem by doing those steps again with appropriate parameters. I have seen MDP files generated by CHARM-GUI for my membrane-protein system, equilibration is done in 0.001 ps timesteps at early stages to make the numerical integration stable. You could do equilibrations in such a way by also changing other parameters appropriately. I hope you will achieve success!

See this description,

https://manual.gromacs.org/current/user-guide/terminology.html#blowing-up

This is helpful. Thank you very much!