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