Reducing EDR file output

GROMACS version: 2020.6
GROMACS modification: No (But I think a modification is required to do what I want)

I’m running a few very long simulations (1μs) and I need the pressure tensor sampled every 2fs. I only need the pressure tensor. The output .edr file would be about 500GB, and I really don’t need most of it. Is there a way to only save certain parameters to the .edr file?

If there isn’t an in-built way to do this (and I suspect there isn’t), has anyone already made a similar modification that I can use? Or, any tips for what exactly needs to be changed in the gromacs code in order to achieve this?

Thanks so much.

you can have a look at gmx eneconv
it will allow you to reduce edr dimension after you extract the desired values.
Best regards


you might have to modify the code to explicitly write the pressure tensor to disk whenever you need it. This would require:

  1. To ensure that it is calculated
  2. To write it

The main MD loop is in src/gromacs/mdrun/md.cpp, you could perhaps have a look at that and where + how the function compute_globals is called? The pressure tensor seems to be stored in the pres variable, but it’s not fully clear to me from a glance exactly when you can be sure that it is updated. Perhaps if you set nstcalcenergy = 1 in your .mdp file it will be correct at the end of the loop, at every step? This might be slow…


Hm. I was thinking about going the other way, and just limiting the parameters that actually get saved to the edr file… compute_globals is probably the place for me to start either way, thanks!

Well with 5 replicas I don’t have the storage space for the 2.5 TB of data, so I need to do something earlier in the pipeline.