# Recovery from Magic number missing (trr write error?)

**URL:** <https://gromacs.bioexcel.eu/t/recovery-from-magic-number-missing-trr-write-error/135>\
**Category:** User discussions\
**Created:** [May 14, 2020, 1:38am UTC](https://gromacs.bioexcel.eu/t/recovery-from-magic-number-missing-trr-write-error/135 "2020-05-14T01:38:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mick](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mick](https://gromacs.bioexcel.eu/u/mick)\
**Post date:** [May 14, 2020, 1:38am UTC](https://gromacs.bioexcel.eu/t/recovery-from-magic-number-missing-trr-write-error/135/1 "2020-05-14T01:38:27Z")

</div>

GROMACS version: GROMACS 2020  
GROMACS modification: No

I have a 36GB simulation file and a 100GB file that represents an extension of the original simulation that has been successfully running for a few days (with multiple successful checkpoint based restarts) but now that the simulation is complete when I try to concat the two files together I am getting a “magic number” error. It seems I can gmx dump the first 155 frames without any issues, but I am not sure if there is any way to recover from this. If it was an xtc I would just use gmx rescue (from years gone by), but I am not sure if this will work for trr’s generated by gromacs 2020.

Any thoughts?

-Micholas

---

<div class="post-metadata">

**Author:** ![cblau](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/cblau/32/5_2.png) [@cblau](https://gromacs.bioexcel.eu/u/cblau)\
**Post date:** [May 14, 2020, 8:11am UTC](https://gromacs.bioexcel.eu/t/recovery-from-magic-number-missing-trr-write-error/135/2 "2020-05-14T08:11:35Z")

</div>

Does `gmx trjconv -e time_where_corrupted` help you to cut away the part that is corrupted?

---

<div class="post-metadata">

**Author:** ![mick](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mick](https://gromacs.bioexcel.eu/u/mick)\
**Post date:** [June 7, 2020, 8:29pm UTC](https://gromacs.bioexcel.eu/t/recovery-from-magic-number-missing-trr-write-error/135/3 "2020-06-07T20:29:33Z")

</div>

I can cut up to the corrupted portion but I can’t skip over the corrupted frames using gmx trjcat.

Using split and a hex editor (thanks to someone in my group) we could manually rescue the trajectories (after 4 ‘broken/corrupted’ frames the rest of the trajectory was fine), but we’ve not come up with a way to automate this in case it happens again in the future.

---

<div class="post-metadata">

**Author:** ![orbeckst](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/orbeckst/32/32_2.png) [@orbeckst](https://gromacs.bioexcel.eu/u/orbeckst)\
**Post date:** [June 7, 2020, 10:57pm UTC](https://gromacs.bioexcel.eu/t/recovery-from-magic-number-missing-trr-write-error/135/4 "2020-06-07T22:57:58Z")

</div>

gmxrescue was a small program that could be used to skip over bad XTC parts. Together with trjcat you could reconstuct a good trajectory with only a few frames missing.

One of my students worked with gmxrescue a while back when we had widespread trajectory corruption due to file transfer issues; see [https://github.com/Becksteinlab/gmx\_first\_aid](https://github.com/Becksteinlab/gmx_first_aid) — see if this does anything for you, but no promises. We haven’t really used it since we put it up and it’s not really supported by us.

(A _very_ long time ago in a country far, far away I modified a version of gmxrescue to work on 64 bit; it is possible that the source code is still available at [http://sbcb.bioch.ox.ac.uk/users/oliver/software/](http://sbcb.bioch.ox.ac.uk/users/oliver/software/) ; I haven’t looked at it for at least 10 years so apart from the link there’s not much else I can contribute. I _think_ the source in the GitHub repo is the same as the one at that link.)

---

<div class="post-metadata">

**Author:** ![mick](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mick](https://gromacs.bioexcel.eu/u/mick)\
**Post date:** [June 8, 2020, 1:52am UTC](https://gromacs.bioexcel.eu/t/recovery-from-magic-number-missing-trr-write-error/135/5 "2020-06-08T01:52:09Z")

</div>

@orbeckst

This is great! Thank you for the source code. I was trying to modify gmx rescue also so it is nice to see someone else’s take as well.
