d0e4b2e22e86b61e1d3b1536253c01819366ec90
[alexxy/gromacs.git] / include / confio.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  * Good ROcking Metal Altar for Chronical Sinners
28  */
29
30 #ifndef _confio_h
31 #define _confio_h
32
33 static char *SRCID_confio_h = "$Id$";
34
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38
39 #ifdef HAVE_IDENT
40 #ident  "@(#) confio.h 1.16 11/23/92"
41 #endif /* HAVE_IDENT */
42
43 #include "typedefs.h"
44
45 /* For reading coordinate files it is assumed that enough memory
46  * has been allocated beforehand.
47  */
48 #ifdef CPLUSPLUS
49 extern "C" {
50 #endif
51   
52 extern void init_t_atoms(t_atoms *atoms, int natoms, bool bPdbinfo);
53 /* allocate memory for the arrays, set nr to natoms and nres to 0
54  * set pdbinfo to NULL or allocate memory for it */  
55
56 extern void free_t_atoms(t_atoms *atoms);
57 /* free all the arrays and set the nr and nres to 0 */
58
59 int read_g96_conf(FILE *fp,char *infile,t_trxframe *fr);
60 /* read a Gromos96 coordinate or trajectory file,                       *
61  * returns the number of atoms                                          *
62  * sets what's in the frame in info                                     *  
63  * read from fp, infile is only needed for error messages               *   
64  * nwanted is the number of wanted coordinates,                         *
65  * set this to -1 if you want to know the number of atoms in the file   *
66  * title, atoms, x, v can all be NULL, in which case they won't be read */
67
68 void write_g96_conf(FILE *out,t_trxframe *fr,int nindex,atom_id *index);
69 /* write a Gromos96 coordinate file or trajectory frame *
70  * index can be NULL                                    */
71
72 extern bool gro_next_x_or_v(FILE *status,t_trxframe *fr);
73 extern int gro_first_x_or_v(FILE *status,t_trxframe *fr);
74 /* read first/next x and/or v frame from gro file */
75
76 extern void write_hconf_indexed_p(FILE *out,char *title,t_atoms *atoms,
77                                   int nx,atom_id index[],int ndec,
78                                   rvec *x,rvec *v,matrix box);
79                 
80 extern void write_hconf_p(FILE *out,char *title,t_atoms *atoms, int ndec,
81                           rvec *x,rvec *v,matrix box); 
82 /* Write a Gromos file with precision ndec: number of decimal places in x,
83  * v has one place more. */ 
84
85 void write_sto_conf_indexed(char *outfile,char *title,t_atoms *atoms, 
86                             rvec x[],rvec *v,matrix box,
87                             atom_id nindex,atom_id index[]);
88 /* like write_sto_conf, but indexed */ 
89
90 extern void write_sto_conf(char *outfile, char *title,t_atoms *atoms, 
91                            rvec x[],rvec *v, matrix box);
92 /* write atoms, x, v (if .gro and not NULL) and box (if not NULL) 
93  * to an STO (.gro or .pdb) file */ 
94
95 extern void get_stx_coordnum (char *infile,int *natoms);
96 /* read the number of atoms from an STX file */
97
98 extern void read_stx_conf(char *infile, char *title,t_atoms *atoms, 
99                           rvec x[],rvec *v, matrix box);
100 /* read atoms, x, v and box from an STX file */
101
102 #ifdef CPLUSPLUS
103 }
104 #endif
105
106 #endif  /* _confio_h */