Move main.*, splitter.*, gmx_omp_nthreads.* to mdlib
[gromacs.git] / src / gromacs / mdlib / genborn.h
blobb68f0db51558aefadfeb7c1afdd277000e96b1f0
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-2008, 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.
37 #ifndef GMX_MDLIB_GENBORN_H
38 #define GMX_MDLIB_GENBORN_H
40 #include "gromacs/math/vectypes.h"
42 struct gmx_genborn_t;
43 struct gmx_enerdata_t;
44 struct gmx_localtop_t;
45 struct gmx_mtop_t;
46 struct t_commrec;
47 struct t_forcerec;
48 struct t_graph;
49 struct t_idef;
50 struct t_inputrec;
51 struct t_mdatoms;
52 struct t_nblist;
53 struct t_nrnb;
54 struct t_pbc;
56 typedef struct
58 int nbonds;
59 int bond[10];
60 real length[10];
61 } genborn_bonds_t;
63 typedef struct gbtmpnbls *gbtmpnbls_t;
65 /* Struct to hold all the information for GB */
66 typedef struct gmx_genborn_t
68 int nr; /* number of atoms, length of arrays below */
69 int n12; /* number of 1-2 (bond) interactions */
70 int n13; /* number of 1-3 (angle) terms */
71 int n14; /* number of 1-4 (torsion) terms */
72 int nalloc; /* Allocation of local arrays (with DD) */
75 /* Arrays below that end with _globalindex are used for setting up initial values of
76 * all gb parameters and values. They all have length natoms, which for DD is the
77 * global atom number.
78 * Values are then taken from these arrays to local copies, that have names without
79 * _globalindex, in the routine make_local_gb(), which is called once for single
80 * node runs, and for DD at every call to dd_partition_system
83 real *gpol; /* Atomic polarisation energies */
84 real *gpol_globalindex; /* */
85 real *gpol_still_work; /* Work array for Still model */
86 real *gpol_hct_work; /* Work array for HCT/OBC models */
87 real *bRad; /* Atomic Born radii */
88 real *vsolv; /* Atomic solvation volumes */
89 real *vsolv_globalindex; /* */
90 real *gb_radius; /* Radius info, copied from atomtypes */
91 real *gb_radius_globalindex;
93 int *use; /* Array that till if this atom does GB */
94 int *use_globalindex; /* Global array for parallelization */
96 real es; /* Solvation energy and derivatives */
97 real *asurf; /* Atomic surface area */
98 rvec *dasurf; /* Surface area derivatives */
99 real as; /* Total surface area */
101 real *drobc; /* Parameters for OBC chain rule calculation */
102 real *param; /* Precomputed factor rai*atype->S_hct for HCT/OBC */
103 real *param_globalindex; /* */
105 real *log_table; /* Table for logarithm lookup */
107 real obc_alpha; /* OBC parameters */
108 real obc_beta; /* OBC parameters */
109 real obc_gamma; /* OBC parameters */
110 real gb_doffset; /* Dielectric offset for Still/HCT/OBC */
111 real gb_epsilon_solvent; /* */
112 real epsilon_r; /* Used for inner dielectric */
114 real sa_surface_tension; /* Surface tension for non-polar solvation */
116 real *work; /* Used for parallel summation and in the chain rule, length natoms */
117 real *buf; /* Used for parallel summation and in the chain rule, length natoms */
118 int *count; /* Used for setting up the special gb nblist, length natoms */
119 gbtmpnbls_t nblist_work; /* Used for setting up the special gb nblist, dim natoms*nblist_work_nalloc */
120 int nblist_work_nalloc; /* Length of second dimension of nblist_work */
122 gmx_genborn_t;
123 /* Still parameters - make sure to edit in genborn_sse.c too if you change these! */
124 #define STILL_P1 0.073*0.1 /* length */
125 #define STILL_P2 0.921*0.1*CAL2JOULE /* energy*length */
126 #define STILL_P3 6.211*0.1*CAL2JOULE /* energy*length */
127 #define STILL_P4 15.236*0.1*CAL2JOULE
128 #define STILL_P5 1.254
130 #define STILL_P5INV (1.0/STILL_P5)
131 #define STILL_PIP5 (M_PI*STILL_P5)
134 /* Initialise GB stuff */
135 int init_gb(struct gmx_genborn_t **p_born,
136 struct t_forcerec *fr, const struct t_inputrec *ir,
137 const gmx_mtop_t *mtop, int gb_algorithm);
140 /* Born radii calculations, both with and without SSE acceleration */
141 int calc_gb_rad(struct t_commrec *cr, struct t_forcerec *fr, struct t_inputrec *ir, gmx_localtop_t *top, rvec x[], t_nblist *nl, struct gmx_genborn_t *born, t_mdatoms *md, t_nrnb *nrnb);
145 /* Bonded GB interactions */
146 real gb_bonds_tab(rvec x[], rvec f[], rvec fshift[], real *charge, real *p_gbtabscale,
147 real *invsqrta, real *dvda, real *GBtab, t_idef *idef, real epsilon_r,
148 real gb_epsilon_solvent, real facel, const struct t_pbc *pbc,
149 const struct t_graph *graph);
154 /* Functions for calculating adjustments due to ie chain rule terms */
155 void
156 calc_gb_forces(struct t_commrec *cr, t_mdatoms *md, struct gmx_genborn_t *born, gmx_localtop_t *top,
157 rvec x[], rvec f[], struct t_forcerec *fr, t_idef *idef, int gb_algorithm, int sa_algorithm, t_nrnb *nrnb,
158 const struct t_pbc *pbc, const struct t_graph *graph, struct gmx_enerdata_t *enerd);
162 make_gb_nblist(struct t_commrec *cr, int gb_algorithm,
163 rvec x[], matrix box,
164 struct t_forcerec *fr, t_idef *idef, struct t_graph *graph, struct gmx_genborn_t *born);
166 void
167 make_local_gb(const struct t_commrec *cr, struct gmx_genborn_t *born, int gb_algorithm);
169 #endif