Using gmx trjconv -dt for a simulation with multiple parts

GROMACS version: 2018.8
GROMACS modification: No


I am using the gmx trjconv tool to change the timestep in a trajectory (say from 1 ps to 100 ps). Normally this would be trivial because one can set the flag “-dt” to the desired timestep, but unfortunately this flag writes frames when"when t MOD dt = first time (ps)", whereas I would like it to write a frame when t MOD dt = 0.

This could of course be solved by setting “-t0 0” to make the first time zero. Unfortunately, my trajectory is composed of many parts (e.g. “traj.part0001.xtc”, “traj.part0002.xtc”, etc), and therefore I would like to preserve the starting time for each of the parts when changing the timestep. I would also like to avoid building one concatenated file with trjcat as the file would be very large and hard to handle for analysis purposes and further manipulations.

So, is anyone aware of a straightforward method for changing the timestep when the first time is not zero?

Any help is much appreciated,
Dan Kozuch

When you refer to changing the time step, do you mean you simply wish to override the actual times, or you want to skip frames to achieve an increase in effective spacing of the frames? In the former case, use -timestep and in the latter use -skip.

I think I may have explained poorly. Here’s an example:

I have a trajectory “sim.part0001.xtc” that ends at 1003 ps and a trajectory “sim.part0002.xtc” that starts at 1004 ps, both with a timestep of 1 ps. I want to change the timestep to 10 ps, such that “new_sim.part0001.xtc” ends at 1000 ps and “new_sim.part0002.xtc” starts at 1010 ps, both with a timestep of 10 ps.

It is my understanding that regardless of using -timestep or -skip, “new_sim.part0002.xtc” will start at 1004 ps, which I do not want. Please let me know if that is not clear.

Do you want to skip frames, or artificially set the times? I’m still not clear based on the language you’re using. If you want to bypass time frames that are already written (i.e. for part0002, use -b). For example, if you want to skip frames and truncate sim.part0001.xtc at 1000 ps, then all you need is:

gmx trjconv -f sim.part0001.xtc -e 1000 -skip 10 -o fix.part0001.xtc

The same would apply to the second interval, which you can make start at 1010 ps with:

gmx trjconv -f sim.part0002.xtc -b 1010 -skip 10 -o fix.part0002.xtc

If this is not correct and you want to artificially alter the frame interval, replace skip with timestep and otherwise do the same thing.

Setting “-b” is what I want to do, but it is a bit inconvenient since I have many simulations with many parts, and I have to somehow determine what “-b” should be set to for each of them. For the moment I am actually using a python script to do this, but I was hoping there might be a way to avoid this complication.

It might be a nice feature to have in future gromacs versions where you can set “-dt” to write a frame when t MOD dt = 0.