[gmx-developers] Getting the last frame in an xtc file

Ran Friedman r.friedman at bioc.uzh.ch
Thu Apr 10 16:04:51 CEST 2008

Dear Mark, GMX developers,

Unfortunately this doesn't work. In any case, this part of the code
returns -1 in any case:
 }else if(ret == -1){
    if(gmx_fseek(xdrfiles[fp+1],off,SEEK_SET)) {
      return -1;
    return -1;

and even if I try to move backwards 2*sizeoff(int) at a time  it doesn't
get me anywhere.


Mark Abraham wrote:
> Ran Friedman wrote:
>> Mark Abraham wrote:
>>> Roughly speaking, xtc_at_header_start expects to be at the start of a
>>> frame to read its header, or to fail. The 3.3.1 version of
>>> xtc_get_frame_number does the test-for-header with explicit code,
>>> whereas 3.3.3 does it with the call to xtc_at_header_start. When the
>>> test fails, and xtc_at_header_start fails, the 3.3.3 version should
>>> probably have
>>>     if(gmx_fseek(xdrfiles[fp+1],off-sizeof(int)*2,SEEK_SET)){
>>> as line 1328, not
>>>     if(gmx_fseek(xdrfiles[fp+1],off,SEEK_SET)){
>>> so that it seeks backwards in the same way as the 3.3.1 code does. Ran
>>> can probably test this to see if it works :-)

More information about the gromacs.org_gmx-developers mailing list