a8b86681d59a29d3974f0ce849fc569189a4907e
[alexxy/gromacs.git] / include / types / ifunc.h
1 /*
2  * $Id$
3  * 
4  *       This source code is part of
5  * 
6  *        G   R   O   M   A   C   S
7  * 
8  * GROningen MAchine for Chemical Simulations
9  * 
10  *               VERSION 2.0
11  * 
12  * Copyright (c) 1991-1999
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * Please refer to:
17  * GROMACS: A message-passing parallel molecular dynamics implementation
18  * H.J.C. Berendsen, D. van der Spoel and R. van Drunen
19  * Comp. Phys. Comm. 91, 43-56 (1995)
20  * 
21  * Also check out our WWW page:
22  * http://md.chem.rug.nl/~gmx
23  * or e-mail to:
24  * gromacs@chem.rug.nl
25  * 
26  * And Hey:
27  * Green Red Orange Magenta Azure Cyan Skyblue
28  */
29
30 #ifdef HAVE_CONFIG_H
31 #include <config.h>
32 #endif
33
34 #ifndef _ifunc_h
35 #define _ifunc_h
36
37
38 typedef real t_ifunc(int nbonds,t_iatom iatoms[],t_iparams *iparams,
39                      rvec x[],rvec f[],t_forcerec *fr,t_graph *g,
40                      matrix box,real lambd,real *dvdlambda,
41                      t_mdatoms *md,int ngrp,real egnb[],real egcoul[]);
42 /*
43  * The function type t_ifunc() calculates one interaction, using iatoms[] 
44  * and iparams. Within the function the number of atoms to be used is 
45  * known. Within the function only the atomid part of the iatoms[] array 
46  * is supplied, not the type field (see also t_ilist). The function 
47  * returns the potential energy. The coordinates in x are such that
48  * no calculation of PBC is necessary.
49  */
50
51 #define IF_NULL       0
52 #define IF_BOND       1
53 #define IF_DUMMY      1<<1
54 #define IF_CONSTRAINT 1<<2
55 #define IF_CONNECT    1<<3
56 #define IF_BTYPE      1<<5
57 #define IF_ATYPE      1<<6
58 /* These flags tell to some of the routines what can be done with this
59  * item in the list. If flags & IF_BOND, then bonded interactions will
60  * be calculated. If flags & IF_CONNECT this link specifies a connection 
61  * (chemical bond) between two particles. By specifying this here, we can 
62  * keep all the information in one place.
63  */
64 typedef struct
65 {
66   char    *name;        /* the name of this function                    */
67   char    *longname;    /* The name for printing etc.                   */
68   int     nratoms;      /* nr of atoms needed for this function         */
69   int     nrfpA,nrfpB;  /* number of parameters for this function.      */
70                         /* this corresponds to the number of params in  */
71                         /* iparams struct! (see idef.h)                 */
72   /* A and B are for normal and free energy components respectively.    */
73   unsigned long   flags;        /* Flags (see above)                            */
74   int     nrnb_ind;     /* index for nrnb (-1 if unknown)               */
75   t_ifunc *ifunc;       /* the function it self                         */
76 } t_interaction_function;
77
78 #define NRFP(ftype) (interaction_function[(ftype)].nrfpA+interaction_function[(ftype)].nrfpB)
79 #define NRAL(ftype) (interaction_function[(ftype)].nratoms)
80
81 extern t_interaction_function interaction_function[F_NRE];
82 /* initialised interaction functions descriptor                         */
83
84 #endif
85