Valgrind suppression for OS X 10.9
[alexxy/gromacs.git] / src / gromacs / legacyheaders / bondf.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 _bondf_h
39 #define _bondf_h
40
41
42 #include <stdio.h>
43 #include "typedefs.h"
44 #include "nrnb.h"
45 #include "pbc.h"
46 #include "genborn.h"
47
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51
52 int glatnr(int *global_atom_index, int i);
53 /* Returns the global topology atom number belonging to local atom index i.
54  * This function is intended for writing ascii output
55  * and returns atom numbers starting at 1.
56  * When global_atom_index=NULL returns i+1.
57  */
58
59 void calc_bonds(FILE *fplog, const gmx_multisim_t *ms,
60                 const t_idef *idef,
61                 rvec x[], history_t *hist,
62                 rvec f[], t_forcerec *fr,
63                 const t_pbc *pbc, const t_graph *g,
64                 gmx_enerdata_t *enerd, t_nrnb *nrnb, real *lambda,
65                 const t_mdatoms *md,
66                 t_fcdata *fcd, int *ddgatindex,
67                 t_atomtypes *atype, gmx_genborn_t *born,
68                 int force_flags,
69                 gmx_bool bPrintSepPot, gmx_int64_t step);
70 /*
71  * The function calc_bonds() calculates all bonded force interactions.
72  * The "bonds" are specified as follows:
73  *   int nbonds
74  *          the total number of bonded interactions.
75  *   t_iatom *forceatoms
76  *     specifies which atoms are involved in a bond of a certain
77  *     type, see also struct t_idef.
78  *   t_functype *functype
79  *          defines for every bonded force type what type of function to
80  *     use, see also struct t_idef.
81  *   t_iparams *forceparams
82  *          defines the parameters for every bond type, see also struct
83  *     t_idef.
84  *   real epot[NR_F]
85  *     total potential energy split up over the function types.
86  *   int *ddgatindex
87  *     global atom number indices, should be NULL when not using DD.
88  *   gmx_bool bPrintSepPot
89  *     if TRUE print local potential and dVdlambda for each bonded type.
90  *   int step
91  *     used with bPrintSepPot
92  *   return value:
93  *          the total potential energy (sum over epot).
94  */
95
96 void calc_bonds_lambda(FILE *fplog,
97                        const t_idef *idef,
98                        rvec x[],
99                        t_forcerec *fr,
100                        const t_pbc *pbc, const t_graph *g,
101                        gmx_grppairener_t *grpp, real *epot, t_nrnb *nrnb,
102                        real *lambda,
103                        const t_mdatoms *md,
104                        t_fcdata *fcd, int *global_atom_index);
105 /* As calc_bonds, but only determines the potential energy
106  * for the perturbed interactions.
107  * The shift forces in fr are not affected.
108  */
109
110 real posres(int nbonds,
111             const t_iatom forceatoms[], const t_iparams forceparams[],
112             const rvec x[], rvec f[], rvec vir_diag,
113             t_pbc *pbc,
114             real lambda, real *dvdlambda,
115             int refcoord_scaling, int ePBC, rvec comA, rvec comB);
116 /* Position restraints require a different pbc treatment from other bondeds */
117
118 real fbposres(int nbonds,
119               const t_iatom forceatoms[], const t_iparams forceparams[],
120               const rvec x[], rvec f[], rvec vir_diag,
121               t_pbc *pbc, int refcoord_scaling, int ePBC, rvec com);
122 /* Flat-bottom posres. Same PBC treatment as in normal position restraints */
123
124 real bond_angle(const rvec xi, const rvec xj, const rvec xk,
125                 const t_pbc *pbc,
126                 rvec r_ij, rvec r_kj, real *costh,
127                 int *t1, int *t2);  /* out */
128 /* Calculate bond-angle. No PBC is taken into account (use mol-shift) */
129
130 real dih_angle(const rvec xi, const rvec xj, const rvec xk, const rvec xl,
131                const t_pbc *pbc,
132                rvec r_ij, rvec r_kj, rvec r_kl, rvec m, rvec n, /* out */
133                real *sign,
134                int *t1, int *t2, int *t3);
135 /* Calculate dihedral-angle. No PBC is taken into account (use mol-shift) */
136
137 void do_dih_fup(int i, int j, int k, int l, real ddphi,
138                 rvec r_ij, rvec r_kj, rvec r_kl,
139                 rvec m, rvec n, rvec f[], rvec fshift[],
140                 const t_pbc *pbc, const t_graph *g,
141                 const rvec *x, int t1, int t2, int t3);
142 /* Do an update of the forces for dihedral potentials */
143
144 void make_dp_periodic(real *dp);
145 /* make a dihedral fall in the range (-pi,pi) */
146
147 /*************************************************************************
148  *
149  *  Bonded force functions
150  *
151  *************************************************************************/
152 t_ifunc bonds, g96bonds, morse_bonds, cubic_bonds, FENE_bonds, restraint_bonds;
153 t_ifunc angles, g96angles, cross_bond_bond, cross_bond_angle, urey_bradley, quartic_angles, linear_angles;
154 t_ifunc restrangles;
155 t_ifunc pdihs, idihs, rbdihs;
156 t_ifunc restrdihs, cbtdihs;
157 t_ifunc tab_bonds, tab_angles, tab_dihs;
158 t_ifunc polarize, anharm_polarize, water_pol, thole_pol, angres, angresz, dihres, unimplemented;
159
160
161 /* Divided the bonded interactions over the threads, count=fr->nthreads
162  * and set up the bonded thread-force buffer reduction.
163  * This should be called each time the bonded setup changes;
164  * i.e. at start-up without domain decomposition and at DD.
165  */
166 void setup_bonded_threading(t_forcerec *fr, t_idef *idef);
167
168 #ifdef __cplusplus
169 }
170 #endif
171
172 #endif  /* _bondf_h */