e45898c561f24372c90c8d667abdad797725b5ab
[alexxy/gromacs.git] / include / statusio.h
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
11  * 
12  * Copyright (c) 1991-1999
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
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)
20  * 
21  * Also check out our WWW page:
22  * http://md.chem.rug.nl/~gmx
23  * or e-mail to:
24  * gromacs@chem.rug.nl
25  * 
26  * And Hey:
27  * Green Red Orange Magenta Azure Cyan Skyblue
28  */
29
30 #ifndef _statusio_h
31 #define _statusio_h
32
33 static char *SRCID_statusio_h = "$Id$";
34
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38
39 #ifdef HAVE_IDENT
40 #ident  "@(#) statusio.h 1.46 2/2/97"
41 #endif /* HAVE_IDENT */
42
43 #include "typedefs.h"
44 #include "sheader.h"
45
46 /*
47  * This module handles status file io. All read and write operations from
48  * and to a status file should use this functions to be independent of the
49  * actual file layout (text versus binary file).
50  */
51 #ifdef CPLUSPLUS
52 extern "C" { 
53 #endif
54
55 extern size_t wr_status(FILE *fp,int step,real t,real lambda,
56                         t_inputrec *ir,rvec *box,rvec *vir,rvec *pres,
57                         int natoms,rvec *x,rvec *v,rvec *f,
58                         int nre,t_energy *e,t_topology *top);
59 /*
60  * Writes a complete status to the file, specified by fp. NULL pointers
61  * indicate that this field should not be written. The function returns
62  * the number of bytes written.
63  */
64
65 extern char *rd_hstatus(FILE *fp,t_statheader *sh,int *step,real *t,
66                         real *lambda,t_inputrec *ir,rvec *box,
67                         rvec *vir,rvec *pres,int *natoms,
68                         rvec *x,rvec *v,rvec *f,int *nre,t_energy *e,
69                         t_topology *top);
70 /*
71  * Reads a complete status from the file, specified by fp. It uses
72  * the status header to find the items in the file, also the file
73  * should be positioned right for reading the first item. The function
74  * returns the version string from the header.
75  */
76
77 extern char *rd_status(FILE *fp,int *step,real *t,real *lambda,
78                        t_inputrec *ir,rvec *box,rvec *vir,rvec *pres,
79                        int *natoms,rvec *x,
80                        rvec *v,rvec *f,int *nre,t_energy *e,
81                        t_topology *top);
82 /*
83  * Reads a complete status from the file, specified by fp. First it
84  * reads the header and then invokes rd_hstatus() to read the rest
85  * of the status. It returns the version returned from rd_hstatus().
86  */
87
88 extern void write_status(char *fn,int step,real t,real lambda,t_inputrec *ir,
89                          rvec *box,rvec *vir,rvec *pres,
90                          int natoms,rvec *x,rvec *v,rvec *f,
91                          int nre,t_energy *e,t_topology *top);
92 /*
93  * Writes a complete status to the file, specified by fn. NULL pointers
94  * indicate that this field should not be written.
95  */
96
97 extern char *read_status(char *fn,int *step,real *t,real *lambda,
98                          t_inputrec *ir,rvec *box,rvec *vir,rvec *pres,
99                          int *natoms,rvec *x,
100                          rvec *v,rvec *f,int *nre,t_energy *e,
101                          t_topology *top);
102 /*
103  * Reads a complete status from the file, specified by fn. It returns
104  * the version returned from rd_hstatus().
105  */
106
107 extern void read_status_header(char *fn,t_statheader *header);
108 /*
109  * Reads a (status) header from the file, specified by fn. If
110  * available, it returns the version string from the file, else
111  * it returns a version string from the statusio module.
112  */
113
114 #ifdef CPLUSPLUS
115 }
116 #endif
117
118 #endif  /* _statusio_h */