Merge release-4-6 into master
[alexxy/gromacs.git] / src / gromacs / gmxlib / ifunc.c
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.
14
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.
19  * 
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.
26  * 
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.
29  * 
30  * For more info, check our website at http://www.gromacs.org
31  * 
32  * And Hey:
33  * GROningen Mixture of Alchemy and Childrens' Stories
34  */
35 /* This file is completely threadsafe - keep it that way! */
36 #ifdef HAVE_CONFIG_H
37 #include <config.h>
38 #endif
39
40
41 #include "typedefs.h"
42 #include "bondf.h"
43 #include "disre.h"
44 #include "dihre.h"
45 #include "orires.h"
46 #include "genborn.h"
47
48
49 #define  def_bonded(str,lstr,nra,nrpa,nrpb,ind,func)\
50    {str,lstr,(nra),(nrpa),(nrpb),IF_BOND,                        (ind),(func)}
51
52 #define  def_bondedz(str,lstr,nra,nrpa,nrpb,ind,func)\
53    {str,lstr,(nra),(nrpa),(nrpb),IF_BOND | IF_LIMZERO,           (ind),(func)}
54
55 #define  def_bondedt(str,lstr,nra,nrpa,nrpb,ind,func)\
56    {str,lstr,(nra),(nrpa),(nrpb),IF_BOND | IF_TABULATED,         (ind),(func)}
57
58 #define  def_bondedtz(str,lstr,nra,nrpa,nrpb,ind,func)\
59    {str,lstr,(nra),(nrpa),(nrpb),IF_BOND | IF_TABULATED | IF_LIMZERO,(ind),(func)}
60
61 #define   def_angle(str,lstr,nra,nrpa,nrpb,ind,func)\
62    {str,lstr,(nra),(nrpa),(nrpb),IF_BOND | IF_ATYPE,(ind),(func)}
63    
64 #define    def_bond(str,lstr,nra,nrpa,nrpb,ind,func)\
65    {str,lstr,(nra),(nrpa),(nrpb),IF_BOND | IF_CHEMBOND | IF_BTYPE,(ind),(func)}
66
67 #define    def_bondt(str,lstr,nra,nrpa,nrpb,ind,func)\
68    {str,lstr,(nra),(nrpa),(nrpb),IF_BOND | IF_CHEMBOND | IF_TABULATED,(ind),(func)}
69
70 #define  def_bondnb(str,lstr,nra,nrpa,nrpb,ind,func)\
71    {str,lstr,(nra),(nrpa),(nrpb),IF_BOND | IF_CHEMBOND,(ind),(func)}
72
73 #define   def_vsite(str,lstr,nra,nrpa)\
74    {str,lstr,(nra),(nrpa),     0,IF_VSITE,                  -1, unimplemented}
75
76 #define     def_shk(str,lstr,nra,nrpa,nrpb)\
77    {str,lstr,(nra),(nrpa),(nrpb),IF_CONSTRAINT,             -1, unimplemented}
78
79 #define   def_shkcb(str,lstr,nra,nrpa,nrpb)\
80    {str,lstr,(nra),(nrpa),(nrpb),IF_CONSTRAINT | IF_CHEMBOND,-1, unimplemented}
81    
82 #define      def_nb(str,lstr,nra, nrp)\
83    {str,lstr,(nra), (nrp),     0,IF_NULL,                    -1,unimplemented}
84    
85 #define    def_nofc(str,lstr)\
86    {str,lstr,    0,     0,     0,IF_NULL,                    -1,unimplemented}
87
88 /* this MUST correspond to the enum in include/types/idef.h */
89 const t_interaction_function interaction_function[F_NRE]=
90 {
91   def_bond    ("BONDS",    "Bond",            2, 2, 2,  eNR_BONDS,  bonds         ),
92   def_bond    ("G96BONDS", "G96Bond",         2, 2, 2,  eNR_BONDS,  g96bonds      ),
93   def_bond    ("MORSE",    "Morse",           2, 3, 0,  eNR_MORSE,  morse_bonds   ),
94   def_bond    ("CUBICBONDS","Cubic Bonds",    2, 3, 0,  eNR_CUBICBONDS, cubic_bonds),
95   def_bondnb  ("CONNBONDS","Connect Bonds",   2, 0, 0,  0,      unimplemented     ),
96   def_bonded  ("HARMONIC", "Harmonic Pot.",   2, 2, 2,  eNR_BONDS,  bonds         ),
97   def_bondnb  ("FENEBONDS", "FENE Bonds",     2, 2, 0,  eNR_FENEBONDS, FENE_bonds ),
98   def_bondt   ("TABBONDS", "Tab. Bonds",      2, 2, 2,  eNR_TABBONDS, tab_bonds   ),
99   def_bondedtz("TABBONDSNC", "Tab. Bonds NC", 2, 2, 2,  eNR_TABBONDS, tab_bonds   ),
100   def_bonded  ("RESTRAINTPOT", "Restraint Pot.", 2, 4, 4,  eNR_RESTRBONDS,  restraint_bonds ),
101   def_angle   ("ANGLES",   "Angle",           3, 2, 2,  eNR_ANGLES, angles        ),
102   def_angle   ("G96ANGLES","G96Angle",        3, 2, 2,  eNR_ANGLES, g96angles     ),
103   def_angle   ("LINEAR_ANGLES", "Lin. Angle", 3, 2, 2,  eNR_LINEAR_ANGLES, linear_angles ),
104   def_bonded  ("CROSS_BOND_BOND", "Bond-Cross", 3, 3, 0,0,          cross_bond_bond ),
105   def_bonded  ("CROSS_BOND_ANGLE","BA-Cross",   3, 4, 0,0,          cross_bond_angle ),
106   def_angle   ("UREY_BRADLEY","U-B",          3, 4, 0,  0,          urey_bradley ),
107   def_angle   ("QANGLES","Quartic Angles",    3, 6, 0,  eNR_QANGLES, quartic_angles ),
108   def_bondedt ("TABANGLES", "Tab. Angles",    3, 2, 2,  eNR_TABANGLES, tab_angles ),
109   def_bonded  ("PDIHS",    "Proper Dih.",     4, 3, 3,  eNR_PROPER, pdihs         ),
110   def_bonded  ("RBDIHS",   "Ryckaert-Bell.",  4, 6, 6,  eNR_RB, rbdihs            ),
111   def_bonded  ("FOURDIHS", "Fourier Dih.",    4, 4, 4,  eNR_FOURDIH, rbdihs       ),
112   def_bonded  ("IDIHS",    "Improper Dih.",   4, 2, 2,  eNR_IMPROPER,idihs        ),
113   def_bonded  ("PIDIHS",   "Improper Dih.",   4, 3, 3,  eNR_PROPER, pdihs         ),
114   def_bondedt ("TABDIHS", "Tab. Dih.",        4, 2, 2,  eNR_TABDIHS, tab_dihs     ),
115   def_bonded  ("CMAP",  "CMAP Dih.",          5, -1, -1,  eNR_CMAP,   unimplemented ),
116   def_bonded  ("GB12",     "GB 1-2 Pol.",     2, 4, 0,  eNR_GB,     unimplemented ),
117   def_bonded  ("GB13",     "GB 1-3 Pol.",     2, 4, 0,  eNR_GB,     unimplemented ),
118   def_bonded  ("GB14",     "GB 1-4 Pol.",     2, 4, 0,  eNR_GB,     unimplemented ),
119   def_nofc    ("GBPOL",    "GB Polarization" ),
120   def_nofc    ("NPSOLVATION", "Nonpolar Sol." ),
121   def_bondedz ("LJ14",     "LJ-14",           2, 2, 2,  eNR_NB14,   unimplemented ),
122   def_nofc    ("COUL14",   "Coulomb-14"                                           ),
123   def_bondedz ("LJC14_Q",  "LJC-14 q",        2, 5, 0,  eNR_NB14,   unimplemented ),
124   def_bondedz ("LJC_NB",   "LJC Pairs NB",    2, 4, 0,  eNR_NB14,   unimplemented ),
125   def_nb      ("LJ_SR",    "LJ (SR)",         2, 2                                ),
126   def_nb      ("BHAM",     "Buck.ham (SR)",   2, 3                                ),
127   def_nofc    ("LJ_LR",    "LJ (LR)"                                              ),
128   def_nofc    ("BHAM_LR",  "Buck.ham (LR)"                                        ),
129   def_nofc    ("DISPCORR", "Disper. corr."                                        ),
130   def_nofc    ("COUL_SR",  "Coulomb (SR)"                                         ),
131   def_nofc    ("COUL_LR",  "Coulomb (LR)"                                         ),
132   def_nofc    ("RF_EXCL",  "RF excl."                                             ),
133   def_nofc    ("COUL_RECIP", "Coul. recip."                                       ),
134   def_nofc    ("DPD",      "DPD"                                                  ),
135   def_bondnb  ("POLARIZATION", "Polarization",2, 1, 0,  0,          polarize      ),
136   def_bonded  ("WATERPOL", "Water Pol.",      5, 6, 0,  eNR_WPOL,   water_pol     ),
137   def_bonded  ("THOLE",    "Thole Pol.",      4, 3, 0,  eNR_THOLE,  thole_pol     ),
138   def_bondnb  ("ANHARM_POL", "Anharm. Pol.",2, 3, 0, 0,          anharm_polarize      ),
139   def_bonded  ("POSRES",   "Position Rest.",  1, 3, 3,  eNR_POSRES, unimplemented ),
140   def_bonded  ("DISRES",   "Dis. Rest.",      2, 6, 0,  eNR_DISRES, ta_disres     ),
141   def_nofc    ("DRVIOL",   "D.R.Viol. (nm)"                                       ),    
142   def_bonded  ("ORIRES",   "Orient. Rest.",   2, 6, 0,  eNR_ORIRES, orires        ),
143   def_nofc    ("ORDEV",    "Ori. R. RMSD"                                         ),  
144   def_bonded  ("ANGRES",   "Angle Rest.",     4, 3, 3,  eNR_ANGRES, angres        ),
145   def_bonded  ("ANGRESZ",  "Angle Rest. Z",   2, 3, 3,  eNR_ANGRESZ,angresz       ),
146   def_bonded  ("DIHRES",   "Dih. Rest.",      4, 5, 0,  eNR_DIHRES, ta_dihres     ),
147   def_nofc    ("DIHVIOL",  "Dih. Rest. viol."                                     ),    
148   def_shkcb   ("CONSTR",   "Constraint",      2, 1, 1                             ),
149   def_shk     ("CONSTRNC", "Constr. No Conn.",2, 1, 1                             ),
150   def_shkcb   ("SETTLE",   "Settle",          3, 2, 0                             ),
151   def_vsite   ("VSITE2",   "Virtual site 2",  3, 1                                ),
152   def_vsite   ("VSITE3",   "Virtual site 3",  4, 2                                ),
153   def_vsite   ("VSITE3FD", "Virtual site 3fd",4, 2                                ),
154   def_vsite   ("VSITE3FAD","Virtual site 3fad",4, 2                               ),
155   def_vsite   ("VSITE3OUT","Virtual site 3out",4, 3                               ),
156   def_vsite   ("VSITE4FD", "Virtual site 4fd", 5, 3                               ),
157   def_vsite   ("VSITE4FDN","Virtual site 4fdn",5, 3                               ),
158   def_vsite   ("VSITEN",   "Virtual site N",   2, 2                               ),
159   def_nofc    ("COM_PULL", "COM Pull En."     ),
160   def_nofc    ("EQM",      "Quantum En."      ),
161   def_nofc    ("EPOT",     "Potential"        ),
162   def_nofc    ("EKIN",     "Kinetic En."      ),
163   def_nofc    ("ETOT",     "Total Energy"     ),
164   def_nofc    ("ECONS",    "Conserved En."    ),
165   def_nofc    ("TEMP",     "Temperature"      ),
166   def_nofc    ("VTEMP",    "Vir. Temp."       ),
167   /* Note that pressure names can not be more than 8 char's,
168    * because " (bar)" is appended to them.
169    */
170   def_nofc    ("PDISPCORR","Pres. DC"         ),  
171   def_nofc    ("PRES",     "Pressure"         ),
172   def_nofc    ("DV/DL",    "dVpot/dlambda"    ),
173   def_nofc    ("DK/DL",    "dEkin/dlambda"    ),
174   def_nofc    ("DH/DL_CON","dH/dl constr."    )
175 };