[gmx-users] How to recover a corrupted .edr file

Mark Abraham mark.j.abraham at gmail.com
Thu Oct 5 16:07:44 CEST 2017


On Thu, Oct 5, 2017 at 7:38 AM Christopher Neale <
chris.neale at alum.utoronto.ca> wrote:

> Dear users:
> I recently experienced some corruption in a .xtc and a .edr file.
> Recovering the .xtc was pretty easy, I use gmx trjconv -b and -e to get the
> part before the corruption and the part after the corruption, which was
> itself a small chunk. This presumably works because trjconv actually skips
> to the -b time without reading through to get there.

Yes, seeking is supported for xtc and tng, which happens to deal with a
corrupted xtc file.

> However, gmx eneconv seems to start reading always form the start of the
> .edr file. This is fine for a normal file, where it reads the initial
> frames through until the -b time and then starts writing to the output
> file. However, with a corrupted file, it causes problems because it hangs
> up on the corruption. To put it more planly, gmx trjconv fails with a
> corrupted .xtc but can recover a readable part beyond the corruption with a
> -b value just beyond the end of the corruption; this is not possible with
> my usage of gmx eneconv. I'm hoping that there is some alternative.

Unfortunately, there is nothing simple. If one was desperate enough, there
is a magic number emitted at the start of each valid edr frame that could
be used to split the file using some kind of binary file-editing tool. That
could find the byte index of the first frame after the corruption, and thus
permit truncating off the front part. IIRC, each frame is self-contained,
even for the string names, but that will be obvious to see with a hexdump


> Below is what I get with gmx eneconv from version 5.1.2. I als tried
> 2016.2 and got the same result. You can see that it lists the start time as
> "0" ps even though I sent it -b 379000. This is not a bug, since I tested
> with a non-corrupted file and gmx eneconv will respect the -b flag in what
> it writes out. It's just that eneconv can not seem to skip right to the -b
> point whereas trjconv can.
> GROMACS:      gmx eneconv, VERSION 5.1.2
> Executable:   /scratch/cneale/exe/GROMACS/exec/gromacs-5.1.2/serial/bin/gmx
> Data prefix:  /scratch/cneale/exe/GROMACS/exec/gromacs-5.1.2/serial
> Command line:
>   gmx eneconv -f 120LPL/DOPC_DPPC_chol_1_1_1_310K/MD.edr -b 379000 -o
> 120LPL/DOPC_DPPC_chol_1_1_1_310K/MD_post_379000ps.edr
> Opened 120LPL/DOPC_DPPC_chol_1_1_1_310K/MD.edr as single precision energy
> file
> ^MReading energy frame      0 time    0.000         ^MReading energy
> frame      1 time    2.000
> Sorting disabled.
> Summary of files and start times used:
>           File                Start time
> -----------------------------------------
> 120LPL/DOPC_DPPC_chol_1_1_1_310K/MD.edr        0.000
> Opened 120LPL/DOPC_DPPC_chol_1_1_1_310K/MD.edr as single precision energy
> file
> ...
> ########
> Thank you,
> Chris.
> --
> Gromacs Users mailing list
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> posting!
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.

More information about the gromacs.org_gmx-users mailing list