[gmx-users] Length of .xtc file in frames for C-Code
Barnett, James W.
jbarnet4 at tulane.edu
Fri Apr 4 00:14:47 CEST 2014
> I have a question to all the people who are familiar with C-code. How can I
> read in the total number of frames in my *.xtc file? Especially when I do
> the analysis somewhere in the middle?
Are you using the XDR library or something else? In the XDR library there is a
way to get the "status" each time you read in a frame. At the end of the file
you get a different status, signaling there is nothing else to read in (or
maybe signaling an error).
Typically I read in a frame, do my calcs, etc, and then when I'm at the end of
the file the loop is exited. To start somewhere in the middle of the file I
set it up to read in X frames before I do my calcs (just cycle through the
loop but skip the calcs). I don't use C in particular, but the principle
remains.
Alternatively you can use the trjconv tool to get rid of unneeded frames and
then use your analysis program.
James Barnett
>
> E.g: I have a file with 100.000 frames. When I start the programm with
>
> ./program -f traj.xtc
>
> then I want somewhere in my code something like:
>
> int totalnumerbofframesyouareanalyzing = 100.000
>
>
> When I do the same with:
>
> ./program -f traj.xtc -b 20.000
>
> then I want in my code:
>
> int totalnumerbofframesyouareanalyzing = 80.000
>
> Thanks for your help!
> GtrAngus
>
More information about the gromacs.org_gmx-users
mailing list