PME GPU/CUDA data framework.
[gromacs.git] / src / gromacs / mdlib / sim_util.h
blob310e9859b5ab714e5893d3c59534a9f7a8f77528
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2004, The GROMACS development team.
6 * Copyright (c) 2013,2014,2015,2016,2017, 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.
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.
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.
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.
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.
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.
37 #ifndef GMX_MDLIB_SIM_UTIL_H
38 #define GMX_MDLIB_SIM_UTIL_H
40 #include "gromacs/fileio/enxio.h"
41 #include "gromacs/mdlib/mdebin.h"
42 #include "gromacs/mdlib/mdoutf.h"
43 #include "gromacs/mdlib/vcm.h"
44 #include "gromacs/timing/wallcycle.h"
45 #include "gromacs/timing/walltime_accounting.h"
46 #include "gromacs/utility/arrayref.h"
48 struct gmx_constr;
49 struct gmx_localtop_t;
50 struct gmx_output_env_t;
51 struct gmx_update_t;
52 struct MdrunOptions;
53 struct nonbonded_verlet_t;
54 struct t_mdatoms;
55 struct t_nrnb;
57 namespace gmx
59 class IMDOutputProvider;
60 class MDLogger;
63 typedef struct gmx_global_stat *gmx_global_stat_t;
65 void do_pbc_first_mtop(FILE *fplog, int ePBC, const matrix box,
66 const gmx_mtop_t *mtop, rvec x[]);
68 void do_pbc_mtop(FILE *fplog, int ePBC, const matrix box,
69 const gmx_mtop_t *mtop, rvec x[]);
71 /*! \brief Parallellizes put_atoms_in_box()
73 * This wrapper function around put_atoms_in_box() with the ugly manual
74 * workload splitting is needed to avoid silently introducing multithreading
75 * in tools.
76 * \param[in] ePBC The pbc type
77 * \param[in] box The simulation box
78 * \param[in] natoms The number of atoms
79 * \param[inout] x The coordinates of the atoms
81 void put_atoms_in_box_omp(int ePBC, const matrix box, int natoms, rvec x[]);
85 /* ROUTINES from stat.c */
86 gmx_global_stat_t global_stat_init(t_inputrec *ir);
88 void global_stat_destroy(gmx_global_stat_t gs);
90 void global_stat(gmx_global_stat_t gs,
91 t_commrec *cr, gmx_enerdata_t *enerd,
92 tensor fvir, tensor svir, rvec mu_tot,
93 t_inputrec *inputrec,
94 gmx_ekindata_t *ekind,
95 gmx_constr *constr, t_vcm *vcm,
96 int nsig, real *sig,
97 int *totalNumberOfBondedInteractions,
98 gmx_bool bSumEkinhOld, int flags);
99 /* All-reduce energy-like quantities over cr->mpi_comm_mysim */
101 int do_per_step(gmx_int64_t step, gmx_int64_t nstep);
102 /* Return TRUE if io should be done */
104 /* ROUTINES from sim_util.c */
106 void print_time(FILE *out, gmx_walltime_accounting_t walltime_accounting,
107 gmx_int64_t step, t_inputrec *ir, t_commrec *cr);
109 /*! \brief Print date, time, MPI rank and a description of this point
110 * in time.
112 * \param[in] log logfile, or NULL to suppress output
113 * \param[in] rank MPI rank to include in the output
114 * \param[in] title Description to include in the output
115 * \param[in] the_time Seconds since the epoch, e.g. as reported by gmx_gettime
117 void print_date_and_time(FILE *log, int rank, const char *title,
118 double the_time);
120 void print_start(FILE *fplog, t_commrec *cr,
121 gmx_walltime_accounting_t walltime_accounting,
122 const char *name);
124 void finish_run(FILE *log, const gmx::MDLogger &mdlog, t_commrec *cr,
125 const t_inputrec *inputrec,
126 t_nrnb nrnb[], gmx_wallcycle_t wcycle,
127 gmx_walltime_accounting_t walltime_accounting,
128 nonbonded_verlet_t *nbv,
129 gmx_pme_t *pme,
130 gmx_bool bWriteStat);
132 void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr);
134 void calc_dispcorr(t_inputrec *ir, t_forcerec *fr,
135 matrix box, real lambda, tensor pres, tensor virial,
136 real *prescorr, real *enercorr, real *dvdlcorr);
138 void initialize_lambdas(FILE *fplog, t_inputrec *ir, int *fep_state, gmx::ArrayRef<real> lambda, double *lam0);
140 void do_constrain_first(FILE *log, gmx_constr *constr,
141 t_inputrec *inputrec, t_mdatoms *md,
142 t_state *state, t_commrec *cr, t_nrnb *nrnb,
143 t_forcerec *fr, gmx_localtop_t *top);
145 void init_md(FILE *fplog,
146 t_commrec *cr, gmx::IMDOutputProvider *outputProvider,
147 t_inputrec *ir, const gmx_output_env_t *oenv,
148 const MdrunOptions &mdrunOptions,
149 double *t, double *t0,
150 t_state *globalState, double *lam0,
151 t_nrnb *nrnb, gmx_mtop_t *mtop,
152 gmx_update_t **upd,
153 int nfile, const t_filenm fnm[],
154 gmx_mdoutf_t *outf, t_mdebin **mdebin,
155 tensor force_vir, tensor shake_vir,
156 rvec mu_tot,
157 gmx_bool *bSimAnn, t_vcm **vcm,
158 gmx_wallcycle_t wcycle);
159 /* Routine in sim_util.c */
161 gmx_bool use_GPU(const nonbonded_verlet_t *nbv);
163 #endif