added Verlet scheme and NxN non-bonded functionality
[gromacs.git] / include / tpxio.h
blob34b20acda4dc821045d07f24bf1e4ccf8f383c67
1 /*
2 *
3 * This source code is part of
4 *
5 * G R O M A C S
6 *
7 * GROningen MAchine for Chemical Simulations
8 *
9 * VERSION 3.2.0
10 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12 * Copyright (c) 2001-2004, The GROMACS development team,
13 * check out http://www.gromacs.org for more information.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * If you want to redistribute modifications, please consider that
21 * scientific software is very special. Version control is crucial -
22 * bugs must be traceable. We will be happy to consider code for
23 * inclusion in the official distribution, but derived work must not
24 * be called official GROMACS. Details are found in the README & COPYING
25 * files - if they are missing, get the official version at www.gromacs.org.
27 * To help us fund GROMACS development, we humbly ask that you cite
28 * the papers on the package - you can find them in the top README file.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * Gromacs Runs On Most of All Computer Systems
36 #ifndef _tpxio_h
37 #define _tpxio_h
40 /**************************************************************
42 * The routines in the corresponding c-file tpxio.c
43 * are based on the lower level routines in gmxfio.c
44 * The integer file pointer returned from open_tpx
45 * can also be used with the routines in gmxfio.h
47 **************************************************************/
48 #include "typedefs.h"
49 #include "gmxfio.h"
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
55 typedef struct
57 int bIr; /* Non zero if input_rec is present */
58 int bBox; /* Non zero if a box is present */
59 int bTop; /* Non zero if a topology is present */
60 int bX; /* Non zero if coordinates are present */
61 int bV; /* Non zero if velocities are present */
62 int bF; /* Non zero if forces are present */
64 int natoms; /* The total number of atoms */
65 int ngtc; /* The number of temperature coupling groups */
66 real lambda; /* Current value of lambda */
67 int fep_state; /* Current value of the alchemical state --
68 * not yet printed out. */
69 /*a better decision will eventually (5.0 or later) need to be made
70 on how to treat the alchemical state of the system, which can now
71 vary through a simulation, and cannot be completely described
72 though a single lambda variable, or even a single state
73 index. Eventually, should probably be a vector. MRS*/
74 } t_tpxheader;
76 /*
77 * These routines handle reading and writing of preprocessed
78 * topology files in any of the following formats:
79 * TPR : topology in XDR format, portable accross platforms
80 * TPB : binary topology, not portable accross platforms
81 * TPA : ascii topology (possibbly huge)
82 * TRR : trajectory in XDR format (non compressed)
83 * TRJ : trajectory in binary format
85 * Files are written in the precision with which the source are compiled,
86 * but double and single precision can be read by either.
89 t_fileio *open_tpx(const char *fn, const char *mode);
90 /* Return an file pointer corresponding to the file you have just opened */
92 void close_tpx(t_fileio *fio);
93 /* Close the file corresponding to fio */
95 void read_tpxheader(const char *fn, t_tpxheader *tpx, gmx_bool TopOnlyOK,
96 int *version, int *generation);
97 /* Read the header from a tpx file and then close it again.
98 * By setting TopOnlyOK to true, it is possible to read future
99 * versions too (we skip the changed inputrec), provided we havent
100 * changed the topology description. If it is possible to read
101 * the inputrec it will still be done even if TopOnlyOK is TRUE.
103 * The version and generation if the topology (see top of tpxio.c)
104 * are returned in the two last arguments.
107 void write_tpx_state(const char *fn,
108 t_inputrec *ir,t_state *state,gmx_mtop_t *mtop);
109 /* Write a file, and close it again.
110 * If fn == NULL, an efTPA file will be written to stdout (which
111 * will not be closed afterwards)
114 void read_tpx_state(const char *fn,
115 t_inputrec *ir,t_state *state,rvec *f,
116 gmx_mtop_t *mtop);
117 int read_tpx(const char *fn,
118 t_inputrec *ir,matrix box,int *natoms,
119 rvec *x,rvec *v,rvec *f,gmx_mtop_t *mtop);
120 /* Read a file, and close it again.
121 * If fn == NULL, an efTPA file will be read from stdin (which
122 * will not be closed afterwards)
123 * When step, t or lambda are NULL they will not be stored.
124 * Returns ir->ePBC, if it could be read from the file.
127 int read_tpx_top(const char *fn,
128 t_inputrec *ir, matrix box,int *natoms,
129 rvec *x,rvec *v,rvec *f,t_topology *top);
130 /* As read_tpx, but for the old t_topology struct */
132 gmx_bool fn2bTPX(const char *file);
133 /* return if *file is one of the TPX file types */
135 gmx_bool read_tps_conf(const char *infile,char *title,t_topology *top,
136 int *ePBC, rvec **x,rvec **v,matrix box,gmx_bool bMass);
137 /* Read title, top.atoms, x, v (if not NULL) and box from an STX file,
138 * memory for atoms, x and v will be allocated.
139 * Return TRUE if a complete topology was read.
140 * If infile is a TPX file read the whole top,
141 * else if bMass=TRUE, read the masses into top.atoms from the mass database.
144 void tpx_make_chain_identifiers(t_atoms *atoms,t_block *mols);
146 #ifdef __cplusplus
148 #endif
150 #endif