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 * 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.
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.
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.
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.
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.
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.
42 #include "visibility.h"
44 #include "types/force_flags.h"
56 static const char *sepdvdlformat = " %-30s V %12.5e dVdl %12.5e\n";
58 void calc_vir(FILE *fplog, int nxf, rvec x[], rvec f[], tensor vir,
59 gmx_bool bScrewPBC, matrix box);
60 /* Calculate virial for nxf atoms, and add it to vir */
62 void f_calc_vir(FILE *fplog, int i0, int i1, rvec x[], rvec f[], tensor vir,
63 t_graph *g, rvec shift_vec[]);
64 /* Calculate virial taking periodicity into account */
66 real RF_excl_correction(FILE *fplog,
67 const t_forcerec *fr, t_graph *g,
68 const t_mdatoms *mdatoms, const t_blocka *excl,
69 rvec x[], rvec f[], rvec *fshift, const t_pbc *pbc,
70 real lambda, real *dvdlambda);
71 /* Calculate the reaction-field energy correction for this node:
72 * epsfac q_i q_j (k_rf r_ij^2 - c_rf)
73 * and force correction for all excluded pairs, including self pairs.
76 void calc_rffac(FILE *fplog, int eel, real eps_r, real eps_rf,
79 real *kappa, real *krf, real *crf);
80 /* Determine the reaction-field constants */
82 void init_generalized_rf(FILE *fplog,
83 const gmx_mtop_t *mtop, const t_inputrec *ir,
85 /* Initialize the generalized reaction field parameters */
89 void make_wall_tables(FILE *fplog, const output_env_t oenv,
90 const t_inputrec *ir, const char *tabfn,
91 const gmx_groups_t *groups,
94 real do_walls(t_inputrec *ir, t_forcerec *fr, matrix box, t_mdatoms *md,
95 rvec x[], rvec f[], real lambda, real Vlj[], t_nrnb *nrnb);
98 t_forcerec *mk_forcerec(void);
100 #define GMX_MAKETABLES_FORCEUSER (1<<0)
101 #define GMX_MAKETABLES_14ONLY (1<<1)
103 t_forcetable make_tables(FILE *fp, const output_env_t oenv,
104 const t_forcerec *fr, gmx_bool bVerbose,
105 const char *fn, real rtab, int flags);
106 /* Return tables for inner loops. When bVerbose the tables are printed
110 bondedtable_t make_bonded_table(FILE *fplog, char *fn, int angle);
111 /* Return a table for bonded interactions,
112 * angle should be: bonds 0, angles 1, dihedrals 2
115 /* Return a table for GB calculations */
116 t_forcetable make_gb_table(FILE *out, const output_env_t oenv,
117 const t_forcerec *fr,
121 /* Read a table for AdResS Thermo Force calculations */
122 extern t_forcetable make_atf_table(FILE *out, const output_env_t oenv,
123 const t_forcerec *fr,
128 void pr_forcerec(FILE *fplog, t_forcerec *fr, t_commrec *cr);
131 forcerec_set_ranges(t_forcerec *fr,
132 int ncg_home, int ncg_force,
134 int natoms_force_constr, int natoms_f_novirsum);
135 /* Set the number of cg's and atoms for the force calculation */
138 gmx_bool can_use_allvsall(const t_inputrec *ir, const gmx_mtop_t *mtop,
139 gmx_bool bPrintNote, t_commrec *cr, FILE *fp);
140 /* Returns if we can use all-vs-all loops.
141 * If bPrintNote==TRUE, prints a note, if necessary, to stderr
142 * and fp (if !=NULL) on the master node.
146 gmx_bool uses_simple_tables(int cutoff_scheme,
147 nonbonded_verlet_t *nbv,
149 /* Returns whether simple tables (i.e. not for use with GPUs) are used
150 * with the type of kernel indicated.
154 void init_interaction_const_tables(FILE *fp,
155 interaction_const_t *ic,
156 gmx_bool bSimpleTable,
158 /* Initializes the tables in the interaction constant data structure.
159 * Setting verlet_kernel_type to -1 always initializes tables for
160 * use with group kernels.
164 void init_forcerec(FILE *fplog,
165 const output_env_t oenv,
168 const t_inputrec *ir,
169 const gmx_mtop_t *mtop,
177 const char *nbpu_opt,
180 /* The Force rec struct must be created with mk_forcerec
181 * The gmx_booleans have the following meaning:
182 * bSetQ: Copy the charges [ only necessary when they change ]
183 * bMolEpot: Use the free energy stuff per molecule
184 * print_force >= 0: print forces for atoms with force >= print_force
188 void forcerec_set_excl_load(t_forcerec *fr,
189 const gmx_localtop_t *top, const t_commrec *cr);
190 /* Set the exclusion load for the local exclusions and possibly threads */
193 void init_enerdata(int ngener, int n_lambda, gmx_enerdata_t *enerd);
194 /* Intializes the energy storage struct */
196 void destroy_enerdata(gmx_enerdata_t *enerd);
197 /* Free all memory associated with enerd */
199 void reset_foreign_enerdata(gmx_enerdata_t *enerd);
200 /* Resets only the foreign energy data */
202 void reset_enerdata(t_grpopts *opts,
203 t_forcerec *fr, gmx_bool bNS,
204 gmx_enerdata_t *enerd,
206 /* Resets the energy data, if bNS=TRUE also zeros the long-range part */
208 void sum_epot(t_grpopts *opts, gmx_grppairener_t *grpp, real *epot);
209 /* Locally sum the non-bonded potential energy terms */
212 void sum_dhdl(gmx_enerdata_t *enerd, real *lambda, t_lambda *fepvals);
213 /* Sum the free energy contributions */
215 void update_forcerec(FILE *fplog, t_forcerec *fr, matrix box);
216 /* Updates parameters in the forcerec that are time dependent */
218 /* Compute the average C6 and C12 params for LJ corrections */
219 void set_avcsixtwelve(FILE *fplog, t_forcerec *fr,
220 const gmx_mtop_t *mtop);
223 extern void do_force(FILE *log, t_commrec *cr,
224 t_inputrec *inputrec,
225 gmx_large_int_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
228 gmx_groups_t *groups,
229 matrix box, rvec x[], history_t *hist,
233 gmx_enerdata_t *enerd, t_fcdata *fcd,
234 real *lambda, t_graph *graph,
236 gmx_vsite_t *vsite, rvec mu_tot,
237 double t, FILE *field, gmx_edsam_t ed,
241 /* Communicate coordinates (if parallel).
242 * Do neighbor searching (if necessary).
244 * Communicate forces (if parallel).
245 * Spread forces for vsites (if present).
247 * f is always required.
255 gmx_groups_t *groups,
263 gmx_grppairener_t *grppener,
265 gmx_bool bDoLongRangeNS);
266 /* Call the neighborsearcher */
268 extern void do_force_lowlevel(FILE *fplog,
269 gmx_large_int_t step,
275 gmx_wallcycle_t wcycle,
282 gmx_enerdata_t *enerd,
297 /* Call all the force routines */
303 #endif /* _force_h */