Another quick bug fix.
[gromacs/rigid-bodies.git] / include / types / ifunc.h
blob43012570e8aa1a91273fc9cacbb705bc4899f7d5
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.
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.
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.
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.
30 * For more info, check our website at http://www.gromacs.org
32 * And Hey:
33 * GRoups of Organic Molecules in ACtion for Science
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
39 #ifndef _ifunc_h
40 #define _ifunc_h
43 typedef real t_ifunc(int nbonds,const t_iatom iatoms[],
44 const t_iparams iparams[],
45 const rvec x[],rvec f[],rvec fshift[],
46 const t_pbc *pbc,const t_graph *g,
47 real lambda,real *dvdlambda,
48 const t_mdatoms *md,t_fcdata *fcd,
49 int *ddgatindex);
52 * The function type t_ifunc() calculates one interaction, using iatoms[]
53 * and iparams. Within the function the number of atoms to be used is
54 * known. Within the function only the atomid part of the iatoms[] array
55 * is supplied, not the type field (see also t_ilist). The function
56 * returns the potential energy. If pbc==NULL the coordinates in x are
57 * assumed to be such that no calculation of PBC is necessary,
58 * If pbc!=NULL a full PBC calculation is performed.
59 * If g!=NULL it is used for determining the shift forces.
60 * With domain decomposition ddgatindex can be used for getting global
61 * atom numbers for warnings and error messages.
62 * ddgatindex is NULL when domain decomposition is not used.
65 #define IF_NULL 0
66 #define IF_BOND 1
67 #define IF_VSITE 1<<1
68 #define IF_CONSTRAINT 1<<2
69 #define IF_CHEMBOND 1<<3
70 #define IF_BTYPE 1<<4
71 #define IF_ATYPE 1<<5
72 #define IF_TABULATED 1<<6
73 #define IF_LIMZERO 1<<7
74 /* These flags tell to some of the routines what can be done with this
75 * item in the list.
76 * With IF_BOND a bonded interaction will be calculated.
77 * With IF_BTYPE grompp can convert the bond to a Morse potential.
78 * With IF_BTYPE or IF_ATYPE the bond/angle can be converted to
79 * a constraint or used for vsite parameter determination by grompp.
80 * IF_LIMZERO indicates that for a bonded interaction the potential
81 * does goes to zero for large distances, thus if such an interaction
82 * it not assigned to any node by the domain decompostion, the simulation
83 * still continue, if mdrun has been told so.
85 typedef struct
87 const char *name; /* the name of this function */
88 const char *longname; /* The name for printing etc. */
89 int nratoms; /* nr of atoms needed for this function */
90 int nrfpA,nrfpB; /* number of parameters for this function. */
91 /* this corresponds to the number of params in */
92 /* iparams struct! (see idef.h) */
93 /* A and B are for normal and free energy components respectively. */
94 unsigned long flags; /* Flags (see above) */
95 int nrnb_ind; /* index for nrnb (-1 if unknown) */
96 t_ifunc *ifunc; /* the function it self */
97 } t_interaction_function;
99 #define NRFPA(ftype) (interaction_function[(ftype)].nrfpA)
100 #define NRFPB(ftype) (interaction_function[(ftype)].nrfpB)
101 #define NRFP(ftype) (NRFPA(ftype)+NRFPB(ftype))
102 #define NRAL(ftype) (interaction_function[(ftype)].nratoms)
104 #define IS_CHEMBOND(ftype) (interaction_function[(ftype)].nratoms==2 && interaction_function[(ftype)].flags & IF_CHEMBOND)
105 /* IS_CHEMBOND tells if function type ftype represents a chemical bond */
107 /* IS_ANGLE tells if a function type ftype represents an angle
108 * Per Larsson, 2007-11-06
110 #define IS_ANGLE(ftype) (interaction_function[(ftype)].nratoms==3 && interaction_function[(ftype)].flags & IF_ATYPE)
111 #define IS_VSITE(ftype) (interaction_function[(ftype)].flags & IF_VSITE)
113 #define IS_TABULATED(ftype) (interaction_function[(ftype)].flags & IF_TABULATED)
115 extern const t_interaction_function interaction_function[F_NRE];
116 /* initialised interaction functions descriptor */
118 #endif