Merge branch release-4-6 into release-5-0
[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 "typedefs.h"
42 #include "mdebin.h"
43 #include "update.h"
44 #include "vcm.h"
45 #include "../fileio/enxio.h"
46 #include "../fileio/mdoutf.h"
47 #include "../timing/walltime_accounting.h"
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 typedef struct gmx_global_stat *gmx_global_stat_t;
54
55 void do_pbc_first(FILE *log, matrix box, t_forcerec *fr,
56                   t_graph *graph, rvec x[]);
57
58 void do_pbc_first_mtop(FILE *fplog, int ePBC, matrix box,
59                        gmx_mtop_t *mtop, rvec x[]);
60
61 void do_pbc_mtop(FILE *fplog, int ePBC, matrix box,
62                  gmx_mtop_t *mtop, rvec x[]);
63
64
65
66 /* ROUTINES from stat.c */
67 gmx_global_stat_t global_stat_init(t_inputrec *ir);
68
69 void global_stat_destroy(gmx_global_stat_t gs);
70
71 void global_stat(FILE *log, gmx_global_stat_t gs,
72                  t_commrec *cr, gmx_enerdata_t *enerd,
73                  tensor fvir, tensor svir, rvec mu_tot,
74                  t_inputrec *inputrec,
75                  gmx_ekindata_t *ekind,
76                  gmx_constr_t constr, t_vcm *vcm,
77                  int nsig, real *sig,
78                  gmx_mtop_t *top_global, t_state *state_local,
79                  gmx_bool bSumEkinhOld, int flags);
80 /* Communicate statistics over cr->mpi_comm_mysim */
81
82 int do_per_step(gmx_int64_t step, gmx_int64_t nstep);
83 /* Return TRUE if io should be done */
84
85 /* ROUTINES from sim_util.c */
86
87 void print_time(FILE *out, gmx_walltime_accounting_t walltime_accounting,
88                 gmx_int64_t step, t_inputrec *ir, t_commrec *cr);
89
90 /*! \brief Print date, time, MPI rank and a description of this point
91  * in time.
92  *
93  * \param[in] log       logfile, or NULL to suppress output
94  * \param[in] rank      MPI rank to include in the output
95  * \param[in] title     Description to include in the output
96  * \param[in] the_time  Seconds since the epoch, e.g. as reported by gmx_gettime
97  */
98 void print_date_and_time(FILE *log, int rank, const char *title,
99                          double the_time);
100
101 void print_start(FILE *fplog, t_commrec *cr,
102                  gmx_walltime_accounting_t walltime_accounting,
103                  const char *name);
104
105 void finish_run(FILE *log, t_commrec *cr,
106                 t_inputrec *inputrec,
107                 t_nrnb nrnb[], gmx_wallcycle_t wcycle,
108                 gmx_walltime_accounting_t walltime_accounting,
109                 wallclock_gpu_t *gputimes,
110                 gmx_bool bWriteStat);
111
112 void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr);
113
114 void calc_dispcorr(FILE *fplog, t_inputrec *ir, t_forcerec *fr,
115                    gmx_int64_t step, int natoms,
116                    matrix box, real lambda, tensor pres, tensor virial,
117                    real *prescorr, real *enercorr, real *dvdlcorr);
118
119 void initialize_lambdas(FILE *fplog, t_inputrec *ir, int *fep_state, real *lambda, double *lam0);
120
121 void do_constrain_first(FILE *log, gmx_constr_t constr,
122                         t_inputrec *inputrec, t_mdatoms *md,
123                         t_state *state, t_commrec *cr, t_nrnb *nrnb,
124                         t_forcerec *fr, gmx_localtop_t *top);
125
126 void init_md(FILE *fplog,
127              t_commrec *cr, t_inputrec *ir, const output_env_t oenv,
128              double *t, double *t0,
129              real *lambda, int *fep_state, double *lam0,
130              t_nrnb *nrnb, gmx_mtop_t *mtop,
131              gmx_update_t *upd,
132              int nfile, const t_filenm fnm[],
133              gmx_mdoutf_t *outf, t_mdebin **mdebin,
134              tensor force_vir, tensor shake_vir,
135              rvec mu_tot,
136              gmx_bool *bSimAnn, t_vcm **vcm, unsigned long Flags);
137 /* Routine in sim_util.c */
138
139 #ifdef __cplusplus
140 }
141 #endif
142
143 #endif  /* _sim_util_h */