9d40a3fa921de8409fb8c5a8e36369847848d955
[alexxy/gromacs.git] / include / bondf.h
1 /*
2  * 
3  *                This source code is part of
4  * 
5  *                 G   R   O   M   A   C   S
6  * 
7  *          GROningen MAchine for Chemical Simulations
8  * 
9  *                        VERSION 3.2.0
10  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
11  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
12  * Copyright (c) 2001-2004, The GROMACS development team,
13  * check out http://www.gromacs.org for more information.
14
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  * 
20  * If you want to redistribute modifications, please consider that
21  * scientific software is very special. Version control is crucial -
22  * bugs must be traceable. We will be happy to consider code for
23  * inclusion in the official distribution, but derived work must not
24  * be called official GROMACS. Details are found in the README & COPYING
25  * files - if they are missing, get the official version at www.gromacs.org.
26  * 
27  * To help us fund GROMACS development, we humbly ask that you cite
28  * the papers on the package - you can find them in the top README file.
29  * 
30  * For more info, check our website at http://www.gromacs.org
31  * 
32  * And Hey:
33  * Gromacs Runs On Most of All Computer Systems
34  */
35
36 #ifndef _bondf_h
37 #define _bondf_h
38
39
40 #include <stdio.h>
41 #include "typedefs.h"
42 #include "nrnb.h"
43 #include "pbc.h"
44 #include "genborn.h"
45
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49
50 int glatnr(int *global_atom_index,int i);
51 /* Returns the global topology atom number belonging to local atom index i.
52  * This function is intended for writing ascii output
53  * and returns atom numbers starting at 1.
54  * When global_atom_index=NULL returns i+1.
55  */
56
57 void calc_bonds(FILE *fplog,const gmx_multisim_t *ms,
58                 const t_idef *idef,
59                 rvec x[],history_t *hist,
60                 rvec f[],t_forcerec *fr,
61                 const t_pbc *pbc,const t_graph *g,
62                 gmx_enerdata_t *enerd,t_nrnb *nrnb,real lambda,
63                 const t_mdatoms *md,
64                 t_fcdata *fcd,int *ddgatindex,
65                 t_atomtypes *atype, gmx_genborn_t *born,
66                 gmx_bool bPrintSepPot,gmx_large_int_t step);
67 /* 
68  * The function calc_bonds() calculates all bonded force interactions.
69  * The "bonds" are specified as follows:
70  *   int nbonds
71  *          the total number of bonded interactions.
72  *   t_iatom *forceatoms
73  *     specifies which atoms are involved in a bond of a certain 
74  *     type, see also struct t_idef.
75  *   t_functype *functype
76  *          defines for every bonded force type what type of function to 
77  *     use, see also struct t_idef.
78  *   t_iparams *forceparams
79  *          defines the parameters for every bond type, see also struct 
80  *     t_idef.
81  *   real epot[NR_F]
82  *     total potential energy split up over the function types.
83  *   int *ddgatindex
84  *     global atom number indices, should be NULL when not using DD.
85  *   gmx_bool bPrintSepPot
86  *     if TRUE print local potential and dVdlambda for each bonded type.
87  *   int step
88  *     used with bPrintSepPot
89  *   return value:
90  *          the total potential energy (sum over epot).
91  */
92
93 void calc_bonds_lambda(FILE *fplog,
94                               const t_idef *idef,
95                               rvec x[],
96                               t_forcerec *fr,
97                               const t_pbc *pbc,const t_graph *g,
98                               gmx_enerdata_t *enerd,t_nrnb *nrnb,
99                               real lambda,
100                               const t_mdatoms *md,
101                               t_fcdata *fcd,int *global_atom_index);
102 /* As calc_bonds, but only determines the potential energy
103  * for the perturbed interactions.
104  * The shift forces in fr are not affected.
105  */
106
107 real posres(int nbonds,
108                    const t_iatom forceatoms[],const t_iparams forceparams[],
109                    const rvec x[],rvec f[],rvec vir_diag,
110                    t_pbc *pbc,
111                    real lambda,real *dvdlambda,
112                    int refcoord_scaling,int ePBC,rvec comA,rvec comB);
113 /* Position restraints require a different pbc treatment from other bondeds */
114
115 real bond_angle(const rvec xi,const rvec xj,const rvec xk,
116                        const t_pbc *pbc,
117                        rvec r_ij,rvec r_kj,real *costh,
118                        int *t1,int *t2);        /* out */
119 /* Calculate bond-angle. No PBC is taken into account (use mol-shift) */
120
121 real dih_angle(const rvec xi,const rvec xj,const rvec xk,const rvec xl,
122                       const t_pbc *pbc,
123                       rvec r_ij,rvec r_kj,rvec r_kl,rvec m,rvec n, /* out */
124                       real *sign,
125                       int *t1,int *t2,int *t3);
126 /* Calculate dihedral-angle. No PBC is taken into account (use mol-shift) */
127
128 void do_dih_fup(int i,int j,int k,int l,real ddphi,
129                        rvec r_ij,rvec r_kj,rvec r_kl,
130                        rvec m,rvec n,rvec f[],rvec fshift[],
131                        const t_pbc *pbc,const t_graph *g,
132                        const rvec *x,int t1,int t2,int t3);
133 /* Do an update of the forces for dihedral potentials */
134
135 /*************************************************************************
136  *
137  *  Bonded force functions
138  *
139  *************************************************************************/
140   t_ifunc bonds,g96bonds,morse_bonds,cubic_bonds,FENE_bonds,restraint_bonds;
141   t_ifunc angles,g96angles,cross_bond_bond,cross_bond_angle,urey_bradley,quartic_angles;
142   t_ifunc pdihs,idihs,rbdihs;
143   t_ifunc tab_bonds,tab_angles,tab_dihs;
144   t_ifunc polarize,water_pol,thole_pol,angres,angresz,unimplemented;
145
146 #ifdef __cplusplus
147 }
148 #endif
149
150 #endif  /* _bondf_h */