Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / topology / ifunc.cpp
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5  * Copyright (c) 2001-2004, The GROMACS development team.
6  * Copyright (c) 2013,2014,2015,2017,2018,2019, by the GROMACS development team, led by
7  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8  * and including many others, as listed in the AUTHORS file in the
9  * top-level source directory and at http://www.gromacs.org.
10  *
11  * GROMACS is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * GROMACS is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with GROMACS; if not, see
23  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
25  *
26  * If you want to redistribute modifications to GROMACS, please
27  * consider that scientific software is very special. Version
28  * control is crucial - bugs must be traceable. We will be happy to
29  * consider code for inclusion in the official distribution, but
30  * derived work must not be called official GROMACS. Details are found
31  * in the README & COPYING files - if they are missing, get the
32  * official version at http://www.gromacs.org.
33  *
34  * To help us fund GROMACS development, we humbly ask that you cite
35  * the research papers on the package. Check out http://www.gromacs.org.
36  */
37 /* This file is completely threadsafe - keep it that way! */
38 #include "gmxpre.h"
39
40 #include "ifunc.h"
41
42 #define def_bonded(str, lstr, nra, nrpa, nrpb)    \
43     {                                             \
44         str, lstr, (nra), (nrpa), (nrpb), IF_BOND \
45     }
46
47 #define def_bondedz(str, lstr, nra, nrpa, nrpb)                \
48     {                                                          \
49         str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_LIMZERO \
50     }
51
52 #define def_bondedt(str, lstr, nra, nrpa, nrpb)                  \
53     {                                                            \
54         str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_TABULATED \
55     }
56
57 #define def_bondedtz(str, lstr, nra, nrpa, nrpb)                              \
58     {                                                                         \
59         str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_TABULATED | IF_LIMZERO \
60     }
61
62 #define def_angle(str, lstr, nra, nrpa, nrpb)                \
63     {                                                        \
64         str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_ATYPE \
65     }
66
67 #define def_bond(str, lstr, nra, nrpa, nrpb)                               \
68     {                                                                      \
69         str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND | IF_BTYPE \
70     }
71
72 #define def_bondt(str, lstr, nra, nrpa, nrpb)                                  \
73     {                                                                          \
74         str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND | IF_TABULATED \
75     }
76
77 #define def_bondnb(str, lstr, nra, nrpa, nrpb)                  \
78     {                                                           \
79         str, lstr, (nra), (nrpa), (nrpb), IF_BOND | IF_CHEMBOND \
80     }
81
82 #define def_vsite(str, lstr, nra, nrpa)       \
83     {                                         \
84         str, lstr, (nra), (nrpa), 0, IF_VSITE \
85     }
86
87 #define def_shk(str, lstr, nra, nrpa, nrpb)             \
88     {                                                   \
89         str, lstr, (nra), (nrpa), (nrpb), IF_CONSTRAINT \
90     }
91
92 #define def_shkcb(str, lstr, nra, nrpa, nrpb)                         \
93     {                                                                 \
94         str, lstr, (nra), (nrpa), (nrpb), IF_CONSTRAINT | IF_CHEMBOND \
95     }
96
97 #define def_nb(str, lstr, nra, nrp)         \
98     {                                       \
99         str, lstr, (nra), (nrp), 0, IF_NULL \
100     }
101
102 #define def_nofc(str, lstr)         \
103     {                               \
104         str, lstr, 0, 0, 0, IF_NULL \
105     }
106
107 /* this MUST correspond to the enum in src/gromacs/topology/ifunc.h */
108 const t_interaction_function interaction_function[F_NRE] = {
109     def_bond("BONDS", "Bond", 2, 2, 2), def_bond("G96BONDS", "G96Bond", 2, 2, 2),
110     def_bond("MORSE", "Morse", 2, 3, 3), def_bond("CUBICBONDS", "Cubic Bonds", 2, 3, 0),
111     def_bondnb("CONNBONDS", "Connect Bonds", 2, 0, 0),
112     def_bonded("HARMONIC", "Harmonic Pot.", 2, 2, 2), def_bondnb("FENEBONDS", "FENE Bonds", 2, 2, 0),
113     def_bondt("TABBONDS", "Tab. Bonds", 2, 2, 2), def_bondedtz("TABBONDSNC", "Tab. Bonds NC", 2, 2, 2),
114     def_bonded("RESTRAINTPOT", "Restraint Pot.", 2, 4, 4), def_angle("ANGLES", "Angle", 3, 2, 2),
115     def_angle("G96ANGLES", "G96Angle", 3, 2, 2), def_angle("RESTRANGLES", "Restricted Angles", 3, 2, 2),
116     def_angle("LINEAR_ANGLES", "Lin. Angle", 3, 2, 2),
117     def_bonded("CROSS_BOND_BOND", "Bond-Cross", 3, 3, 0),
118     def_bonded("CROSS_BOND_ANGLE", "BA-Cross", 3, 4, 0), def_angle("UREY_BRADLEY", "U-B", 3, 4, 4),
119     def_angle("QANGLES", "Quartic Angles", 3, 6, 0), def_bondedt("TABANGLES", "Tab. Angles", 3, 2, 2),
120     def_bonded("PDIHS", "Proper Dih.", 4, 3, 3), def_bonded("RBDIHS", "Ryckaert-Bell.", 4, 6, 6),
121     def_bonded("RESTRDIHS", "Restricted Dih.", 4, 2, 2), def_bonded("CBTDIHS", "CBT Dih.", 4, 6, 6),
122     def_bonded("FOURDIHS", "Fourier Dih.", 4, 4, 4), def_bonded("IDIHS", "Improper Dih.", 4, 2, 2),
123     def_bonded("PIDIHS", "Improper Dih.", 4, 3, 3), def_bondedt("TABDIHS", "Tab. Dih.", 4, 2, 2),
124     def_bonded("CMAP", "CMAP Dih.", 5, -1, -1), def_nofc("GB12", "GB 1-2 Pol. (unused)"),
125     def_nofc("GB13", "GB 1-3 Pol. (unused)"), def_nofc("GB14", "GB 1-4 Pol. (unused)"),
126     def_nofc("GBPOL", "GB Polarization (unused)"), def_nofc("NPSOLVATION", "Nonpolar Sol. (unused)"),
127     def_bondedz("LJ14", "LJ-14", 2, 2, 2), def_nofc("COUL14", "Coulomb-14"),
128     def_bondedz("LJC14_Q", "LJC-14 q", 2, 5, 0), def_bondedz("LJC_NB", "LJC Pairs NB", 2, 4, 0),
129     def_nb("LJ_SR", "LJ (SR)", 2, 2), def_nb("BHAM", "Buck.ham (SR)", 2, 3),
130     def_nofc("LJ_LR", "LJ (unused)"), def_nofc("BHAM_LR", "B.ham (unused)"),
131     def_nofc("DISPCORR", "Disper. corr."), def_nofc("COUL_SR", "Coulomb (SR)"),
132     def_nofc("COUL_LR", "Coul (unused)"), def_nofc("RF_EXCL", "RF excl."),
133     def_nofc("COUL_RECIP", "Coul. recip."), def_nofc("LJ_RECIP", "LJ recip."),
134     def_nofc("DPD", "DPD"), def_bondnb("POLARIZATION", "Polarization", 2, 1, 0),
135     def_bonded("WATERPOL", "Water Pol.", 5, 6, 0), def_bonded("THOLE", "Thole Pol.", 4, 3, 0),
136     def_bondnb("ANHARM_POL", "Anharm. Pol.", 2, 3, 0), def_bonded("POSRES", "Position Rest.", 1, 3, 3),
137     def_bonded("FBPOSRES", "Flat-bottom posres", 1, 3, 0), def_bonded("DISRES", "Dis. Rest.", 2, 6, 0),
138     def_nofc("DISRESVIOL", "D.R.Viol. (nm)"), def_bonded("ORIRES", "Orient. Rest.", 2, 6, 0),
139     def_nofc("ORDEV", "Ori. R. RMSD"), def_bonded("ANGRES", "Angle Rest.", 4, 3, 3),
140     def_bonded("ANGRESZ", "Angle Rest. Z", 2, 3, 3), def_bonded("DIHRES", "Dih. Rest.", 4, 3, 3),
141     def_nofc("DIHRESVIOL", "Dih. Rest. Viol."), /* obsolete */
142     def_shkcb("CONSTR", "Constraint", 2, 1, 1), def_shk("CONSTRNC", "Constr. No Conn.", 2, 1, 1),
143     def_shkcb("SETTLE", "Settle", 3, 2, 0), def_vsite("VSITE2", "Virtual site 2", 3, 1),
144     def_vsite("VSITE2FD", "Virtual site 2fd", 3, 1), def_vsite("VSITE3", "Virtual site 3", 4, 2),
145     def_vsite("VSITE3FD", "Virtual site 3fd", 4, 2), def_vsite("VSITE3FAD", "Virtual site 3fad", 4, 2),
146     def_vsite("VSITE3OUT", "Virtual site 3out", 4, 3), def_vsite("VSITE4FD", "Virtual site 4fd", 5, 3),
147     def_vsite("VSITE4FDN", "Virtual site 4fdn", 5, 3), def_vsite("VSITEN", "Virtual site N", 2, 2),
148     def_nofc("COM_PULL", "COM Pull En."), def_nofc("DENSITYFIT", "Density fitting"),
149     def_nofc("EQM", "Quantum En."), def_nofc("EPOT", "Potential"), def_nofc("EKIN", "Kinetic En."),
150     def_nofc("ETOT", "Total Energy"), def_nofc("ECONS", "Conserved En."),
151     def_nofc("TEMP", "Temperature"), def_nofc("VTEMP", "Vir. Temp. (not used)"),
152     /* Note that pressure names can not be more than 8 char's,
153      * because " (bar)" is appended to them.
154      */
155     def_nofc("PDISPCORR", "Pres. DC"), def_nofc("PRES", "Pressure"),
156     def_nofc("DH/DL_CON", "dH/dl constr."), /* obsolete */
157     def_nofc("DV/DL", "dVremain/dl"), def_nofc("DK/DL", "dEkin/dl"), def_nofc("DVC/DL", "dVcoul/dl"),
158     def_nofc("DVV/DL", "dVvdw/dl"), def_nofc("DVB/DL", "dVbonded/dl"),
159     def_nofc("DVR/DL", "dVrestraint/dl"), def_nofc("DVT/DL", "dVtemperature/dl")
160 };