xtc file format |
||
Main Table of Contents | VERSION 5.0.2 |
All the data is stored using calls to xdr routines.
/* All functions return 1 if successful, 0 otherwise */ extern int open_xtc(XDR *xd,char *filename,char *mode); /* Open a file for xdr I/O */ extern void close_xtc(XDR *xd); /* Close the file for xdr I/O */ extern int read_first_xtc(XDR *xd,char *filename, int *natoms,int *step,real *time, matrix box,rvec **x,real *prec); /* Open xtc file, read xtc file first time, allocate memory for x */ extern int read_next_xtc(XDR *xd, int *natoms,int *step,real *time, matrix box,rvec *x,real *prec); /* Read subsequent frames */ extern int write_xtc(XDR *xd, int natoms,int step,real time, matrix box,rvec *x,real prec); /* Write a frame to xtc file */To use the library function include "gromacs/fileio/xtcio.h" in your file and link with -lgmx.$(CPU)
program testxtc parameter (maxatom=10000,maxx=3*maxatom) integer xd,xd2,natoms,step,ret,i real time,box(9),x(maxx) call xdrfopen(xd,"test.xtc","r",ret) print *,'opened test.xtc, ret=',ret call xdrfopen(xd2,"testout.xtc","w",ret) print *,'opened testout.xtc, ret=',ret 10 call readxtc(xd,natoms,step,time,box,x,prec,ret) if ( ret .eq. 1 ) then call writextc(xd2,natoms,step,time,box,x,prec,ret) else print *,'Error reading xtc' endif stop endTo link your program use -L$(GMXHOME)/lib/$(CPU) -lxtcf on your linker command line. The source for this test can be found in file $(GMXHOME)/src/gmxlib/testxtcf.f.