Trjconv with multiple dump times

GROMACS version: All
GROMACS modification: No
Here post your question

Hi,

Is there a way to extract several frames at different timestamp with a single trjconv command? Something which would look like “gmx trjconv -s MD.tpr -n Index.ndx -f MD.xtc -o MD.gro -dump 1503,2578,4076”.

Here is why I ask: I have performed a steered-MD and would like to extract frames to do umbrella sampling. I would like to extract frames at 1503ps, 2578ps, 4076ps, etc… (these are just examples to point out that they are not linked by anyway). Currently, I am running trjconv three times, but this is getting very long for long steered-MD with large boxes to read many times the .xtc file.

Thank you

Nicolas

No but since you already know the times you need, just execute a for-loop:

for x in 1503 2578 4076; do
    gmx trjconv -dump $x ...
done

That’s what I am currently doing. But my trajectory is 1000ns long and reading the full trajectory to extract a frame near 970ns, then reading it again from scratch to extract another frame a few ns later is a waste of ressources. That’s why I was hoping for something more efficient.

Use -b to your advantage to bypass the unnecessary parts of the trajectory, e.g. if your frames were saved every 10 ps:

dt=10
for x in 1503 2578 4076; do
    y=$(( x - dt ))
    gmx trjconv -b $y -dump $x ...
done

Thank you for the tip, I had not thought about this option.

Hi,

I am sorry to re-open this (relatively) old thread, but it seems to me that adding -b yields minimal gain in terms of efficiency.
I am in a similar situation as the one outlined by ncheron and ‘skipping’ the first N frames every time in the for loop is still really slow, up to the point that I don’t see any real difference w.r.t. not using the option.
It would be great to have an option to output multiple snapshots in a single run of gmx trjconv; could -drop or -sep help somehow?

IIRC -b helps with xtc, but probably not with trr, even though it would be even easier to reposition the file pointer with trr that has fixed frame size.