[gmx-developers] xtc_get_last_frame_time

Ran Friedman r.friedman at bioc.uzh.ch
Thu Mar 27 16:03:26 CET 2008


Dear developers,

I was unsuccessful in using xtc_get_last_frame_time from libxdrf.c on
different XTC files. This function isn't used by any other function in
GMX AFAIK.

The function always exits with return value -1 after the following line:

line 1639:
time = xtc_get_current_frame_time(fp, natoms, bOK);
xtc_get_current_frame_time, in its turn, returns -1 after calling
xtc_at_header_start:

line 1281:
ret = xtc_at_header_start(fp,natoms,&step,&time);

And xtc_at_header_start returns -1 at:

lines 1159-1165:
  /* read magic natoms and timestep */
  for(i = 0;i<3;i++){
    if(!xdr_int(xdridptr[fp+1], &(i_inp[i]))){
      gmx_fseek(xdrfiles[fp+1],off+sizeof(int),SEEK_SET);
      return -1;
    }
  }

It returns -1 when i=1 (i.e. for the number of atoms), but the magic
number is also not right (and it's not the same number for different
trajectories).

Coming back to the high level function which I use
(xtc_get_last_frame_time), I noticed that it puts the stream pointer to
the EOF - 4 fields:

lines 1634-1639
    if( (res = gmx_fseek(xdrfiles[fp+1],-4,SEEK_END)) != 0){
      *bOK = 0;
      return -1;
    }

    time = xtc_get_current_frame_time(fp, natoms, bOK);

My questions are:
1. Will this location point me to the header? If the header is at the
beginning of each frame then I guess that the answer is no.
2. Suppose that it doesn't point me to the header of the last frame, how
can I get there without passing through all other frames?

I'm using GMX 3.3.3.

Thanks,
Ran.

-- 
------------------------------------------------------
Ran Friedman
Postdoctoral Fellow
Computational Structural Biology Group (A. Caflisch)
Department of Biochemistry
University of Zurich
Winterthurerstrasse 190
CH-8057 Zurich, Switzerland
Tel. +41-44-6355593
Email: r.friedman at bioc.unizh.ch
Skype: ran.friedman
------------------------------------------------------




More information about the gromacs.org_gmx-developers mailing list