Tagged files with gromacs 3.0 header and added some license info
[alexxy/gromacs.git] / include / types / idef.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 3.0
11  * 
12  * Copyright (c) 1991-2001
13  * BIOSON Research Institute, Dept. of Biophysical Chemistry
14  * University of Groningen, The Netherlands
15  * 
16  * This program is free software; you can redistribute it and/or
17  * modify it under the terms of the GNU General Public License
18  * as published by the Free Software Foundation; either version 2
19  * of the License, or (at your option) any later version.
20  * 
21  * If you want to redistribute modifications, please consider that
22  * scientific software is very special. Version control is crucial -
23  * bugs must be traceable. We will be happy to consider code for
24  * inclusion in the official distribution, but derived work must not
25  * be called official GROMACS. Details are found in the README & COPYING
26  * files - if they are missing, get the official version at www.gromacs.org.
27  * 
28  * To help us fund GROMACS development, we humbly ask that you cite
29  * the papers on the package - you can find them in the top README file.
30  * 
31  * Do check out http://www.gromacs.org , or mail us at gromacs@gromacs.org .
32  * 
33  * And Hey:
34  * Good ROcking Metal Altar for Chronical Sinners
35  */
36 #ifdef HAVE_CONFIG_H
37 #include <config.h>
38 #endif
39
40 #ifndef _idef_h
41 #define _idef_h
42
43
44 /* check kernel/toppush.c when you change these numbers */
45 #define MAXATOMLIST     5
46 #define MAXFORCEPARAM   6
47 #define NR_RBDIHS       6
48
49 typedef atom_id t_iatom;
50
51 /* this MUST correspond to the 
52    t_interaction_function[F_NRE] in gmxlib/ifunc.c */
53 enum {
54   F_BONDS,
55   F_G96BONDS,
56   F_MORSE,
57   F_CUBICBONDS,
58   F_CONNBONDS,
59   F_HARMONIC,
60   F_ANGLES, 
61   F_G96ANGLES, 
62   F_PDIHS,
63   F_RBDIHS,
64   F_IDIHS, 
65   F_LJ14,
66   F_COUL14,
67   F_LJ,
68   F_BHAM,
69   F_LJLR,
70   F_DISPCORR,
71   F_SR,
72   F_LR,
73   F_WPOL,
74   F_POSRES,
75   F_DISRES,
76   F_ANGRES,
77   F_ANGRESZ,
78   F_SHAKE,
79   F_SHAKENC,
80   F_SETTLE,
81   F_DUMMY2,
82   F_DUMMY3,
83   F_DUMMY3FD,
84   F_DUMMY3FAD,
85   F_DUMMY3OUT,
86   F_DUMMY4FD,
87   F_EQM,
88   F_EPOT,
89   F_EKIN,
90   F_ETOT,
91   F_TEMP,
92   F_PRES,
93   F_DVDL,
94   F_DVDLKIN,
95   F_NRE         /* This number is for the total number of energies      */
96 };
97   
98 typedef union
99 {
100   /* Some parameters have A and B values for free energy calculations.
101    * The B values are not used for regular simulations of course.
102    * Free Energy for nonbondeds can be computed by changing the atom type.
103    * The harmonic type is used for all harmonic potentials:
104    * bonds, angles and improper dihedrals
105    */
106   struct {real a,b,c;                           } bham;
107   struct {real rA,krA,rB,krB;                   } harmonic; 
108   /* No free energy support for cubic bonds */
109   struct {real b0,kb,kcub;                      } cubic; 
110   /* No free energy supported for WPOL */ 
111   struct {real kx,ky,kz,rOH,rHH,rOD;            } wpol; 
112   struct {real c6,c12;                          } lj;
113   struct {real c6A,c12A,c6B,c12B;               } lj14;
114   /* Proper dihedrals can not have different multiplicity when
115    * doing free energy calculations, because the potential would not
116    * be periodic anymore.
117    */ 
118   struct {real phiA,cpA;int mult;real phiB,cpB; } pdihs;
119   struct {real dA,dB;                           } shake;
120   /* Settle can not be used for Free energy calculations.
121    * Use shake (or lincs) instead.
122    * The rest of the things cannot (yet) be used in FEP studies either.
123    */
124   struct {real doh,dhh;                         } settle;
125   struct {real b0,cb,beta;                      } morse;
126   struct {real pos0[DIM],fc[DIM];               } posres;
127   struct {real rbc[NR_RBDIHS];                  } rbdihs;
128   struct {real a,b,c,d,e,f;                     } dummy;   
129   struct {real low,up1,up2,fac;int type,index;  } disres; 
130   struct {real buf[MAXFORCEPARAM];              } generic; /* Conversion */
131 } t_iparams;
132
133 typedef int t_functype;
134
135 typedef struct
136 {
137   int nr;
138   int multinr[MAXNODES];
139   t_iatom *iatoms;
140 } t_ilist;
141
142 /*
143  * The struct t_ilist defines a list of atoms with their interactions. 
144  * General field description:
145  *   int nr
146  *      the size (nr elements) of the interactions array (iatoms[]). This 
147  *      equals multinr[MAXNODES-1].
148  *   int multinr[MAXNODES]
149  *      specifies the number of type and atom id sequences in the iatoms[] 
150  *      array. Every element specifies the index of the first interaction
151  *      for the next node. The first node starts at zero. So for 
152  *      n=0, the interactions run from 0 upto multinr[0]. The interactions
153  *      for node n (n>0) run from multinr[n-1] to index[n] (not including 
154  *      multinr[n]).
155  *   t_iatom *iatoms
156  *      specifies which atoms are involved in an interaction of a certain 
157  *       type. The layout of this array is as follows:
158  *
159  *        +-----+---+---+---+-----+---+---+-----+---+---+---+-----+---+---+...
160  *        |type1|at1|at2|at3|type2|at1|at2|type1|at1|at2|at3|type3|at1|at2|
161  *        +-----+---+---+---+-----+---+---+-----+---+---+---+-----+---+---+...
162  *
163  *      So for interaction type type1 3 atoms are needed, and for type2 and 
164  *      type3 only 2. The type identifier is used to select the function to 
165  *      calculate the interaction and its actual parameters. This type 
166  *      identifier is an index in a params[] and functype[] array.
167  * The multinr[] array will be initialised for MAXNODES in such a way that up 
168  * to the actual number of nodes (during creation time), the array is
169  * filled with the indices, the remaining nodes get empty parts by 
170  * setting the indices to the largest value. In that way it is always possible
171  * to run this system on a larger multinode ring however only the
172  * configured number of nodes will we used. Running on less nodes
173  * than configured is also possible by taking together adjacent
174  * nodes. Note that in this case the load balance might get worse.
175  * The single node version is implemented by simply using the complete
176  * configuration as one piece.
177  */
178
179 typedef struct
180 {
181   int ntypes;
182   int nodeid;
183   int atnr;
184   t_functype *functype;
185   t_iparams  *iparams;
186
187   t_ilist il[F_NRE];
188 } t_idef;
189
190 /*
191  * The struct t_idef defines all the interactions for the complete
192  * simulation. The structure is setup in such a way that the multinode
193  * version of the program  can use it as easy as the single node version.
194  * General field description:
195  *   int ntypes
196  *      defines the number of elements in functype[] and param[].
197  *   int nodeid
198  *      the node id (if parallel machines)
199  *   int atnr
200  *      the number of atomtypes
201  *   t_functype *functype
202  *      array of length ntypes, defines for every force type what type of 
203  *      function to use. Every "bond" with the same function but different 
204  *      force parameters is a different force type. The type identifier in the 
205  *      forceatoms[] array is an index in this array.
206      t_iparams *iparams;
207  *      array of length ntypes, defines the parameters for every interaction
208  *      type. The type identifier in the actual interaction list
209  *      (bondeds.iatoms[] or shakes.iatoms[]) is an index in this array.
210  *   t_ilist il[F_NRE]
211  *      The list of interactions for each type. Note that some,
212  *      such as LJ and COUL will have 0 entries.
213  */
214
215 #endif