Removed include of types/ifunc.h from typedefs.h
[gromacs.git] / src / gromacs / legacyheaders / force.h
blob647171e908c80e8ad39adeb78033046623f9f3e9
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, 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.
38 #ifndef _force_h
39 #define _force_h
41 #include "gromacs/legacyheaders/genborn.h"
42 #include "gromacs/legacyheaders/network.h"
43 #include "gromacs/legacyheaders/tgroup.h"
44 #include "gromacs/legacyheaders/typedefs.h"
45 #include "gromacs/legacyheaders/vsite.h"
46 #include "gromacs/legacyheaders/types/fcdata.h"
47 #include "gromacs/legacyheaders/types/force_flags.h"
48 #include "gromacs/timing/wallcycle.h"
50 struct t_commrec;
51 struct t_fcdata;
52 struct t_graph;
53 struct t_pbc;
54 struct gmx_edsam;
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
60 void calc_vir(int nxf, rvec x[], rvec f[], tensor vir,
61 gmx_bool bScrewPBC, matrix box);
62 /* Calculate virial for nxf atoms, and add it to vir */
64 void f_calc_vir(int i0, int i1, rvec x[], rvec f[], tensor vir,
65 struct t_graph *g, rvec shift_vec[]);
66 /* Calculate virial taking periodicity into account */
68 real RF_excl_correction(const t_forcerec *fr, struct t_graph *g,
69 const t_mdatoms *mdatoms, const t_blocka *excl,
70 rvec x[], rvec f[], rvec *fshift, const struct t_pbc *pbc,
71 real lambda, real *dvdlambda);
72 /* Calculate the reaction-field energy correction for this node:
73 * epsfac q_i q_j (k_rf r_ij^2 - c_rf)
74 * and force correction for all excluded pairs, including self pairs.
77 void calc_rffac(FILE *fplog, int eel, real eps_r, real eps_rf,
78 real Rc, real Temp,
79 real zsq, matrix box,
80 real *kappa, real *krf, real *crf);
81 /* Determine the reaction-field constants */
83 void init_generalized_rf(FILE *fplog,
84 const gmx_mtop_t *mtop, const t_inputrec *ir,
85 t_forcerec *fr);
86 /* Initialize the generalized reaction field parameters */
89 /* In wall.c */
90 void make_wall_tables(FILE *fplog, const output_env_t oenv,
91 const t_inputrec *ir, const char *tabfn,
92 const gmx_groups_t *groups,
93 t_forcerec *fr);
95 real do_walls(t_inputrec *ir, t_forcerec *fr, matrix box, t_mdatoms *md,
96 rvec x[], rvec f[], real lambda, real Vlj[], t_nrnb *nrnb);
98 #define GMX_MAKETABLES_FORCEUSER (1<<0)
99 #define GMX_MAKETABLES_14ONLY (1<<1)
101 t_forcetable make_tables(FILE *fp, const output_env_t oenv,
102 const t_forcerec *fr, gmx_bool bVerbose,
103 const char *fn, real rtab, int flags);
104 /* Return tables for inner loops. When bVerbose the tables are printed
105 * to .xvg files
108 bondedtable_t make_bonded_table(FILE *fplog, char *fn, int angle);
109 /* Fill a table for bonded interactions,
110 * angle should be: bonds 0, angles 1, dihedrals 2
113 /* Return a table for GB calculations */
114 t_forcetable make_gb_table(const output_env_t oenv,
115 const t_forcerec *fr);
117 /* Read a table for AdResS Thermo Force calculations */
118 t_forcetable make_atf_table(FILE *out, const output_env_t oenv,
119 const t_forcerec *fr,
120 const char *fn,
121 matrix box);
123 gmx_bool can_use_allvsall(const t_inputrec *ir,
124 gmx_bool bPrintNote, struct t_commrec *cr, FILE *fp);
125 /* Returns if we can use all-vs-all loops.
126 * If bPrintNote==TRUE, prints a note, if necessary, to stderr
127 * and fp (if !=NULL) on the master node.
131 gmx_bool nbnxn_acceleration_supported(FILE *fplog,
132 const struct t_commrec *cr,
133 const t_inputrec *ir,
134 gmx_bool bGPU);
135 /* Return if GPU/CPU-SIMD acceleration is supported with the given inputrec
136 * with bGPU TRUE/FALSE.
137 * If the return value is FALSE and fplog/cr != NULL, prints a fallback
138 * message to fplog/stderr.
141 gmx_bool uses_simple_tables(int cutoff_scheme,
142 struct nonbonded_verlet_t *nbv,
143 int group);
144 /* Returns whether simple tables (i.e. not for use with GPUs) are used
145 * with the type of kernel indicated.
148 void init_enerdata(int ngener, int n_lambda, gmx_enerdata_t *enerd);
149 /* Intializes the energy storage struct */
151 void destroy_enerdata(gmx_enerdata_t *enerd);
152 /* Free all memory associated with enerd */
154 void reset_foreign_enerdata(gmx_enerdata_t *enerd);
155 /* Resets only the foreign energy data */
157 void reset_enerdata(t_forcerec *fr, gmx_bool bNS,
158 gmx_enerdata_t *enerd,
159 gmx_bool bMaster);
160 /* Resets the energy data, if bNS=TRUE also zeros the long-range part */
162 void sum_epot(gmx_grppairener_t *grpp, real *epot);
163 /* Locally sum the non-bonded potential energy terms */
165 void sum_dhdl(gmx_enerdata_t *enerd, real *lambda, t_lambda *fepvals);
166 /* Sum the free energy contributions */
168 /* Compute the average C6 and C12 params for LJ corrections */
169 void set_avcsixtwelve(FILE *fplog, t_forcerec *fr,
170 const gmx_mtop_t *mtop);
172 extern void do_force(FILE *log, struct t_commrec *cr,
173 t_inputrec *inputrec,
174 gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
175 gmx_localtop_t *top,
176 gmx_groups_t *groups,
177 matrix box, rvec x[], history_t *hist,
178 rvec f[],
179 tensor vir_force,
180 t_mdatoms *mdatoms,
181 gmx_enerdata_t *enerd, struct t_fcdata *fcd,
182 real *lambda, struct t_graph *graph,
183 t_forcerec *fr,
184 gmx_vsite_t *vsite, rvec mu_tot,
185 double t, FILE *field, struct gmx_edsam *ed,
186 gmx_bool bBornRadii,
187 int flags);
189 /* Communicate coordinates (if parallel).
190 * Do neighbor searching (if necessary).
191 * Calculate forces.
192 * Communicate forces (if parallel).
193 * Spread forces for vsites (if present).
195 * f is always required.
198 void ns(FILE *fplog,
199 t_forcerec *fr,
200 matrix box,
201 gmx_groups_t *groups,
202 gmx_localtop_t *top,
203 t_mdatoms *md,
204 struct t_commrec *cr,
205 t_nrnb *nrnb,
206 gmx_bool bFillGrid,
207 gmx_bool bDoLongRangeNS);
208 /* Call the neighborsearcher */
210 extern void do_force_lowlevel(t_forcerec *fr,
211 t_inputrec *ir,
212 t_idef *idef,
213 struct t_commrec *cr,
214 t_nrnb *nrnb,
215 gmx_wallcycle_t wcycle,
216 t_mdatoms *md,
217 rvec x[],
218 history_t *hist,
219 rvec f_shortrange[],
220 rvec f_longrange[],
221 gmx_enerdata_t *enerd,
222 struct t_fcdata *fcd,
223 gmx_localtop_t *top,
224 gmx_genborn_t *born,
225 gmx_bool bBornRadii,
226 matrix box,
227 t_lambda *fepvals,
228 real *lambda,
229 struct t_graph *graph,
230 t_blocka *excl,
231 rvec mu_tot[2],
232 int flags,
233 float *cycles_pme);
234 /* Call all the force routines */
236 void free_gpu_resources(const t_forcerec *fr,
237 const struct t_commrec *cr,
238 const struct gmx_gpu_info_t *gpu_info,
239 const gmx_gpu_opt_t *gpu_opt);
241 #ifdef __cplusplus
243 #endif
245 #endif /* _force_h */