# Anyway to remove first frame from .trr without specifying the time?

**URL:** <https://gromacs.bioexcel.eu/t/anyway-to-remove-first-frame-from-trr-without-specifying-the-time/3147>\
**Category:** User discussions\
**Created:** [November 15, 2021, 10:22pm UTC](https://gromacs.bioexcel.eu/t/anyway-to-remove-first-frame-from-trr-without-specifying-the-time/3147 "2021-11-15T22:22:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhall4](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jhall4](https://gromacs.bioexcel.eu/u/jhall4)\
**Post date:** [November 15, 2021, 10:22pm UTC](https://gromacs.bioexcel.eu/t/anyway-to-remove-first-frame-from-trr-without-specifying-the-time/3147/1 "2021-11-15T22:22:46Z")

</div>

GROMACS version:2020.4  
GROMACS modification: No

Hi,

I am having problems using trjcat with chunks of a long simulation, where it seems to drop a handful (tens) of frames at the boundaries between chunks, leaving gaps in the trajectory .trr. Since this problem does not occur for shorter simulations, I suspect that the problem is that trjcat uses the timestamps to match up frames, but the recorded times become unstable for trajectories with large numbers of steps. All I really need to do is manually remove the first frame from each chunk and then I could just do an ordinary cat. But looking at the options for gmx trjconv, I see no way to simply remove the first _frame_ without specifying it’s _time_, which as I noted is iffy. I should note that I need to work with the .trr format as I am recording velocities and forces.

Is there any simple way to remove the first frame from a trajectory without knowing it’s timestamp? I could of course try to gmx dump the output and then do it manually, but that seems clunky and I would like to avoid unnecessary duplication of data since I have large files.

Thanks!

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [November 16, 2021, 7:59am UTC](https://gromacs.bioexcel.eu/t/anyway-to-remove-first-frame-from-trr-without-specifying-the-time/3147/2 "2021-11-16T07:59:47Z")

</div>

I think a trjcat from a double precision trjcat should do the right thing. The only issue is that you then get a double precision output trr. A single precision trjconv can convert that back again.

I am preparing a fix for this. It should just be a matter of changing the time variables from single to double precision.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [November 16, 2021, 8:19am UTC](https://gromacs.bioexcel.eu/t/anyway-to-remove-first-frame-from-trr-without-specifying-the-time/3147/3 "2021-11-16T08:19:01Z")

</div>

If all your frames have equal size, all only x or all both x and v, you can manually do it. You can compute the number of bytes in s single frame, by dumping a single frame or dividing the size of the trajectory by the number of frames. Then you can use a command line tool (forgot which) to en extract the last numbytes\_total - numbytes\_frame bytes.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [November 16, 2021, 8:38am UTC](https://gromacs.bioexcel.eu/t/anyway-to-remove-first-frame-from-trr-without-specifying-the-time/3147/4 "2021-11-16T08:38:15Z")

</div>

Could you try the modified trjcat below? It is for version 2021. I renamed it to .log to be able to attach the file here. You should copy it to src/gromacs/tools/trjcat.cpp and make and install.

[trjcat.log](https://gromacs.bioexcel.eu/uploads/short-url/y3Fqb4Y4GewuxpI67pDtaCuLQUc.log) (33.2 KB)
