changed reading hint
[gromacs/adressmacs.git] / include / trnio.h
blobe4765a1ddb2072cfdbed8a47e8bfa7a01a121614
1 /*
2 * $Id$
3 *
4 * This source code is part of
5 *
6 * G R O M A C S
7 *
8 * GROningen MAchine for Chemical Simulations
9 *
10 * VERSION 2.0
12 * Copyright (c) 1991-1999
13 * BIOSON Research Institute, Dept. of Biophysical Chemistry
14 * University of Groningen, The Netherlands
16 * Please refer to:
17 * GROMACS: A message-passing parallel molecular dynamics implementation
18 * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19 * Comp. Phys. Comm. 91, 43-56 (1995)
21 * Also check out our WWW page:
22 * http://md.chem.rug.nl/~gmx
23 * or e-mail to:
24 * gromacs@chem.rug.nl
26 * And Hey:
27 * Green Red Orange Magenta Azure Cyan Skyblue
30 #ifndef _trnio_h
31 #define _trnio_h
33 static char *SRCID_trnio_h = "$Id$";
35 /**************************************************************
37 * These routines handle trj (trajectory) I/O, they read and
38 * write trj/trr files. The routines should be able to read single
39 * and double precision files without the user noting it.
40 * The files are backward compatible, therefore the header holds
41 * some unused variables.
43 * The routines in the corresponding c-file trnio.c
44 * are based on the lower level routines in gmxfio.c
45 * The integer file pointer returned from open_trn
46 * can also be used with the routines in gmxfio.h
48 **************************************************************/
50 #include "typedefs.h"
52 typedef struct /* This struct describes the order and the */
53 /* sizes of the structs in a trjfile, sizes are given in bytes. */
55 int ir_size; /* Backward compatibility */
56 int e_size; /* Backward compatibility */
57 int box_size; /* Non zero if a box is present */
58 int vir_size; /* Backward compatibility */
59 int pres_size; /* Backward compatibility */
60 int top_size; /* Backward compatibility */
61 int sym_size; /* Backward compatibility */
62 int x_size; /* Non zero if coordinates are present */
63 int v_size; /* Non zero if velocities are present */
64 int f_size; /* Non zero if forces are present */
66 int natoms; /* The total number of atoms */
67 int step; /* Current step number */
68 int nre; /* Backward compatibility */
69 real t; /* Current time */
70 real lambda; /* Current value of lambda */
71 } t_trnheader;
73 extern int open_trn(char *fn,char *mode);
74 /* Open a trj / trr file */
76 extern void close_trn(int fp);
77 /* Close it */
79 extern bool fread_trnheader(int fp,t_trnheader *trn,bool *bOK);
80 /* Read the header of a trn file. Return FALSE if there is no frame.
81 * bOK will be FALSE when the header is incomplete.
84 extern void read_trnheader(char *fn,t_trnheader *header);
85 /* Read the header of a trn file from fn, and close the file afterwards.
88 extern void pr_trnheader(FILE *fp,int indent,char *title,t_trnheader *sh);
89 /* Print the header of a trn file to fp */
91 extern bool is_trn(FILE *fp);
92 /* Return true when the file is a trn file. File will be rewound
93 * afterwards.
96 extern void fwrite_trn(int fp,int step,real t,real lambda,
97 rvec *box,int natoms,rvec *x,rvec *v,rvec *f);
98 /* Write a trn frame to file fp, box, x, v, f may be NULL */
100 extern bool fread_htrn(int fp,t_trnheader *sh,
101 rvec *box,rvec *x,rvec *v,rvec *f);
102 /* Extern read a frame except the header (that should be pre-read,
103 * using routine read_trnheader, see above) from a trn file.
104 * Return FALSE on error
107 extern bool fread_trn(int fp,int *step,real *t,real *lambda,
108 rvec *box,int *natoms,rvec *x,rvec *v,rvec *f);
109 /* Read a trn frame, including the header from fp. box, x, v, f may
110 * be NULL, in which case the data will be skipped over.
111 * return FALSE on error
114 extern void write_trn(char *fn,int step,real t,real lambda,
115 rvec *box,int natoms,rvec *x,rvec *v,rvec *f);
116 /* Write a single trn frame to file fn, which is closed afterwards */
118 extern void read_trn(char *fn,int *step,real *t,real *lambda,
119 rvec *box,int *natoms,rvec *x,rvec *v,rvec *);
120 /* Read a single trn frame from file fn, which is closed afterwards
123 #endif