trjconv -t0 -b leads to frame skipping
I want to extract a section from a .xtc using trjconv -b -e and then reset the time to start at 0.
When I try to do it in a single trjconv step, it does reset the starting time, but it also only print every second step
For example, I might do this to extract and retime, then check the timing using g_traj:
trjconv -f MD.xtc -o out.xtc -b 2 -t0 0
echo 0 |g_traj -f out.xtc -s MD.tpr -ob box.xvg
rm -f out.xtc
The output in box.xvg is:
0 2.99635 2.99635 2.99453 0 0 0
0.4 2.99835 2.99835 2.99643 0 0 0
0.8 2.99916 2.99916 2.99691 0 0 0
But If I remove the -t0 flag to trjconv, I get:
2 2.99635 2.99635 2.99453 0 0 0
2.2 2.99709 2.99709 2.99581 0 0 0
2.4 2.99835 2.99835 2.99643 0 0 0
Note that the workaround is to do the -b and -t0 in two steps.
I suspect that this is related to issue 1405
I tested 4.6.1-4.6.5, all of which show the issue. When testing 4.5.5, 4.0.7, and 3.3.3, I ran into issue 1405 even with "-b 2" so was unable to be sure how recent this issue is.
Fix that seeking was wrong if frame time was modified
The trjconv -t0 option causes fr->time to be modified and
this then causes the skipping to be incorrect. Alternative
we could document that fr->time shouldn't be modified
and change that trjconv makes a copy of fr before changing
time. This change has the advantage it is less likely
to reintroduce the problem.
Fix trjconv modifying fr.time unnecessarily
The was a bug where trjconv modified the input frame time, which
caused issues with xtc seeking. This has recently been fixed
by commit 81d10b25, but it's better not to mess with the input
frame and only modify the output frame.