b7f94dea7fd5af1d40ded346bd7c75288d89eb1e
[alexxy/gromacs.git] / src / gromacs / legacyheaders / sim_util.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  * Copyright (c) 2013,2014, by the GROMACS development team, led by
7  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8  * and including many others, as listed in the AUTHORS file in the
9  * top-level source directory and at http://www.gromacs.org.
10  *
11  * GROMACS is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * GROMACS is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with GROMACS; if not, see
23  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
25  *
26  * If you want to redistribute modifications to GROMACS, please
27  * consider that scientific software is very special. Version
28  * control is crucial - bugs must be traceable. We will be happy to
29  * consider code for inclusion in the official distribution, but
30  * derived work must not be called official GROMACS. Details are found
31  * in the README & COPYING files - if they are missing, get the
32  * official version at http://www.gromacs.org.
33  *
34  * To help us fund GROMACS development, we humbly ask that you cite
35  * the research papers on the package. Check out http://www.gromacs.org.
36  */
37
38 #ifndef _sim_util_h
39 #define _sim_util_h
40
41 #include "gromacs/legacyheaders/typedefs.h"
42 #include "gromacs/legacyheaders/mdebin.h"
43 #include "gromacs/legacyheaders/update.h"
44 #include "gromacs/legacyheaders/vcm.h"
45 #include "../fileio/enxio.h"
46 #include "../fileio/mdoutf.h"
47 #include "../timing/wallcycle.h"
48 #include "../timing/walltime_accounting.h"
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 struct t_graph;
55
56 typedef struct gmx_global_stat *gmx_global_stat_t;
57
58 void do_pbc_first(FILE *log, matrix box, t_forcerec *fr,
59                   struct t_graph *graph, rvec x[]);
60
61 void do_pbc_first_mtop(FILE *fplog, int ePBC, matrix box,
62                        gmx_mtop_t *mtop, rvec x[]);
63
64 void do_pbc_mtop(FILE *fplog, int ePBC, matrix box,
65                  gmx_mtop_t *mtop, rvec x[]);
66
67
68
69 /* ROUTINES from stat.c */
70 gmx_global_stat_t global_stat_init(t_inputrec *ir);
71
72 void global_stat_destroy(gmx_global_stat_t gs);
73
74 void global_stat(FILE *log, gmx_global_stat_t gs,
75                  t_commrec *cr, gmx_enerdata_t *enerd,
76                  tensor fvir, tensor svir, rvec mu_tot,
77                  t_inputrec *inputrec,
78                  gmx_ekindata_t *ekind,
79                  gmx_constr_t constr, t_vcm *vcm,
80                  int nsig, real *sig,
81                  gmx_mtop_t *top_global, t_state *state_local,
82                  gmx_bool bSumEkinhOld, int flags);
83 /* Communicate statistics over cr->mpi_comm_mysim */
84
85 int do_per_step(gmx_int64_t step, gmx_int64_t nstep);
86 /* Return TRUE if io should be done */
87
88 /* ROUTINES from sim_util.c */
89
90 void print_time(FILE *out, gmx_walltime_accounting_t walltime_accounting,
91                 gmx_int64_t step, t_inputrec *ir, t_commrec *cr);
92
93 /*! \brief Print date, time, MPI rank and a description of this point
94  * in time.
95  *
96  * \param[in] log       logfile, or NULL to suppress output
97  * \param[in] rank      MPI rank to include in the output
98  * \param[in] title     Description to include in the output
99  * \param[in] the_time  Seconds since the epoch, e.g. as reported by gmx_gettime
100  */
101 void print_date_and_time(FILE *log, int rank, const char *title,
102                          double the_time);
103
104 void print_start(FILE *fplog, t_commrec *cr,
105                  gmx_walltime_accounting_t walltime_accounting,
106                  const char *name);
107
108 void finish_run(FILE *log, t_commrec *cr,
109                 t_inputrec *inputrec,
110                 t_nrnb nrnb[], gmx_wallcycle_t wcycle,
111                 gmx_walltime_accounting_t walltime_accounting,
112                 struct nonbonded_verlet_t *nbv,
113                 gmx_bool bWriteStat);
114
115 void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr);
116
117 void calc_dispcorr(t_inputrec *ir, t_forcerec *fr,
118                    int natoms,
119                    matrix box, real lambda, tensor pres, tensor virial,
120                    real *prescorr, real *enercorr, real *dvdlcorr);
121
122 void initialize_lambdas(FILE *fplog, t_inputrec *ir, int *fep_state, real *lambda, double *lam0);
123
124 void do_constrain_first(FILE *log, gmx_constr_t constr,
125                         t_inputrec *inputrec, t_mdatoms *md,
126                         t_state *state, t_commrec *cr, t_nrnb *nrnb,
127                         t_forcerec *fr, gmx_localtop_t *top);
128
129 void init_md(FILE *fplog,
130              t_commrec *cr, t_inputrec *ir, const output_env_t oenv,
131              double *t, double *t0,
132              real *lambda, int *fep_state, double *lam0,
133              t_nrnb *nrnb, gmx_mtop_t *mtop,
134              gmx_update_t *upd,
135              int nfile, const t_filenm fnm[],
136              gmx_mdoutf_t *outf, t_mdebin **mdebin,
137              tensor force_vir, tensor shake_vir,
138              rvec mu_tot,
139              gmx_bool *bSimAnn, t_vcm **vcm, unsigned long Flags,
140              gmx_wallcycle_t wcycle);
141 /* Routine in sim_util.c */
142
143 gmx_bool use_GPU(const struct nonbonded_verlet_t *nbv);
144
145 #ifdef __cplusplus
146 }
147 #endif
148
149 #endif  /* _sim_util_h */