Fix malformed CUDA version macro check
[alexxy/gromacs.git] / include / md_support.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team,
6  * check out http://www.gromacs.org for more information.
7  * Copyright (c) 2012,2013, by the GROMACS development team, led by
8  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
9  * others, as listed in the AUTHORS file in the top-level source
10  * directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38
39 #ifndef _md_support_h
40 #define _md_support_h
41 #include "visibility.h"
42 #include "typedefs.h"
43 #include "types/globsig.h"
44 #include "sim_util.h"
45 #include "vcm.h"
46
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50
51 /* Define a number of flags to better control the information
52  * passed to compute_globals in md.c and global_stat.
53  */
54
55 /* We are rerunning the simulation */
56 #define CGLO_RERUNMD        (1<<1)
57 /* we are computing the kinetic energy from average velocities */
58 #define CGLO_EKINAVEVEL     (1<<2)
59 /* we are removing the center of mass momenta */
60 #define CGLO_STOPCM         (1<<3)
61 /* bGStat is defined in do_md */
62 #define CGLO_GSTAT          (1<<4)
63 /* Sum the energy terms in global computation */
64 #define CGLO_ENERGY         (1<<6)
65 /* Sum the kinetic energy terms in global computation */
66 #define CGLO_TEMPERATURE    (1<<7)
67 /* Sum the kinetic energy terms in global computation */
68 #define CGLO_PRESSURE       (1<<8)
69 /* Sum the constraint term in global computation */
70 #define CGLO_CONSTRAINT     (1<<9)
71 /* we are using an integrator that requires iteration over some steps - currently not used*/
72 #define CGLO_ITERATE        (1<<10)
73 /* it is the first time we are iterating (or, only once through is required */
74 #define CGLO_FIRSTITERATE   (1<<11)
75 /* Reading ekin from the trajectory */
76 #define CGLO_READEKIN       (1<<12)
77 /* we need to reset the ekin rescaling factor here */
78 #define CGLO_SCALEEKIN      (1<<13)
79
80
81 /* return the number of steps between global communcations */
82 GMX_LIBMD_EXPORT
83 int check_nstglobalcomm(FILE *fplog, t_commrec *cr,
84                         int nstglobalcomm, t_inputrec *ir);
85
86 /* check whether an 'nst'-style parameter p is a multiple of nst, and
87    set it to be one if not, with a warning. */
88 GMX_LIBMD_EXPORT
89 void check_nst_param(FILE *fplog, t_commrec *cr,
90                      const char *desc_nst, int nst,
91                      const char *desc_p, int *p);
92
93 /* check which of the multisim simulations has the shortest number of
94    steps and return that number of nsteps */
95 GMX_LIBMD_EXPORT
96 gmx_large_int_t get_multisim_nsteps(const t_commrec *cr,
97                                     gmx_large_int_t  nsteps);
98
99 GMX_LIBMD_EXPORT
100 void rerun_parallel_comm(t_commrec *cr, t_trxframe *fr,
101                          gmx_bool *bNotLastFrame);
102
103 /* get the conserved energy associated with the ensemble type*/
104 GMX_LIBMD_EXPORT
105 real compute_conserved_from_auxiliary(t_inputrec *ir, t_state *state,
106                                       t_extmass *MassQ);
107
108 /* set the lambda values at each step of mdrun when they change */
109 GMX_LIBMD_EXPORT
110 void set_current_lambdas(gmx_large_int_t step, t_lambda *fepvals, gmx_bool bRerunMD,
111                          t_trxframe *rerun_fr, t_state *state_global, t_state *state, double lam0[]);
112
113 int multisim_min(const gmx_multisim_t *ms, int nmin, int n);
114 /* Set an appropriate value for n across the whole multi-simulation */
115
116 int multisim_nstsimsync(const t_commrec *cr,
117                         const t_inputrec *ir, int repl_ex_nst);
118 /* Determine the interval for inter-simulation communication */
119
120 GMX_LIBMD_EXPORT
121 void init_global_signals(globsig_t *gs, const t_commrec *cr,
122                          const t_inputrec *ir, int repl_ex_nst);
123 /* Constructor for globsig_t */
124
125 GMX_LIBMD_EXPORT
126 void copy_coupling_state(t_state *statea, t_state *stateb,
127                          gmx_ekindata_t *ekinda, gmx_ekindata_t *ekindb, t_grpopts* opts);
128 /* Copy stuff from state A to state B */
129
130 GMX_LIBMD_EXPORT
131 void compute_globals(FILE *fplog, gmx_global_stat_t gstat, t_commrec *cr, t_inputrec *ir,
132                      t_forcerec *fr, gmx_ekindata_t *ekind,
133                      t_state *state, t_state *state_global, t_mdatoms *mdatoms,
134                      t_nrnb *nrnb, t_vcm *vcm, gmx_wallcycle_t wcycle,
135                      gmx_enerdata_t *enerd, tensor force_vir, tensor shake_vir, tensor total_vir,
136                      tensor pres, rvec mu_tot, gmx_constr_t constr,
137                      globsig_t *gs, gmx_bool bInterSimGS,
138                      matrix box, gmx_mtop_t *top_global, real *pcurr,
139                      int natoms, gmx_bool *bSumEkinhOld, int flags);
140 /* Compute global variables during integration */
141
142 #ifdef __cplusplus
143 }
144 #endif
145
146 #endif  /* _md_support_h */