Fixing copyright issues and code contributors
[alexxy/gromacs.git] / include / types / ifunc.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  * 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.
11  *
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.
16  *
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.
21  *
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.
26  *
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.
34  *
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.
37  */
38
39
40 #ifndef _ifunc_h
41 #define _ifunc_h
42
43 #include "../visibility.h"
44 #include "idef.h"
45 #include "mdatom.h"
46 #include "fcdata.h"
47 #include "graph.h"
48 #include "pbc.h"
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54
55 typedef real t_ifunc(int nbonds,const t_iatom iatoms[],
56                      const t_iparams iparams[],
57                      const rvec x[],rvec f[],rvec fshift[],
58                      const t_pbc *pbc,const t_graph *g,
59                      real lambda,real *dvdlambda,
60                      const t_mdatoms *md,t_fcdata *fcd,
61                      int *ddgatindex);
62
63 /*
64  * The function type t_ifunc() calculates one interaction, using iatoms[] 
65  * and iparams. Within the function the number of atoms to be used is 
66  * known. Within the function only the atomid part of the iatoms[] array 
67  * is supplied, not the type field (see also t_ilist). The function 
68  * returns the potential energy. If pbc==NULL the coordinates in x are
69  * assumed to be such that no calculation of PBC is necessary,
70  * If pbc!=NULL a full PBC calculation is performed.
71  * If g!=NULL it is used for determining the shift forces.
72  * With domain decomposition ddgatindex can be used for getting global
73  * atom numbers for warnings and error messages.
74  * ddgatindex is NULL when domain decomposition is not used.
75  */
76
77 #define IF_NULL       0
78 #define IF_BOND       1
79 #define IF_VSITE      1<<1
80 #define IF_CONSTRAINT 1<<2
81 #define IF_CHEMBOND   1<<3
82 #define IF_BTYPE      1<<4
83 #define IF_ATYPE      1<<5
84 #define IF_TABULATED  1<<6
85 #define IF_LIMZERO    1<<7
86 /* These flags tell to some of the routines what can be done with this
87  * item in the list.
88  * With IF_BOND a bonded interaction will be calculated.
89  * With IF_BTYPE grompp can convert the bond to a Morse potential.
90  * With IF_BTYPE or IF_ATYPE the bond/angle can be converted to
91  * a constraint or used for vsite parameter determination by grompp.
92  * IF_LIMZERO indicates that for a bonded interaction the potential
93  * does goes to zero for large distances, thus if such an interaction
94  * it not assigned to any node by the domain decompostion, the simulation
95  * still continue, if mdrun has been told so.
96  */
97 typedef struct
98 {
99   const char *name;     /* the name of this function                    */
100   const char *longname; /* The name for printing etc.                   */
101   int     nratoms;      /* nr of atoms needed for this function         */
102   int     nrfpA,nrfpB;  /* number of parameters for this function.      */
103                         /* this corresponds to the number of params in  */
104                         /* iparams struct! (see idef.h)                 */
105   /* A and B are for normal and free energy components respectively.    */
106   unsigned long   flags;        /* Flags (see above)                            */
107   int     nrnb_ind;     /* index for nrnb (-1 if unknown)               */
108   t_ifunc *ifunc;       /* the function it self                         */
109 } t_interaction_function;
110
111 #define NRFPA(ftype) (interaction_function[(ftype)].nrfpA)
112 #define NRFPB(ftype) (interaction_function[(ftype)].nrfpB)
113 #define NRFP(ftype)  (NRFPA(ftype)+NRFPB(ftype))
114 #define NRAL(ftype) (interaction_function[(ftype)].nratoms)
115
116 #define IS_CHEMBOND(ftype) (interaction_function[(ftype)].nratoms==2 && (interaction_function[(ftype)].flags & IF_CHEMBOND))
117 /* IS_CHEMBOND tells if function type ftype represents a chemical bond */
118
119 /* IS_ANGLE tells if a function type ftype represents an angle 
120  * Per Larsson, 2007-11-06
121  */
122 #define IS_ANGLE(ftype) (interaction_function[(ftype)].nratoms==3 && (interaction_function[(ftype)].flags & IF_ATYPE))
123 #define IS_VSITE(ftype) (interaction_function[(ftype)].flags & IF_VSITE)
124
125 #define IS_TABULATED(ftype) (interaction_function[(ftype)].flags & IF_TABULATED)
126
127 GMX_LIBGMX_EXPORT
128 extern const t_interaction_function interaction_function[F_NRE];
129 /* initialised interaction functions descriptor                         */
130
131 #ifdef __cplusplus
132 }
133 #endif
134
135
136 #endif