Make temperature and pressure coupling enums enum classes
[alexxy/gromacs.git] / src / gromacs / mdtypes / md_enums.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,2016,2017 by the GROMACS development team.
7  * Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
8  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
9  * and including many others, as listed in the AUTHORS file in the
10  * top-level source directory and at http://www.gromacs.org.
11  *
12  * GROMACS is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public License
14  * as published by the Free Software Foundation; either version 2.1
15  * of the License, or (at your option) any later version.
16  *
17  * GROMACS is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with GROMACS; if not, see
24  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
26  *
27  * If you want to redistribute modifications to GROMACS, please
28  * consider that scientific software is very special. Version
29  * control is crucial - bugs must be traceable. We will be happy to
30  * consider code for inclusion in the official distribution, but
31  * derived work must not be called official GROMACS. Details are found
32  * in the README & COPYING files - if they are missing, get the
33  * official version at http://www.gromacs.org.
34  *
35  * To help us fund GROMACS development, we humbly ask that you cite
36  * the research papers on the package. Check out http://www.gromacs.org.
37  */
38 #include "gmxpre.h"
39
40 #include "md_enums.h"
41
42 #include "gromacs/utility/enumerationhelpers.h"
43
44 const char* enum_name(int index, int max_index, const char* const names[])
45 {
46     if (index < 0 || index >= max_index)
47     {
48         static const char* undef = "no name defined";
49         return undef;
50     }
51     else
52     {
53         return names[index];
54     }
55 }
56
57 const char* yesno_names[BOOL_NR + 1] = { "no", "yes", nullptr };
58
59 const char* ei_names[eiNR + 1] = { "md",    "steep",      "cg",    "bd",   "sd2 - removed",
60                                    "nm",    "l-bfgs",     "tpi",   "tpic", "sd",
61                                    "md-vv", "md-vv-avek", "mimic", nullptr };
62
63 const char* ecutscheme_names[ecutsNR + 1] = { "Verlet", "Group", nullptr };
64
65 const char* erefscaling_names[erscNR + 1] = { "No", "All", "COM", nullptr };
66
67 const char* eel_names[eelNR + 1] = { "Cut-off",
68                                      "Reaction-Field",
69                                      "Generalized-Reaction-Field (unused)",
70                                      "PME",
71                                      "Ewald",
72                                      "P3M-AD",
73                                      "Poisson",
74                                      "Switch",
75                                      "Shift",
76                                      "User",
77                                      "Generalized-Born (unused)",
78                                      "Reaction-Field-nec (unsupported)",
79                                      "Encad-shift (unused)",
80                                      "PME-User",
81                                      "PME-Switch",
82                                      "PME-User-Switch",
83                                      "Reaction-Field-zero",
84                                      nullptr };
85
86 const char* eewg_names[eewgNR + 1] = { "3d", "3dc", nullptr };
87
88 const char* eljpme_names[eljpmeNR + 1] = { "Geometric", "Lorentz-Berthelot", nullptr };
89
90 const char* evdw_names[evdwNR + 1] = { "Cut-off", "Switch", "Shift", "User", "Encad-shift (unused)",
91                                        "PME",     nullptr };
92
93 const char* econstr_names[econtNR + 1] = { "Lincs", "Shake", nullptr };
94
95 const char* eintmod_names[eintmodNR + 1] = {
96     "Potential-shift-Verlet", "Potential-shift", "None", "Potential-switch",
97     "Exact-cutoff",           "Force-switch",    nullptr
98 };
99
100 const char* enumValueToString(TemperatureCoupling enumValue)
101 {
102     static constexpr gmx::EnumerationArray<TemperatureCoupling, const char*> temperatureCouplingNames = {
103         "No", "Berendsen", "Nose-Hoover", "yes", "Andersen", "Andersen-massive", "V-rescale"
104     }; /* yes is alias for berendsen */
105     return temperatureCouplingNames[enumValue];
106 }
107
108 const char* enumValueToString(PressureCoupling enumValue)
109 {
110     static constexpr gmx::EnumerationArray<PressureCoupling, const char*> pressureCouplingNames = {
111         "No", "Berendsen", "Parrinello-Rahman", "Isotropic", "MTTK", "C-rescale"
112     }; /* isotropic is alias for berendsen */
113     return pressureCouplingNames[enumValue];
114 }
115
116 const char* epcoupltype_names[epctNR + 1] = { "Isotropic",
117                                               "Semiisotropic",
118                                               "Anisotropic",
119                                               "Surface-Tension",
120                                               nullptr };
121
122 const char* edisre_names[edrNR + 1] = { "No", "Simple", "Ensemble", nullptr };
123
124 const char* edisreweighting_names[edrwNR + 1] = { "Conservative", "Equal", nullptr };
125
126 const char* enbf_names[eNBF_NR + 1] = { "", "LJ", "Buckingham", nullptr };
127
128 const char* ecomb_names[eCOMB_NR + 1] = { "", "Geometric", "Arithmetic", "GeomSigEps", nullptr };
129
130 const char* esimtemp_names[esimtempNR + 1] = { "geometric", "exponential", "linear", nullptr };
131
132 const char* efep_names[efepNR + 1] = { "no", "yes", "static", "slow-growth", "expanded", nullptr };
133
134 const char* efpt_names[efptNR + 1] = { "fep-lambdas",         "mass-lambdas",   "coul-lambdas",
135                                        "vdw-lambdas",         "bonded-lambdas", "restraint-lambdas",
136                                        "temperature-lambdas", nullptr };
137
138 const char* efpt_singular_names[efptNR + 1] = { "fep-lambda",         "mass-lambda",
139                                                 "coul-lambda",        "vdw-lambda",
140                                                 "bonded-lambda",      "restraint-lambda",
141                                                 "temperature-lambda", nullptr };
142
143 const char* edHdLPrintEnergy_names[edHdLPrintEnergyNR + 1] = { "no", "total", "potential", "yes", nullptr };
144
145 const char* elamstats_names[elamstatsNR + 1] = {
146     "no",     "metropolis-transition", "barker-transition",
147     "minvar", "wang-landau",           "weighted-wang-landau",
148     nullptr
149 };
150
151 const char* elmcmove_names[elmcmoveNR + 1] = { "no",    "metropolis",         "barker",
152                                                "gibbs", "metropolized-gibbs", nullptr };
153
154 const char* elmceq_names[elmceqNR + 1] = { "no",           "yes",
155                                            "wl-delta",     "number-all-lambda",
156                                            "number-steps", "number-samples",
157                                            "count-ratio",  nullptr };
158
159 const char* separate_dhdl_file_names[esepdhdlfileNR + 1] = { "yes", "no", nullptr };
160
161 const char* dhdl_derivatives_names[edhdlderivativesNR + 1] = { "yes", "no", nullptr };
162
163 const char* esol_names[esolNR + 1] = { "No", "SPC", "TIP4p", nullptr };
164
165 const char* edispc_names[edispcNR + 1] = { "No",          "EnerPres", "Ener",
166                                            "AllEnerPres", "AllEner",  nullptr };
167
168 const char* ecm_names[ecmNR + 1] = { "Linear", "Angular", "None", "Linear-acceleration-correction", nullptr };
169
170 const char* eann_names[eannNR + 1] = { "No", "Single", "Periodic", nullptr };
171
172 const char* ewt_names[ewtNR + 1] = { "9-3", "10-4", "table", "12-6", nullptr };
173
174 const char* epull_names[epullNR + 1] = { "umbrella",    "constraint",       "constant-force",
175                                          "flat-bottom", "flat-bottom-high", "external-potential",
176                                          nullptr };
177
178 const char* epullg_names[epullgNR + 1] = { "distance",           "direction",          "cylinder",
179                                            "direction-periodic", "direction-relative", "angle",
180                                            "dihedral",           "angle-axis",         nullptr };
181
182 const char* erotg_names[erotgNR + 1] = { "iso",   "iso-pf",  "pm",     "pm-pf", "rm",
183                                          "rm-pf", "rm2",     "rm2-pf", "flex",  "flex-t",
184                                          "flex2", "flex2-t", nullptr };
185
186 const char* erotg_fitnames[erotgFitNR + 1] = { "rmsd", "norm", "potential", nullptr };
187
188 const char* eSwapTypes_names[eSwapTypesNR + 1] = { "no", "X", "Y", "Z", nullptr };
189
190 const char* eSwapFixedGrp_names[eSwapFixedGrpNR + 1] = { "Split0", "Split1", "Solvent", nullptr };
191
192 const char* gmx_nblist_geometry_names[GMX_NBLIST_GEOMETRY_NR + 1] = {
193     "Particle-Particle", "Water3-Particle", "Water3-Water3", "Water4-Particle",
194     "Water4-Water4",     "CG-CG",           nullptr
195 };
196
197 const char* gmx_nblist_interaction_names[GMX_NBLIST_INTERACTION_NR + 1] = { "Standard",
198                                                                             "Free_Energy",
199                                                                             nullptr };
200
201 const char* gmx_nbkernel_elec_names[GMX_NBKERNEL_ELEC_NR + 1] = {
202     "None", "Coulomb", "Reaction-Field", "Cubic-Spline-Table", "Ewald", nullptr
203 };
204
205 const char* gmx_nbkernel_vdw_names[GMX_NBKERNEL_VDW_NR + 1] = { "None",       "Lennard-Jones",
206                                                                 "Buckingham", "Cubic-Spline-Table",
207                                                                 "LJEwald",    nullptr };