Remove macros in input file reading
authorPaul Bauer <paul.bauer.q@gmail.com>
Mon, 28 May 2018 11:24:26 +0000 (13:24 +0200)
committerErik Lindahl <erik.lindahl@gmail.com>
Thu, 7 Jun 2018 13:18:30 +0000 (15:18 +0200)
Removed macros used when parsing input files with the actual functions.
Added functions that wrap the comment string printing. Removed unused
variables that resulted from the change.

Change-Id: I1fd09df87095d199caf817b36fdf9e8819f049e3

src/gromacs/awh/read-params.cpp
src/gromacs/fileio/readinp.cpp
src/gromacs/fileio/readinp.h
src/gromacs/gmxana/gmx_xpm2ps.cpp
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/gmxpreprocess/readpull.cpp
src/gromacs/gmxpreprocess/readrot.cpp
src/gromacs/mdlib/membed.cpp

index fa5f9ce6fd02a9214c2b362f73fd730e3ad31742..e7c3eb9656139865b434a5de566e7b41a50c9b65 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -99,19 +99,19 @@ static void readDimParams(int *ninp_p, t_inpfile **inp_p, const char *prefix,
 
     if (bComment)
     {
-        CTYPE("The provider of the reaction coordinate, currently only pull is supported");
+        printStringNoNewline(&ninp, &inp, "The provider of the reaction coordinate, currently only pull is supported");
     }
     char opt[STRLEN];
     sprintf(opt, "%s-coord-provider", prefix);
-    EETYPE(opt, dimParams->eCoordProvider, eawhcoordprovider_names);
+    dimParams->eCoordProvider = get_eeenum(&ninp, &inp, opt, eawhcoordprovider_names, wi);
 
     if (bComment)
     {
-        CTYPE("The coordinate index for this dimension");
+        printStringNoNewline(&ninp, &inp, "The coordinate index for this dimension");
     }
     sprintf(opt, "%s-coord-index", prefix);
     int coordIndexInput;
-    ITYPE(opt, coordIndexInput, 1);
+    coordIndexInput = get_eint(&ninp, &inp, opt, 1, wi);
     if (coordIndexInput <  1)
     {
         gmx_fatal(FARGS, "Failed to read a valid coordinate index for %s. "
@@ -144,14 +144,14 @@ static void readDimParams(int *ninp_p, t_inpfile **inp_p, const char *prefix,
 
     if (bComment)
     {
-        CTYPE("Start and end values for each coordinate dimension");
+        printStringNoNewline(&ninp, &inp, "Start and end values for each coordinate dimension");
     }
 
     sprintf(opt, "%s-start", prefix);
-    RTYPE(opt, dimParams->origin, 0.);
+    dimParams->origin = get_ereal(&ninp, &inp, opt, 0., wi);
 
     sprintf(opt, "%s-end", prefix);
-    RTYPE(opt, dimParams->end, 0.);
+    dimParams->end = get_ereal(&ninp, &inp, opt, 0., wi);
 
     if (gmx_within_tol(dimParams->end - dimParams->origin, 0, GMX_REAL_EPS))
     {
@@ -189,10 +189,10 @@ static void readDimParams(int *ninp_p, t_inpfile **inp_p, const char *prefix,
 
     if (bComment)
     {
-        CTYPE("The force constant for this coordinate (kJ/mol/nm^2 or kJ/mol/rad^2)");
+        printStringNoNewline(&ninp, &inp, "The force constant for this coordinate (kJ/mol/nm^2 or kJ/mol/rad^2)");
     }
     sprintf(opt, "%s-force-constant", prefix);
-    RTYPE(opt, dimParams->forceConstant, 0);
+    dimParams->forceConstant = get_ereal(&ninp, &inp, opt, 0, wi);
     if (dimParams->forceConstant <= 0)
     {
         warning_error(wi, "The force AWH bias force constant should be > 0");
@@ -200,10 +200,10 @@ static void readDimParams(int *ninp_p, t_inpfile **inp_p, const char *prefix,
 
     if (bComment)
     {
-        CTYPE("Estimated diffusion constant (nm^2/ps or rad^2/ps)");
+        printStringNoNewline(&ninp, &inp, "Estimated diffusion constant (nm^2/ps or rad^2/ps)");
     }
     sprintf(opt, "%s-diffusion", prefix);
-    RTYPE(opt, dimParams->diffusion, 0);
+    dimParams->diffusion = get_ereal(&ninp, &inp, opt, 0, wi);
 
     if (dimParams->diffusion <= 0)
     {
@@ -217,10 +217,10 @@ static void readDimParams(int *ninp_p, t_inpfile **inp_p, const char *prefix,
 
     if (bComment)
     {
-        CTYPE("Diameter that needs to be sampled around a point before it is considered covered.");
+        printStringNoNewline(&ninp, &inp, "Diameter that needs to be sampled around a point before it is considered covered.");
     }
     sprintf(opt, "%s-cover-diameter", prefix);
-    RTYPE(opt, dimParams->coverDiameter, 0);
+    dimParams->coverDiameter = get_ereal(&ninp, &inp, opt, 0, wi);
 
     if (dimParams->coverDiameter < 0)
     {
@@ -266,23 +266,19 @@ static void checkInputConsistencyAwhBias(const AwhBiasParams &awhBiasParams,
 static void read_bias_params(int *ninp_p, t_inpfile **inp_p, AwhBiasParams *awhBiasParams, const char *prefix,
                              const t_inputrec *ir, warninp_t wi, bool bComment)
 {
-    int        ninp;
-    t_inpfile *inp;
+    int        ninp = *ninp_p;
+    t_inpfile *inp  = *inp_p;
     char       opt[STRLEN], prefixdim[STRLEN];
     char       warningmsg[STRLEN];
 
-    /* These are assumed to be declared by the gromacs reading functions */
-    ninp   = *ninp_p;
-    inp    = *inp_p;
-
     if (bComment)
     {
-        CTYPE("Estimated initial PMF error (kJ/mol)");
+        printStringNoNewline(&ninp, &inp, "Estimated initial PMF error (kJ/mol)");
     }
     sprintf(opt, "%s-error-init", prefix);
 
     /* We allow using a default value here without warning (but warn the user if the diffusion constant is not set). */
-    RTYPE(opt, awhBiasParams->errorInitial, 10);
+    awhBiasParams->errorInitial = get_ereal(&ninp, &inp, opt, 10, wi);
     if (awhBiasParams->errorInitial <= 0)
     {
         gmx_fatal(FARGS, "%s (%d) needs to be > 0.", opt);
@@ -290,17 +286,17 @@ static void read_bias_params(int *ninp_p, t_inpfile **inp_p, AwhBiasParams *awhB
 
     if (bComment)
     {
-        CTYPE("Growth rate of the reference histogram determining the bias update size: exp-linear or linear");
+        printStringNoNewline(&ninp, &inp, "Growth rate of the reference histogram determining the bias update size: exp-linear or linear");
     }
     sprintf(opt, "%s-growth", prefix);
-    EETYPE(opt, awhBiasParams->eGrowth, eawhgrowth_names);
+    awhBiasParams->eGrowth = get_eeenum(&ninp, &inp, opt, eawhgrowth_names, wi);
 
     if (bComment)
     {
-        CTYPE("Start the simulation by equilibrating histogram towards the target distribution: no or yes");
+        printStringNoNewline(&ninp, &inp, "Start the simulation by equilibrating histogram towards the target distribution: no or yes");
     }
     sprintf(opt, "%s-equilibrate-histogram", prefix);
-    EETYPE(opt, awhBiasParams->equilibrateHistogram, yesno_names);
+    awhBiasParams->equilibrateHistogram = get_eeenum(&ninp, &inp, opt, yesno_names, wi);
     if (awhBiasParams->equilibrateHistogram && awhBiasParams->eGrowth != eawhgrowthEXP_LINEAR)
     {
         sprintf(warningmsg, "Option %s will only have an effect for histogram growth type '%s'.",
@@ -310,10 +306,10 @@ static void read_bias_params(int *ninp_p, t_inpfile **inp_p, AwhBiasParams *awhB
 
     if (bComment)
     {
-        CTYPE("Target distribution type: constant, cutoff, boltzmann or local-boltzmann");
+        printStringNoNewline(&ninp, &inp, "Target distribution type: constant, cutoff, boltzmann or local-boltzmann");
     }
     sprintf(opt, "%s-target", prefix);
-    EETYPE(opt, awhBiasParams->eTarget, eawhtarget_names);
+    awhBiasParams->eTarget = get_eeenum(&ninp, &inp, opt, eawhtarget_names, wi);
 
     if ((awhBiasParams->eTarget == eawhtargetLOCALBOLTZMANN) &&
         (awhBiasParams->eGrowth == eawhgrowthEXP_LINEAR))
@@ -328,10 +324,10 @@ static void read_bias_params(int *ninp_p, t_inpfile **inp_p, AwhBiasParams *awhB
 
     if (bComment)
     {
-        CTYPE("Boltzmann beta scaling factor for target distribution types 'boltzmann' and 'boltzmann-local'");
+        printStringNoNewline(&ninp, &inp, "Boltzmann beta scaling factor for target distribution types 'boltzmann' and 'boltzmann-local'");
     }
     sprintf(opt, "%s-target-beta-scaling", prefix);
-    RTYPE(opt, awhBiasParams->targetBetaScaling, 0);
+    awhBiasParams->targetBetaScaling = get_ereal(&ninp, &inp, opt, 0, wi);
 
     switch (awhBiasParams->eTarget)
     {
@@ -354,10 +350,10 @@ static void read_bias_params(int *ninp_p, t_inpfile **inp_p, AwhBiasParams *awhB
 
     if (bComment)
     {
-        CTYPE("Free energy cutoff value for target distribution type 'cutoff'");
+        printStringNoNewline(&ninp, &inp, "Free energy cutoff value for target distribution type 'cutoff'");
     }
     sprintf(opt, "%s-target-cutoff", prefix);
-    RTYPE(opt, awhBiasParams->targetCutoff, 0);
+    awhBiasParams->targetCutoff = get_ereal(&ninp, &inp, opt, 0, wi);
 
     switch (awhBiasParams->eTarget)
     {
@@ -379,17 +375,17 @@ static void read_bias_params(int *ninp_p, t_inpfile **inp_p, AwhBiasParams *awhB
 
     if (bComment)
     {
-        CTYPE("Initialize PMF and target with user data: no or yes");
+        printStringNoNewline(&ninp, &inp, "Initialize PMF and target with user data: no or yes");
     }
     sprintf(opt, "%s-user-data", prefix);
-    EETYPE(opt, awhBiasParams->bUserData, yesno_names);
+    awhBiasParams->bUserData = get_eeenum(&ninp, &inp, opt, yesno_names, wi);
 
     if (bComment)
     {
-        CTYPE("Group index to share the bias with, 0 means not shared");
+        printStringNoNewline(&ninp, &inp, "Group index to share the bias with, 0 means not shared");
     }
     sprintf(opt, "%s-share-group", prefix);
-    ITYPE(opt, awhBiasParams->shareGroup, 0);
+    awhBiasParams->shareGroup = get_eint(&ninp, &inp, opt, 0, wi);
     if (awhBiasParams->shareGroup < 0)
     {
         warning_error(wi, "AWH bias share-group should be >= 0");
@@ -397,10 +393,10 @@ static void read_bias_params(int *ninp_p, t_inpfile **inp_p, AwhBiasParams *awhB
 
     if (bComment)
     {
-        CTYPE("Dimensionality of the coordinate");
+        printStringNoNewline(&ninp, &inp, "Dimensionality of the coordinate");
     }
     sprintf(opt, "%s-ndim", prefix);
-    ITYPE(opt, awhBiasParams->ndim, 0);
+    awhBiasParams->ndim = get_eint(&ninp, &inp, opt, 0, wi);
 
     if (awhBiasParams->ndim <= 0 ||
         awhBiasParams->ndim > c_biasMaxNumDim)
@@ -499,22 +495,22 @@ AwhParams *readAndCheckAwhParams(int *ninp_p, t_inpfile **inp_p, const t_inputre
 
     /* Parameters common for all biases */
 
-    CTYPE("The way to apply the biasing potential: convolved or umbrella");
+    printStringNoNewline(&ninp, &inp, "The way to apply the biasing potential: convolved or umbrella");
     sprintf(opt, "%s-potential", prefix);
-    EETYPE(opt, awhParams->ePotential, eawhpotential_names);
+    awhParams->ePotential = get_eeenum(&ninp, &inp, opt, eawhpotential_names, wi);
 
-    CTYPE("The random seed used for sampling the umbrella center in the case of umbrella type potential");
+    printStringNoNewline(&ninp, &inp, "The random seed used for sampling the umbrella center in the case of umbrella type potential");
     sprintf(opt, "%s-seed", prefix);
-    ITYPE(opt, awhParams->seed, -1);
+    awhParams->seed = get_eint(&ninp, &inp, opt, -1, wi);
     if (awhParams->seed == -1)
     {
         awhParams->seed = static_cast<int>(gmx::makeRandomSeed());
         fprintf(stderr, "Setting the AWH bias MC random seed to %" GMX_PRId64 "\n", awhParams->seed);
     }
 
-    CTYPE("Data output interval in number of steps");
+    printStringNoNewline(&ninp, &inp, "Data output interval in number of steps");
     sprintf(opt, "%s-nstout", prefix);
-    ITYPE(opt, awhParams->nstOut, 100000);
+    awhParams->nstOut = get_eint(&ninp, &inp, opt, 100000, wi);
     if (awhParams->nstOut <= 0)
     {
         char buf[STRLEN];
@@ -531,21 +527,21 @@ AwhParams *readAndCheckAwhParams(int *ninp_p, t_inpfile **inp_p, const t_inputre
         warning_error(wi, buf);
     }
 
-    CTYPE("Coordinate sampling interval in number of steps");
+    printStringNoNewline(&ninp, &inp, "Coordinate sampling interval in number of steps");
     sprintf(opt, "%s-nstsample", prefix);
-    ITYPE(opt, awhParams->nstSampleCoord, 10);
+    awhParams->nstSampleCoord = get_eint(&ninp, &inp, opt, 10, wi);
 
-    CTYPE("Free energy and bias update interval in number of samples");
+    printStringNoNewline(&ninp, &inp, "Free energy and bias update interval in number of samples");
     sprintf(opt, "%s-nsamples-update", prefix);
-    ITYPE(opt, awhParams->numSamplesUpdateFreeEnergy, 10);
+    awhParams->numSamplesUpdateFreeEnergy = get_eint(&ninp, &inp, opt, 10, wi);
 
-    CTYPE("When true, biases with share-group>0 are shared between multiple simulations");
+    printStringNoNewline(&ninp, &inp, "When true, biases with share-group>0 are shared between multiple simulations");
     sprintf(opt, "%s-share-multisim", prefix);
-    EETYPE(opt, awhParams->shareBiasMultisim, yesno_names);
+    awhParams->shareBiasMultisim = get_eeenum(&ninp, &inp, opt, yesno_names, wi);
 
-    CTYPE("The number of independent AWH biases");
+    printStringNoNewline(&ninp, &inp, "The number of independent AWH biases");
     sprintf(opt, "%s-nbias", prefix);
-    ITYPE(opt, awhParams->numBias, 1);
+    awhParams->numBias = get_eint(&ninp, &inp, opt, 1, wi);
     if (awhParams->numBias <= 0)
     {
         gmx_fatal(FARGS, "%s needs to be an integer > 0", opt);
index 2f4bb4ad50e6a783bf9bfa0f1e43d01ccbf60825..2dba58e4b8404f1c6ca6fcce8defbd10f03d5484 100644 (file)
@@ -531,3 +531,29 @@ int get_eenum(int *ninp, t_inpfile **inp, const char *name, const char **defs)
 {
     return get_eeenum(ninp, inp, name, defs, nullptr);
 }
+
+void
+printStringNewline(int *ninp, t_inpfile **inp, const char *line)
+{
+    std::string tmp("\n; ");
+    tmp.append(line);
+    get_estr(ninp, inp, tmp.c_str(), NULL);
+}
+
+void
+printStringNoNewline(int *ninp, t_inpfile **inp, const char *line)
+{
+    std::string tmp("; ");
+    tmp.append(line);
+    get_estr(ninp, inp, tmp.c_str(), NULL);
+}
+void
+setStringEntry(int *ninp, t_inpfile **inp, const char *name, char *newName, const char *def)
+{
+    const char *found = nullptr;
+    found = get_estr(ninp, inp, name, def);
+    if (found != nullptr)
+    {
+        std::strcpy(newName, found);
+    }
+}
index 346cc9cd715258ad27a21509ddb709202547e36a..fa35b5f2caba78ebf66c2963a45f19e07d500926 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -131,21 +131,11 @@ int get_eeenum(int *ninp, t_inpfile **inp, const char *name, const char **defs,
 int get_eenum(int *ninp, t_inpfile **inp, const char *name, const char **defs);
 /* defs must be NULL terminated */
 
-/* Here are some dirty macros to extract data from the inp structures.
- * Most macros assume the variables ninp, inp and wi are present.
- * Elements are removed from the list after reading.
- */
-#define REM_TYPE(name)       replace_inp_entry(ninp, inp, name, NULL)
-#define REPL_TYPE(old, new)   replace_inp_entry(ninp, inp, old, new)
-#define STYPE(name, var, def)  if ((tmp = get_estr(&ninp, &inp, name, def)) != NULL) std::strcpy(var, tmp)
-#define STYPENC(name, def) get_estr(&ninp, &inp, name, def)
-#define ITYPE(name, var, def)  var    = get_eint(&ninp, &inp, name, def, wi)
-#define STEPTYPE(name, var, def)  var = get_eint64(&ninp, &inp, name, def, wi)
-#define RTYPE(name, var, def)  var    = get_ereal(&ninp, &inp, name, def, wi)
-#define ETYPE(name, var, defs) var    = get_eenum(&ninp, &inp, name, defs)
-#define EETYPE(name, var, defs) var   = get_eeenum(&ninp, &inp, name, defs, wi)
-#define CCTYPE(s) STYPENC("\n; " s, NULL)
-#define CTYPE(s)  STYPENC("; " s, NULL)
-/* This last one prints a comment line where you can add some explanation */
+//! Replace for macro CCTYPE, prints comment string after newline
+void printStringNewline(int *ninp, t_inpfile **inp, const char *line);
+//! Replace for macro CTYPE, prints comment string
+void printStringNoNewline(int *ninp, t_inpfile **inp, const char *line);
+//! Replace for macro STYPE, checks for existing string entry and if possible replaces it
+void setStringEntry(int *ninp, t_inpfile **inp, const char *name, char *newName, const char *def);
 
 #endif
index 185844fc9a0f76a91aee900672eb91a0fbcda12c..c993a3eda89f7b9fb19aaa7ad225e3e5083f3fa4 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -121,7 +121,6 @@ static void get_params(const char *mpin, const char *mpout, t_psrec *psr)
     static const char *colors[] = { "none", "black", "white", nullptr };
     warninp_t          wi;
     t_inpfile         *inp;
-    const char        *tmp;
     int                ninp = 0;
 
     wi = init_warning(FALSE, 0);
@@ -135,47 +134,47 @@ static void get_params(const char *mpin, const char *mpout, t_psrec *psr)
     {
         inp = nullptr;
     }
-    ETYPE("black&white",    psr->bw,             gmx_bools);
-    RTYPE("linewidth",      psr->linewidth,      1.0);
-    STYPE("titlefont",      psr->titfont,        "Helvetica");
-    RTYPE("titlefontsize",  psr->titfontsize,    20.0);
-    ETYPE("legend",         psr->legend,         gmx_bools);
-    STYPE("legendfont",     psr->legfont,        psr->titfont);
-    STYPE("legendlabel",    psr->leglabel,       "");
-    STYPE("legend2label",   psr->leg2label,      psr->leglabel);
-    RTYPE("legendfontsize", psr->legfontsize,    14.0);
-    RTYPE("xbox",           psr->xboxsize,       0.0);
-    RTYPE("ybox",           psr->yboxsize,       0.0);
-    RTYPE("matrixspacing",  psr->boxspacing,     20.0);
-    RTYPE("xoffset",        psr->xoffs,          0.0);
-    RTYPE("yoffset",        psr->yoffs,          psr->xoffs);
-    RTYPE("boxlinewidth",   psr->boxlinewidth,   psr->linewidth);
-    RTYPE("ticklinewidth",  psr->ticklinewidth,  psr->linewidth);
-    RTYPE("zerolinewidth",  psr->zerolinewidth,  psr->ticklinewidth);
-    ETYPE("x-lineat0value", psr->X.lineatzero,   colors);
-    RTYPE("x-major",        psr->X.major,        1);
-    RTYPE("x-minor",        psr->X.minor,        1);
-    RTYPE("x-firstmajor",   psr->X.offset,       0.0);
-    ETYPE("x-majorat0",     psr->X.first,        gmx_bools);
-    RTYPE("x-majorticklen", psr->X.majorticklen, 8.0);
-    RTYPE("x-minorticklen", psr->X.minorticklen, 4.0);
-    STYPE("x-label",        psr->X.label,        "");
-    RTYPE("x-fontsize",     psr->X.fontsize,     16.0);
-    STYPE("x-font",         psr->X.font,         psr->titfont);
-    RTYPE("x-tickfontsize", psr->X.tickfontsize, 10.0);
-    STYPE("x-tickfont",     psr->X.tickfont,     psr->X.font);
-    ETYPE("y-lineat0value", psr->Y.lineatzero,   colors);
-    RTYPE("y-major",        psr->Y.major,        psr->X.major);
-    RTYPE("y-minor",        psr->Y.minor,        psr->X.minor);
-    RTYPE("y-firstmajor",   psr->Y.offset,       psr->X.offset);
-    ETYPE("y-majorat0",     psr->Y.first,        gmx_bools);
-    RTYPE("y-majorticklen", psr->Y.majorticklen, psr->X.majorticklen);
-    RTYPE("y-minorticklen", psr->Y.minorticklen, psr->X.minorticklen);
-    STYPE("y-label",        psr->Y.label,        psr->X.label);
-    RTYPE("y-fontsize",     psr->Y.fontsize,     psr->X.fontsize);
-    STYPE("y-font",         psr->Y.font,         psr->X.font);
-    RTYPE("y-tickfontsize", psr->Y.tickfontsize, psr->X.tickfontsize);
-    STYPE("y-tickfont",     psr->Y.tickfont,     psr->Y.font);
+    psr->bw        = get_eenum(&ninp, &inp, "black&white",             gmx_bools);
+    psr->linewidth = get_ereal(&ninp, &inp, "linewidth",      1.0, wi);
+    setStringEntry(&ninp, &inp, "titlefont",      psr->titfont,        "Helvetica");
+    psr->titfontsize = get_ereal(&ninp, &inp, "titlefontsize",    20.0, wi);
+    psr->legend      = get_eenum(&ninp, &inp, "legend",         gmx_bools);
+    setStringEntry(&ninp, &inp, "legendfont",     psr->legfont,        psr->titfont);
+    setStringEntry(&ninp, &inp, "legendlabel",    psr->leglabel,       "");
+    setStringEntry(&ninp, &inp, "legend2label",   psr->leg2label,      psr->leglabel);
+    psr->legfontsize    = get_ereal(&ninp, &inp, "legendfontsize",    14.0, wi);
+    psr->xboxsize       = get_ereal(&ninp, &inp, "xbox",       0.0, wi);
+    psr->yboxsize       = get_ereal(&ninp, &inp, "ybox",       0.0, wi);
+    psr->boxspacing     = get_ereal(&ninp, &inp, "matrixspacing",     20.0, wi);
+    psr->xoffs          = get_ereal(&ninp, &inp, "xoffset",          0.0, wi);
+    psr->yoffs          = get_ereal(&ninp, &inp, "yoffset",          psr->xoffs, wi);
+    psr->boxlinewidth   = get_ereal(&ninp, &inp, "boxlinewidth",   psr->linewidth, wi);
+    psr->ticklinewidth  = get_ereal(&ninp, &inp, "ticklinewidth",  psr->linewidth, wi);
+    psr->zerolinewidth  = get_ereal(&ninp, &inp, "zerolinewidth",  psr->ticklinewidth, wi);
+    psr->X.lineatzero   = get_eenum(&ninp, &inp, "x-lineat0value",   colors);
+    psr->X.major        = get_ereal(&ninp, &inp, "x-major",        1, wi);
+    psr->X.minor        = get_ereal(&ninp, &inp, "x-minor",        1, wi);
+    psr->X.offset       = get_ereal(&ninp, &inp, "x-firstmajor",       0.0, wi);
+    psr->X.first        = get_eenum(&ninp, &inp, "x-majorat0",        gmx_bools);
+    psr->X.majorticklen = get_ereal(&ninp, &inp, "x-majorticklen", 8.0, wi);
+    psr->X.minorticklen = get_ereal(&ninp, &inp, "x-minorticklen", 4.0, wi);
+    setStringEntry(&ninp, &inp, "x-label",        psr->X.label,        "");
+    psr->X.fontsize = get_ereal(&ninp, &inp, "x-fontsize",     16.0, wi);
+    setStringEntry(&ninp, &inp, "x-font",         psr->X.font,         psr->titfont);
+    psr->X.tickfontsize = get_ereal(&ninp, &inp, "x-tickfontsize", 10.0, wi);
+    setStringEntry(&ninp, &inp, "x-tickfont",     psr->X.tickfont,     psr->X.font);
+    psr->Y.lineatzero   = get_eenum(&ninp, &inp, "y-lineat0value",   colors);
+    psr->Y.major        = get_ereal(&ninp, &inp, "y-major",        psr->X.major, wi);
+    psr->Y.minor        = get_ereal(&ninp, &inp, "y-minor",        psr->X.minor, wi);
+    psr->Y.offset       = get_ereal(&ninp, &inp, "y-firstmajor",       psr->X.offset, wi);
+    psr->Y.first        = get_eenum(&ninp, &inp, "y-majorat0",        gmx_bools);
+    psr->Y.majorticklen = get_ereal(&ninp, &inp, "y-majorticklen", psr->X.majorticklen, wi);
+    psr->Y.minorticklen = get_ereal(&ninp, &inp, "y-minorticklen", psr->X.minorticklen, wi);
+    setStringEntry(&ninp, &inp, "y-label",        psr->Y.label,        psr->X.label);
+    psr->Y.fontsize = get_ereal(&ninp, &inp, "y-fontsize",     psr->X.fontsize, wi);
+    setStringEntry(&ninp, &inp, "y-font",         psr->Y.font,         psr->X.font);
+    psr->Y.tickfontsize = get_ereal(&ninp, &inp, "y-tickfontsize", psr->X.tickfontsize, wi);
+    setStringEntry(&ninp, &inp, "y-tickfont",     psr->Y.tickfont,     psr->Y.font);
 
     check_warning_error(wi, FARGS);
 
index 0d1cd8ae4647f95976a6f13acddc4a67ee3bc07c..19c0588dc04b9a900be92766ec69a19ac0d80a3c 100644 (file)
@@ -1673,30 +1673,30 @@ static void read_expandedparams(int *ninp_p, t_inpfile **inp_p,
     inp    = *inp_p;
 
     /* read expanded ensemble parameters */
-    CCTYPE ("expanded ensemble variables");
-    ITYPE ("nstexpanded", expand->nstexpanded, -1);
-    EETYPE("lmc-stats", expand->elamstats, elamstats_names);
-    EETYPE("lmc-move", expand->elmcmove, elmcmove_names);
-    EETYPE("lmc-weights-equil", expand->elmceq, elmceq_names);
-    ITYPE ("weight-equil-number-all-lambda", expand->equil_n_at_lam, -1);
-    ITYPE ("weight-equil-number-samples", expand->equil_samples, -1);
-    ITYPE ("weight-equil-number-steps", expand->equil_steps, -1);
-    RTYPE ("weight-equil-wl-delta", expand->equil_wl_delta, -1);
-    RTYPE ("weight-equil-count-ratio", expand->equil_ratio, -1);
-    CCTYPE("Seed for Monte Carlo in lambda space");
-    ITYPE ("lmc-seed", expand->lmc_seed, -1);
-    RTYPE ("mc-temperature", expand->mc_temp, -1);
-    ITYPE ("lmc-repeats", expand->lmc_repeats, 1);
-    ITYPE ("lmc-gibbsdelta", expand->gibbsdeltalam, -1);
-    ITYPE ("lmc-forced-nstart", expand->lmc_forced_nstart, 0);
-    EETYPE("symmetrized-transition-matrix", expand->bSymmetrizedTMatrix, yesno_names);
-    ITYPE("nst-transition-matrix", expand->nstTij, -1);
-    ITYPE ("mininum-var-min", expand->minvarmin, 100); /*default is reasonable */
-    ITYPE ("weight-c-range", expand->c_range, 0);      /* default is just C=0 */
-    RTYPE ("wl-scale", expand->wl_scale, 0.8);
-    RTYPE ("wl-ratio", expand->wl_ratio, 0.8);
-    RTYPE ("init-wl-delta", expand->init_wl_delta, 1.0);
-    EETYPE("wl-oneovert", expand->bWLoneovert, yesno_names);
+    printStringNewline(&ninp, &inp, "expanded ensemble variables");
+    expand->nstexpanded    = get_eint(&ninp, &inp, "nstexpanded", -1, wi);
+    expand->elamstats      = get_eeenum(&ninp, &inp, "lmc-stats", elamstats_names, wi);
+    expand->elmcmove       = get_eeenum(&ninp, &inp, "lmc-move", elmcmove_names, wi);
+    expand->elmceq         = get_eeenum(&ninp, &inp, "lmc-weights-equil", elmceq_names, wi);
+    expand->equil_n_at_lam = get_eint(&ninp, &inp, "weight-equil-number-all-lambda", -1, wi);
+    expand->equil_samples  = get_eint(&ninp, &inp, "weight-equil-number-samples", -1, wi);
+    expand->equil_steps    = get_eint(&ninp, &inp, "weight-equil-number-steps", -1, wi);
+    expand->equil_wl_delta = get_ereal(&ninp, &inp, "weight-equil-wl-delta", -1, wi);
+    expand->equil_ratio    = get_ereal(&ninp, &inp, "weight-equil-count-ratio", -1, wi);
+    printStringNewline(&ninp, &inp, "Seed for Monte Carlo in lambda space");
+    expand->lmc_seed            = get_eint(&ninp, &inp, "lmc-seed", -1, wi);
+    expand->mc_temp             = get_ereal(&ninp, &inp, "mc-temperature", -1, wi);
+    expand->lmc_repeats         = get_eint(&ninp, &inp, "lmc-repeats", 1, wi);
+    expand->gibbsdeltalam       = get_eint(&ninp, &inp, "lmc-gibbsdelta", -1, wi);
+    expand->lmc_forced_nstart   = get_eint(&ninp, &inp, "lmc-forced-nstart", 0, wi);
+    expand->bSymmetrizedTMatrix = get_eeenum(&ninp, &inp, "symmetrized-transition-matrix", yesno_names, wi);
+    expand->nstTij              = get_eint(&ninp, &inp, "nst-transition-matrix", -1, wi);
+    expand->minvarmin           = get_eint(&ninp, &inp, "mininum-var-min", 100, wi); /*default is reasonable */
+    expand->c_range             = get_eint(&ninp, &inp, "weight-c-range", 0, wi);    /* default is just C=0 */
+    expand->wl_scale            = get_ereal(&ninp, &inp, "wl-scale", 0.8, wi);
+    expand->wl_ratio            = get_ereal(&ninp, &inp, "wl-ratio", 0.8, wi);
+    expand->init_wl_delta       = get_ereal(&ninp, &inp, "init-wl-delta", 1.0, wi);
+    expand->bWLoneovert         = get_eeenum(&ninp, &inp, "wl-oneovert", yesno_names, wi);
 
     *ninp_p   = ninp;
     *inp_p    = inp;
@@ -1767,7 +1767,6 @@ void get_ir(const char *mdparin, const char *mdparout,
     char       *dumstr[2];
     double      dumdub[2][6];
     t_inpfile  *inp;
-    const char *tmp;
     int         i, j, m, ninp;
     char        warn_buf[STRLEN];
     t_lambda   *fep    = ir->fepvals;
@@ -1795,283 +1794,283 @@ void get_ir(const char *mdparin, const char *mdparout,
     }
 
     /* ignore the following deprecated commands */
-    REM_TYPE("title");
-    REM_TYPE("cpp");
-    REM_TYPE("domain-decomposition");
-    REM_TYPE("andersen-seed");
-    REM_TYPE("dihre");
-    REM_TYPE("dihre-fc");
-    REM_TYPE("dihre-tau");
-    REM_TYPE("nstdihreout");
-    REM_TYPE("nstcheckpoint");
-    REM_TYPE("optimize-fft");
-    REM_TYPE("adress_type");
-    REM_TYPE("adress_const_wf");
-    REM_TYPE("adress_ex_width");
-    REM_TYPE("adress_hy_width");
-    REM_TYPE("adress_ex_forcecap");
-    REM_TYPE("adress_interface_correction");
-    REM_TYPE("adress_site");
-    REM_TYPE("adress_reference_coords");
-    REM_TYPE("adress_tf_grp_names");
-    REM_TYPE("adress_cg_grp_names");
-    REM_TYPE("adress_do_hybridpairs");
-    REM_TYPE("rlistlong");
-    REM_TYPE("nstcalclr");
-    REM_TYPE("pull-print-com2");
-    REM_TYPE("gb-algorithm");
-    REM_TYPE("nstgbradii");
-    REM_TYPE("rgbradii");
-    REM_TYPE("gb-epsilon-solvent");
-    REM_TYPE("gb-saltconc");
-    REM_TYPE("gb-obc-alpha");
-    REM_TYPE("gb-obc-beta");
-    REM_TYPE("gb-obc-gamma");
-    REM_TYPE("gb-dielectric-offset");
-    REM_TYPE("sa-algorithm");
-    REM_TYPE("sa-surface-tension");
+    replace_inp_entry(ninp, inp, "title", NULL);
+    replace_inp_entry(ninp, inp, "cpp", NULL);
+    replace_inp_entry(ninp, inp, "domain-decomposition", NULL);
+    replace_inp_entry(ninp, inp, "andersen-seed", NULL);
+    replace_inp_entry(ninp, inp, "dihre", NULL);
+    replace_inp_entry(ninp, inp, "dihre-fc", NULL);
+    replace_inp_entry(ninp, inp, "dihre-tau", NULL);
+    replace_inp_entry(ninp, inp, "nstdihreout", NULL);
+    replace_inp_entry(ninp, inp, "nstcheckpoint", NULL);
+    replace_inp_entry(ninp, inp, "optimize-fft", NULL);
+    replace_inp_entry(ninp, inp, "adress_type", NULL);
+    replace_inp_entry(ninp, inp, "adress_const_wf", NULL);
+    replace_inp_entry(ninp, inp, "adress_ex_width", NULL);
+    replace_inp_entry(ninp, inp, "adress_hy_width", NULL);
+    replace_inp_entry(ninp, inp, "adress_ex_forcecap", NULL);
+    replace_inp_entry(ninp, inp, "adress_interface_correction", NULL);
+    replace_inp_entry(ninp, inp, "adress_site", NULL);
+    replace_inp_entry(ninp, inp, "adress_reference_coords", NULL);
+    replace_inp_entry(ninp, inp, "adress_tf_grp_names", NULL);
+    replace_inp_entry(ninp, inp, "adress_cg_grp_names", NULL);
+    replace_inp_entry(ninp, inp, "adress_do_hybridpairs", NULL);
+    replace_inp_entry(ninp, inp, "rlistlong", NULL);
+    replace_inp_entry(ninp, inp, "nstcalclr", NULL);
+    replace_inp_entry(ninp, inp, "pull-print-com2", NULL);
+    replace_inp_entry(ninp, inp, "gb-algorithm", NULL);
+    replace_inp_entry(ninp, inp, "nstgbradii", NULL);
+    replace_inp_entry(ninp, inp, "rgbradii", NULL);
+    replace_inp_entry(ninp, inp, "gb-epsilon-solvent", NULL);
+    replace_inp_entry(ninp, inp, "gb-saltconc", NULL);
+    replace_inp_entry(ninp, inp, "gb-obc-alpha", NULL);
+    replace_inp_entry(ninp, inp, "gb-obc-beta", NULL);
+    replace_inp_entry(ninp, inp, "gb-obc-gamma", NULL);
+    replace_inp_entry(ninp, inp, "gb-dielectric-offset", NULL);
+    replace_inp_entry(ninp, inp, "sa-algorithm", NULL);
+    replace_inp_entry(ninp, inp, "sa-surface-tension", NULL);
 
     /* replace the following commands with the clearer new versions*/
-    REPL_TYPE("unconstrained-start", "continuation");
-    REPL_TYPE("foreign-lambda", "fep-lambdas");
-    REPL_TYPE("verlet-buffer-drift", "verlet-buffer-tolerance");
-    REPL_TYPE("nstxtcout", "nstxout-compressed");
-    REPL_TYPE("xtc-grps", "compressed-x-grps");
-    REPL_TYPE("xtc-precision", "compressed-x-precision");
-    REPL_TYPE("pull-print-com1", "pull-print-com");
-
-    CCTYPE ("VARIOUS PREPROCESSING OPTIONS");
-    CTYPE ("Preprocessor information: use cpp syntax.");
-    CTYPE ("e.g.: -I/home/joe/doe -I/home/mary/roe");
-    STYPE ("include", opts->include,  nullptr);
-    CTYPE ("e.g.: -DPOSRES -DFLEXIBLE (note these variable names are case sensitive)");
-    STYPE ("define",  opts->define,   nullptr);
-
-    CCTYPE ("RUN CONTROL PARAMETERS");
-    EETYPE("integrator",  ir->eI,         ei_names);
-    CTYPE ("Start time and timestep in ps");
-    RTYPE ("tinit",   ir->init_t, 0.0);
-    RTYPE ("dt",      ir->delta_t,    0.001);
-    STEPTYPE ("nsteps",   ir->nsteps,     0);
-    CTYPE ("For exact run continuation or redoing part of a run");
-    STEPTYPE ("init-step", ir->init_step,  0);
-    CTYPE ("Part index is updated automatically on checkpointing (keeps files separate)");
-    ITYPE ("simulation-part", ir->simulation_part, 1);
-    CTYPE ("mode for center of mass motion removal");
-    EETYPE("comm-mode",   ir->comm_mode,  ecm_names);
-    CTYPE ("number of steps for center of mass motion removal");
-    ITYPE ("nstcomm", ir->nstcomm,    100);
-    CTYPE ("group(s) for center of mass motion removal");
-    STYPE ("comm-grps",   is->vcm,            nullptr);
-
-    CCTYPE ("LANGEVIN DYNAMICS OPTIONS");
-    CTYPE ("Friction coefficient (amu/ps) and random seed");
-    RTYPE ("bd-fric",     ir->bd_fric,    0.0);
-    STEPTYPE ("ld-seed",  ir->ld_seed,    -1);
+    replace_inp_entry(ninp, inp, "unconstrained-start", "continuation");
+    replace_inp_entry(ninp, inp, "foreign-lambda", "fep-lambdas");
+    replace_inp_entry(ninp, inp, "verlet-buffer-drift", "verlet-buffer-tolerance");
+    replace_inp_entry(ninp, inp, "nstxtcout", "nstxout-compressed");
+    replace_inp_entry(ninp, inp, "xtc-grps", "compressed-x-grps");
+    replace_inp_entry(ninp, inp, "xtc-precision", "compressed-x-precision");
+    replace_inp_entry(ninp, inp, "pull-print-com1", "pull-print-com");
+
+    printStringNewline(&ninp, &inp, "VARIOUS PREPROCESSING OPTIONS");
+    printStringNoNewline(&ninp, &inp, "Preprocessor information: use cpp syntax.");
+    printStringNoNewline(&ninp, &inp, "e.g.: -I/home/joe/doe -I/home/mary/roe");
+    setStringEntry(&ninp, &inp, "include", opts->include,  nullptr);
+    printStringNoNewline(&ninp, &inp, "e.g.: -DPOSRES -DFLEXIBLE (note these variable names are case sensitive)");
+    setStringEntry(&ninp, &inp, "define",  opts->define,   nullptr);
+
+    printStringNewline(&ninp, &inp, "RUN CONTROL PARAMETERS");
+    ir->eI = get_eeenum(&ninp, &inp, "integrator",         ei_names, wi);
+    printStringNoNewline(&ninp, &inp, "Start time and timestep in ps");
+    ir->init_t  = get_ereal(&ninp, &inp, "tinit", 0.0, wi);
+    ir->delta_t = get_ereal(&ninp, &inp, "dt",    0.001, wi);
+    ir->nsteps  = get_eint64(&ninp, &inp, "nsteps",     0, wi);
+    printStringNoNewline(&ninp, &inp, "For exact run continuation or redoing part of a run");
+    ir->init_step = get_eint64(&ninp, &inp, "init-step",  0, wi);
+    printStringNoNewline(&ninp, &inp, "Part index is updated automatically on checkpointing (keeps files separate)");
+    ir->simulation_part = get_eint(&ninp, &inp, "simulation-part", 1, wi);
+    printStringNoNewline(&ninp, &inp, "mode for center of mass motion removal");
+    ir->comm_mode = get_eeenum(&ninp, &inp, "comm-mode",  ecm_names, wi);
+    printStringNoNewline(&ninp, &inp, "number of steps for center of mass motion removal");
+    ir->nstcomm = get_eint(&ninp, &inp, "nstcomm",    100, wi);
+    printStringNoNewline(&ninp, &inp, "group(s) for center of mass motion removal");
+    setStringEntry(&ninp, &inp, "comm-grps",   is->vcm,            nullptr);
+
+    printStringNewline(&ninp, &inp, "LANGEVIN DYNAMICS OPTIONS");
+    printStringNoNewline(&ninp, &inp, "Friction coefficient (amu/ps) and random seed");
+    ir->bd_fric = get_ereal(&ninp, &inp, "bd-fric",    0.0, wi);
+    ir->ld_seed = get_eint64(&ninp, &inp, "ld-seed",    -1, wi);
 
     /* Em stuff */
-    CCTYPE ("ENERGY MINIMIZATION OPTIONS");
-    CTYPE ("Force tolerance and initial step-size");
-    RTYPE ("emtol",       ir->em_tol,     10.0);
-    RTYPE ("emstep",      ir->em_stepsize, 0.01);
-    CTYPE ("Max number of iterations in relax-shells");
-    ITYPE ("niter",       ir->niter,      20);
-    CTYPE ("Step size (ps^2) for minimization of flexible constraints");
-    RTYPE ("fcstep",      ir->fc_stepsize, 0);
-    CTYPE ("Frequency of steepest descents steps when doing CG");
-    ITYPE ("nstcgsteep",  ir->nstcgsteep, 1000);
-    ITYPE ("nbfgscorr",   ir->nbfgscorr,  10);
-
-    CCTYPE ("TEST PARTICLE INSERTION OPTIONS");
-    RTYPE ("rtpi",    ir->rtpi,   0.05);
+    printStringNewline(&ninp, &inp, "ENERGY MINIMIZATION OPTIONS");
+    printStringNoNewline(&ninp, &inp, "Force tolerance and initial step-size");
+    ir->em_tol      = get_ereal(&ninp, &inp, "emtol",     10.0, wi);
+    ir->em_stepsize = get_ereal(&ninp, &inp, "emstep", 0.01, wi);
+    printStringNoNewline(&ninp, &inp, "Max number of iterations in relax-shells");
+    ir->niter = get_eint(&ninp, &inp, "niter",      20, wi);
+    printStringNoNewline(&ninp, &inp, "Step size (ps^2) for minimization of flexible constraints");
+    ir->fc_stepsize = get_ereal(&ninp, &inp, "fcstep", 0, wi);
+    printStringNoNewline(&ninp, &inp, "Frequency of steepest descents steps when doing CG");
+    ir->nstcgsteep = get_eint(&ninp, &inp, "nstcgsteep", 1000, wi);
+    ir->nbfgscorr  = get_eint(&ninp, &inp, "nbfgscorr",  10, wi);
+
+    printStringNewline(&ninp, &inp, "TEST PARTICLE INSERTION OPTIONS");
+    ir->rtpi = get_ereal(&ninp, &inp, "rtpi",   0.05, wi);
 
     /* Output options */
-    CCTYPE ("OUTPUT CONTROL OPTIONS");
-    CTYPE ("Output frequency for coords (x), velocities (v) and forces (f)");
-    ITYPE ("nstxout", ir->nstxout,    0);
-    ITYPE ("nstvout", ir->nstvout,    0);
-    ITYPE ("nstfout", ir->nstfout,    0);
-    CTYPE ("Output frequency for energies to log file and energy file");
-    ITYPE ("nstlog",  ir->nstlog, 1000);
-    ITYPE ("nstcalcenergy", ir->nstcalcenergy, 100);
-    ITYPE ("nstenergy",   ir->nstenergy,  1000);
-    CTYPE ("Output frequency and precision for .xtc file");
-    ITYPE ("nstxout-compressed", ir->nstxout_compressed,  0);
-    RTYPE ("compressed-x-precision", ir->x_compression_precision, 1000.0);
-    CTYPE ("This selects the subset of atoms for the compressed");
-    CTYPE ("trajectory file. You can select multiple groups. By");
-    CTYPE ("default, all atoms will be written.");
-    STYPE ("compressed-x-grps", is->x_compressed_groups, nullptr);
-    CTYPE ("Selection of energy groups");
-    STYPE ("energygrps",  is->energy,         nullptr);
+    printStringNewline(&ninp, &inp, "OUTPUT CONTROL OPTIONS");
+    printStringNoNewline(&ninp, &inp, "Output frequency for coords (x), velocities (v) and forces (f)");
+    ir->nstxout = get_eint(&ninp, &inp, "nstxout",    0, wi);
+    ir->nstvout = get_eint(&ninp, &inp, "nstvout",    0, wi);
+    ir->nstfout = get_eint(&ninp, &inp, "nstfout",    0, wi);
+    printStringNoNewline(&ninp, &inp, "Output frequency for energies to log file and energy file");
+    ir->nstlog        = get_eint(&ninp, &inp, "nstlog", 1000, wi);
+    ir->nstcalcenergy = get_eint(&ninp, &inp, "nstcalcenergy", 100, wi);
+    ir->nstenergy     = get_eint(&ninp, &inp, "nstenergy",  1000, wi);
+    printStringNoNewline(&ninp, &inp, "Output frequency and precision for .xtc file");
+    ir->nstxout_compressed      = get_eint(&ninp, &inp, "nstxout-compressed",  0, wi);
+    ir->x_compression_precision = get_ereal(&ninp, &inp, "compressed-x-precision", 1000.0, wi);
+    printStringNoNewline(&ninp, &inp, "This selects the subset of atoms for the compressed");
+    printStringNoNewline(&ninp, &inp, "trajectory file. You can select multiple groups. By");
+    printStringNoNewline(&ninp, &inp, "default, all atoms will be written.");
+    setStringEntry(&ninp, &inp, "compressed-x-grps", is->x_compressed_groups, nullptr);
+    printStringNoNewline(&ninp, &inp, "Selection of energy groups");
+    setStringEntry(&ninp, &inp, "energygrps",  is->energy,         nullptr);
 
     /* Neighbor searching */
-    CCTYPE ("NEIGHBORSEARCHING PARAMETERS");
-    CTYPE ("cut-off scheme (Verlet: particle based cut-offs, group: using charge groups)");
-    EETYPE("cutoff-scheme",     ir->cutoff_scheme,    ecutscheme_names);
-    CTYPE ("nblist update frequency");
-    ITYPE ("nstlist", ir->nstlist,    10);
-    CTYPE ("ns algorithm (simple or grid)");
-    EETYPE("ns-type",     ir->ns_type,    ens_names);
-    CTYPE ("Periodic boundary conditions: xyz, no, xy");
-    EETYPE("pbc",         ir->ePBC,       epbc_names);
-    EETYPE("periodic-molecules", ir->bPeriodicMols, yesno_names);
-    CTYPE ("Allowed energy error due to the Verlet buffer in kJ/mol/ps per atom,");
-    CTYPE ("a value of -1 means: use rlist");
-    RTYPE("verlet-buffer-tolerance", ir->verletbuf_tol,    0.005);
-    CTYPE ("nblist cut-off");
-    RTYPE ("rlist",   ir->rlist,  1.0);
-    CTYPE ("long-range cut-off for switched potentials");
+    printStringNewline(&ninp, &inp, "NEIGHBORSEARCHING PARAMETERS");
+    printStringNoNewline(&ninp, &inp, "cut-off scheme (Verlet: particle based cut-offs, group: using charge groups)");
+    ir->cutoff_scheme = get_eeenum(&ninp, &inp, "cutoff-scheme",    ecutscheme_names, wi);
+    printStringNoNewline(&ninp, &inp, "nblist update frequency");
+    ir->nstlist = get_eint(&ninp, &inp, "nstlist",    10, wi);
+    printStringNoNewline(&ninp, &inp, "ns algorithm (simple or grid)");
+    ir->ns_type = get_eeenum(&ninp, &inp, "ns-type",    ens_names, wi);
+    printStringNoNewline(&ninp, &inp, "Periodic boundary conditions: xyz, no, xy");
+    ir->ePBC          = get_eeenum(&ninp, &inp, "pbc",       epbc_names, wi);
+    ir->bPeriodicMols = get_eeenum(&ninp, &inp, "periodic-molecules", yesno_names, wi);
+    printStringNoNewline(&ninp, &inp, "Allowed energy error due to the Verlet buffer in kJ/mol/ps per atom,");
+    printStringNoNewline(&ninp, &inp, "a value of -1 means: use rlist");
+    ir->verletbuf_tol = get_ereal(&ninp, &inp, "verlet-buffer-tolerance",    0.005, wi);
+    printStringNoNewline(&ninp, &inp, "nblist cut-off");
+    ir->rlist = get_ereal(&ninp, &inp, "rlist",  1.0, wi);
+    printStringNoNewline(&ninp, &inp, "long-range cut-off for switched potentials");
 
     /* Electrostatics */
-    CCTYPE ("OPTIONS FOR ELECTROSTATICS AND VDW");
-    CTYPE ("Method for doing electrostatics");
-    EETYPE("coulombtype", ir->coulombtype,    eel_names);
-    EETYPE("coulomb-modifier",    ir->coulomb_modifier,    eintmod_names);
-    CTYPE ("cut-off lengths");
-    RTYPE ("rcoulomb-switch", ir->rcoulomb_switch,    0.0);
-    RTYPE ("rcoulomb",    ir->rcoulomb,   1.0);
-    CTYPE ("Relative dielectric constant for the medium and the reaction field");
-    RTYPE ("epsilon-r",   ir->epsilon_r,  1.0);
-    RTYPE ("epsilon-rf",  ir->epsilon_rf, 0.0);
-    CTYPE ("Method for doing Van der Waals");
-    EETYPE("vdw-type",    ir->vdwtype,    evdw_names);
-    EETYPE("vdw-modifier",    ir->vdw_modifier,    eintmod_names);
-    CTYPE ("cut-off lengths");
-    RTYPE ("rvdw-switch", ir->rvdw_switch,    0.0);
-    RTYPE ("rvdw",    ir->rvdw,   1.0);
-    CTYPE ("Apply long range dispersion corrections for Energy and Pressure");
-    EETYPE("DispCorr",    ir->eDispCorr,  edispc_names);
-    CTYPE ("Extension of the potential lookup tables beyond the cut-off");
-    RTYPE ("table-extension", ir->tabext, 1.0);
-    CTYPE ("Separate tables between energy group pairs");
-    STYPE ("energygrp-table", is->egptable,   nullptr);
-    CTYPE ("Spacing for the PME/PPPM FFT grid");
-    RTYPE ("fourierspacing", ir->fourier_spacing, 0.12);
-    CTYPE ("FFT grid size, when a value is 0 fourierspacing will be used");
-    ITYPE ("fourier-nx",  ir->nkx,         0);
-    ITYPE ("fourier-ny",  ir->nky,         0);
-    ITYPE ("fourier-nz",  ir->nkz,         0);
-    CTYPE ("EWALD/PME/PPPM parameters");
-    ITYPE ("pme-order",   ir->pme_order,   4);
-    RTYPE ("ewald-rtol",  ir->ewald_rtol, 0.00001);
-    RTYPE ("ewald-rtol-lj", ir->ewald_rtol_lj, 0.001);
-    EETYPE("lj-pme-comb-rule", ir->ljpme_combination_rule, eljpme_names);
-    EETYPE("ewald-geometry", ir->ewald_geometry, eewg_names);
-    RTYPE ("epsilon-surface", ir->epsilon_surface, 0.0);
+    printStringNewline(&ninp, &inp, "OPTIONS FOR ELECTROSTATICS AND VDW");
+    printStringNoNewline(&ninp, &inp, "Method for doing electrostatics");
+    ir->coulombtype      = get_eeenum(&ninp, &inp, "coulombtype",    eel_names, wi);
+    ir->coulomb_modifier = get_eeenum(&ninp, &inp, "coulomb-modifier",    eintmod_names, wi);
+    printStringNoNewline(&ninp, &inp, "cut-off lengths");
+    ir->rcoulomb_switch = get_ereal(&ninp, &inp, "rcoulomb-switch",    0.0, wi);
+    ir->rcoulomb        = get_ereal(&ninp, &inp, "rcoulomb",   1.0, wi);
+    printStringNoNewline(&ninp, &inp, "Relative dielectric constant for the medium and the reaction field");
+    ir->epsilon_r  = get_ereal(&ninp, &inp, "epsilon-r",  1.0, wi);
+    ir->epsilon_rf = get_ereal(&ninp, &inp, "epsilon-rf", 0.0, wi);
+    printStringNoNewline(&ninp, &inp, "Method for doing Van der Waals");
+    ir->vdwtype      = get_eeenum(&ninp, &inp, "vdw-type",    evdw_names, wi);
+    ir->vdw_modifier = get_eeenum(&ninp, &inp, "vdw-modifier",    eintmod_names, wi);
+    printStringNoNewline(&ninp, &inp, "cut-off lengths");
+    ir->rvdw_switch = get_ereal(&ninp, &inp, "rvdw-switch",    0.0, wi);
+    ir->rvdw        = get_ereal(&ninp, &inp, "rvdw",   1.0, wi);
+    printStringNoNewline(&ninp, &inp, "Apply long range dispersion corrections for Energy and Pressure");
+    ir->eDispCorr = get_eeenum(&ninp, &inp, "DispCorr",  edispc_names, wi);
+    printStringNoNewline(&ninp, &inp, "Extension of the potential lookup tables beyond the cut-off");
+    ir->tabext = get_ereal(&ninp, &inp, "table-extension", 1.0, wi);
+    printStringNoNewline(&ninp, &inp, "Separate tables between energy group pairs");
+    setStringEntry(&ninp, &inp, "energygrp-table", is->egptable,   nullptr);
+    printStringNoNewline(&ninp, &inp, "Spacing for the PME/PPPM FFT grid");
+    ir->fourier_spacing = get_ereal(&ninp, &inp, "fourierspacing", 0.12, wi);
+    printStringNoNewline(&ninp, &inp, "FFT grid size, when a value is 0 fourierspacing will be used");
+    ir->nkx = get_eint(&ninp, &inp, "fourier-nx",         0, wi);
+    ir->nky = get_eint(&ninp, &inp, "fourier-ny",         0, wi);
+    ir->nkz = get_eint(&ninp, &inp, "fourier-nz",         0, wi);
+    printStringNoNewline(&ninp, &inp, "EWALD/PME/PPPM parameters");
+    ir->pme_order              = get_eint(&ninp, &inp, "pme-order",   4, wi);
+    ir->ewald_rtol             = get_ereal(&ninp, &inp, "ewald-rtol", 0.00001, wi);
+    ir->ewald_rtol_lj          = get_ereal(&ninp, &inp, "ewald-rtol-lj", 0.001, wi);
+    ir->ljpme_combination_rule = get_eeenum(&ninp, &inp, "lj-pme-comb-rule", eljpme_names, wi);
+    ir->ewald_geometry         = get_eeenum(&ninp, &inp, "ewald-geometry", eewg_names, wi);
+    ir->epsilon_surface        = get_ereal(&ninp, &inp, "epsilon-surface", 0.0, wi);
 
     /* Implicit solvation is no longer supported, but we need grompp
        to be able to refuse old .mdp files that would have built a tpr
        to run it. Thus, only "no" is accepted. */
-    EETYPE("implicit-solvent", ir->implicit_solvent, no_names);
+    ir->implicit_solvent = get_eeenum(&ninp, &inp, "implicit-solvent", no_names, wi);
 
     /* Coupling stuff */
-    CCTYPE ("OPTIONS FOR WEAK COUPLING ALGORITHMS");
-    CTYPE ("Temperature coupling");
-    EETYPE("tcoupl",  ir->etc,        etcoupl_names);
-    ITYPE ("nsttcouple", ir->nsttcouple,  -1);
-    ITYPE("nh-chain-length",     ir->opts.nhchainlength, 10);
-    EETYPE("print-nose-hoover-chain-variables", ir->bPrintNHChains, yesno_names);
-    CTYPE ("Groups to couple separately");
-    STYPE ("tc-grps",     is->tcgrps,         nullptr);
-    CTYPE ("Time constant (ps) and reference temperature (K)");
-    STYPE ("tau-t",   is->tau_t,      nullptr);
-    STYPE ("ref-t",   is->ref_t,      nullptr);
-    CTYPE ("pressure coupling");
-    EETYPE("pcoupl",  ir->epc,        epcoupl_names);
-    EETYPE("pcoupltype",  ir->epct,       epcoupltype_names);
-    ITYPE ("nstpcouple", ir->nstpcouple,  -1);
-    CTYPE ("Time constant (ps), compressibility (1/bar) and reference P (bar)");
-    RTYPE ("tau-p",   ir->tau_p,  1.0);
-    STYPE ("compressibility", dumstr[0],  nullptr);
-    STYPE ("ref-p",       dumstr[1],      nullptr);
-    CTYPE ("Scaling of reference coordinates, No, All or COM");
-    EETYPE ("refcoord-scaling", ir->refcoord_scaling, erefscaling_names);
+    printStringNewline(&ninp, &inp, "OPTIONS FOR WEAK COUPLING ALGORITHMS");
+    printStringNoNewline(&ninp, &inp, "Temperature coupling");
+    ir->etc                = get_eeenum(&ninp, &inp, "tcoupl",        etcoupl_names, wi);
+    ir->nsttcouple         = get_eint(&ninp, &inp, "nsttcouple",  -1, wi);
+    ir->opts.nhchainlength = get_eint(&ninp, &inp, "nh-chain-length", 10, wi);
+    ir->bPrintNHChains     = get_eeenum(&ninp, &inp, "print-nose-hoover-chain-variables", yesno_names, wi);
+    printStringNoNewline(&ninp, &inp, "Groups to couple separately");
+    setStringEntry(&ninp, &inp, "tc-grps",     is->tcgrps,         nullptr);
+    printStringNoNewline(&ninp, &inp, "Time constant (ps) and reference temperature (K)");
+    setStringEntry(&ninp, &inp, "tau-t",   is->tau_t,      nullptr);
+    setStringEntry(&ninp, &inp, "ref-t",   is->ref_t,      nullptr);
+    printStringNoNewline(&ninp, &inp, "pressure coupling");
+    ir->epc        = get_eeenum(&ninp, &inp, "pcoupl",        epcoupl_names, wi);
+    ir->epct       = get_eeenum(&ninp, &inp, "pcoupltype",       epcoupltype_names, wi);
+    ir->nstpcouple = get_eint(&ninp, &inp, "nstpcouple",  -1, wi);
+    printStringNoNewline(&ninp, &inp, "Time constant (ps), compressibility (1/bar) and reference P (bar)");
+    ir->tau_p = get_ereal(&ninp, &inp, "tau-p",  1.0, wi);
+    setStringEntry(&ninp, &inp, "compressibility", dumstr[0],  nullptr);
+    setStringEntry(&ninp, &inp, "ref-p",       dumstr[1],      nullptr);
+    printStringNoNewline(&ninp, &inp, "Scaling of reference coordinates, No, All or COM");
+    ir->refcoord_scaling = get_eeenum(&ninp, &inp, "refcoord-scaling", erefscaling_names, wi);
 
     /* QMMM */
-    CCTYPE ("OPTIONS FOR QMMM calculations");
-    EETYPE("QMMM", ir->bQMMM, yesno_names);
-    CTYPE ("Groups treated Quantum Mechanically");
-    STYPE ("QMMM-grps",  is->QMMM,          nullptr);
-    CTYPE ("QM method");
-    STYPE("QMmethod",     is->QMmethod, nullptr);
-    CTYPE ("QMMM scheme");
-    EETYPE("QMMMscheme",  ir->QMMMscheme,    eQMMMscheme_names);
-    CTYPE ("QM basisset");
-    STYPE("QMbasis",      is->QMbasis, nullptr);
-    CTYPE ("QM charge");
-    STYPE ("QMcharge",    is->QMcharge, nullptr);
-    CTYPE ("QM multiplicity");
-    STYPE ("QMmult",      is->QMmult, nullptr);
-    CTYPE ("Surface Hopping");
-    STYPE ("SH",          is->bSH, nullptr);
-    CTYPE ("CAS space options");
-    STYPE ("CASorbitals",      is->CASorbitals,   nullptr);
-    STYPE ("CASelectrons",     is->CASelectrons,  nullptr);
-    STYPE ("SAon", is->SAon, nullptr);
-    STYPE ("SAoff", is->SAoff, nullptr);
-    STYPE ("SAsteps", is->SAsteps, nullptr);
-    CTYPE ("Scale factor for MM charges");
-    RTYPE ("MMChargeScaleFactor", ir->scalefactor, 1.0);
+    printStringNewline(&ninp, &inp, "OPTIONS FOR QMMM calculations");
+    ir->bQMMM = get_eeenum(&ninp, &inp, "QMMM", yesno_names, wi);
+    printStringNoNewline(&ninp, &inp, "Groups treated Quantum Mechanically");
+    setStringEntry(&ninp, &inp, "QMMM-grps",  is->QMMM,          nullptr);
+    printStringNoNewline(&ninp, &inp, "QM method");
+    setStringEntry(&ninp, &inp, "QMmethod",     is->QMmethod, nullptr);
+    printStringNoNewline(&ninp, &inp, "QMMM scheme");
+    ir->QMMMscheme = get_eeenum(&ninp, &inp, "QMMMscheme",    eQMMMscheme_names, wi);
+    printStringNoNewline(&ninp, &inp, "QM basisset");
+    setStringEntry(&ninp, &inp, "QMbasis",      is->QMbasis, nullptr);
+    printStringNoNewline(&ninp, &inp, "QM charge");
+    setStringEntry(&ninp, &inp, "QMcharge",    is->QMcharge, nullptr);
+    printStringNoNewline(&ninp, &inp, "QM multiplicity");
+    setStringEntry(&ninp, &inp, "QMmult",      is->QMmult, nullptr);
+    printStringNoNewline(&ninp, &inp, "Surface Hopping");
+    setStringEntry(&ninp, &inp, "SH",          is->bSH, nullptr);
+    printStringNoNewline(&ninp, &inp, "CAS space options");
+    setStringEntry(&ninp, &inp, "CASorbitals",      is->CASorbitals,   nullptr);
+    setStringEntry(&ninp, &inp, "CASelectrons",     is->CASelectrons,  nullptr);
+    setStringEntry(&ninp, &inp, "SAon", is->SAon, nullptr);
+    setStringEntry(&ninp, &inp, "SAoff", is->SAoff, nullptr);
+    setStringEntry(&ninp, &inp, "SAsteps", is->SAsteps, nullptr);
+    printStringNoNewline(&ninp, &inp, "Scale factor for MM charges");
+    ir->scalefactor = get_ereal(&ninp, &inp, "MMChargeScaleFactor", 1.0, wi);
 
     /* Simulated annealing */
-    CCTYPE("SIMULATED ANNEALING");
-    CTYPE ("Type of annealing for each temperature group (no/single/periodic)");
-    STYPE ("annealing",   is->anneal,      nullptr);
-    CTYPE ("Number of time points to use for specifying annealing in each group");
-    STYPE ("annealing-npoints", is->anneal_npoints, nullptr);
-    CTYPE ("List of times at the annealing points for each group");
-    STYPE ("annealing-time",       is->anneal_time,       nullptr);
-    CTYPE ("Temp. at each annealing point, for each group.");
-    STYPE ("annealing-temp",  is->anneal_temp,  nullptr);
+    printStringNewline(&ninp, &inp, "SIMULATED ANNEALING");
+    printStringNoNewline(&ninp, &inp, "Type of annealing for each temperature group (no/single/periodic)");
+    setStringEntry(&ninp, &inp, "annealing",   is->anneal,      nullptr);
+    printStringNoNewline(&ninp, &inp, "Number of time points to use for specifying annealing in each group");
+    setStringEntry(&ninp, &inp, "annealing-npoints", is->anneal_npoints, nullptr);
+    printStringNoNewline(&ninp, &inp, "List of times at the annealing points for each group");
+    setStringEntry(&ninp, &inp, "annealing-time",       is->anneal_time,       nullptr);
+    printStringNoNewline(&ninp, &inp, "Temp. at each annealing point, for each group.");
+    setStringEntry(&ninp, &inp, "annealing-temp",  is->anneal_temp,  nullptr);
 
     /* Startup run */
-    CCTYPE ("GENERATE VELOCITIES FOR STARTUP RUN");
-    EETYPE("gen-vel",     opts->bGenVel,  yesno_names);
-    RTYPE ("gen-temp",    opts->tempi,    300.0);
-    ITYPE ("gen-seed",    opts->seed,     -1);
+    printStringNewline(&ninp, &inp, "GENERATE VELOCITIES FOR STARTUP RUN");
+    opts->bGenVel = get_eeenum(&ninp, &inp, "gen-vel",  yesno_names, wi);
+    opts->tempi   = get_ereal(&ninp, &inp, "gen-temp",    300.0, wi);
+    opts->seed    = get_eint(&ninp, &inp, "gen-seed",     -1, wi);
 
     /* Shake stuff */
-    CCTYPE ("OPTIONS FOR BONDS");
-    EETYPE("constraints", opts->nshake,   constraints);
-    CTYPE ("Type of constraint algorithm");
-    EETYPE("constraint-algorithm",  ir->eConstrAlg, econstr_names);
-    CTYPE ("Do not constrain the start configuration");
-    EETYPE("continuation", ir->bContinuation, yesno_names);
-    CTYPE ("Use successive overrelaxation to reduce the number of shake iterations");
-    EETYPE("Shake-SOR", ir->bShakeSOR, yesno_names);
-    CTYPE ("Relative tolerance of shake");
-    RTYPE ("shake-tol", ir->shake_tol, 0.0001);
-    CTYPE ("Highest order in the expansion of the constraint coupling matrix");
-    ITYPE ("lincs-order", ir->nProjOrder, 4);
-    CTYPE ("Number of iterations in the final step of LINCS. 1 is fine for");
-    CTYPE ("normal simulations, but use 2 to conserve energy in NVE runs.");
-    CTYPE ("For energy minimization with constraints it should be 4 to 8.");
-    ITYPE ("lincs-iter", ir->nLincsIter, 1);
-    CTYPE ("Lincs will write a warning to the stderr if in one step a bond");
-    CTYPE ("rotates over more degrees than");
-    RTYPE ("lincs-warnangle", ir->LincsWarnAngle, 30.0);
-    CTYPE ("Convert harmonic bonds to morse potentials");
-    EETYPE("morse",       opts->bMorse, yesno_names);
+    printStringNewline(&ninp, &inp, "OPTIONS FOR BONDS");
+    opts->nshake = get_eeenum(&ninp, &inp, "constraints",   constraints, wi);
+    printStringNoNewline(&ninp, &inp, "Type of constraint algorithm");
+    ir->eConstrAlg = get_eeenum(&ninp, &inp, "constraint-algorithm", econstr_names, wi);
+    printStringNoNewline(&ninp, &inp, "Do not constrain the start configuration");
+    ir->bContinuation = get_eeenum(&ninp, &inp, "continuation", yesno_names, wi);
+    printStringNoNewline(&ninp, &inp, "Use successive overrelaxation to reduce the number of shake iterations");
+    ir->bShakeSOR = get_eeenum(&ninp, &inp, "Shake-SOR", yesno_names, wi);
+    printStringNoNewline(&ninp, &inp, "Relative tolerance of shake");
+    ir->shake_tol = get_ereal(&ninp, &inp, "shake-tol", 0.0001, wi);
+    printStringNoNewline(&ninp, &inp, "Highest order in the expansion of the constraint coupling matrix");
+    ir->nProjOrder = get_eint(&ninp, &inp, "lincs-order", 4, wi);
+    printStringNoNewline(&ninp, &inp, "Number of iterations in the final step of LINCS. 1 is fine for");
+    printStringNoNewline(&ninp, &inp, "normal simulations, but use 2 to conserve energy in NVE runs.");
+    printStringNoNewline(&ninp, &inp, "For energy minimization with constraints it should be 4 to 8.");
+    ir->nLincsIter = get_eint(&ninp, &inp, "lincs-iter", 1, wi);
+    printStringNoNewline(&ninp, &inp, "Lincs will write a warning to the stderr if in one step a bond");
+    printStringNoNewline(&ninp, &inp, "rotates over more degrees than");
+    ir->LincsWarnAngle = get_ereal(&ninp, &inp, "lincs-warnangle", 30.0, wi);
+    printStringNoNewline(&ninp, &inp, "Convert harmonic bonds to morse potentials");
+    opts->bMorse = get_eeenum(&ninp, &inp, "morse", yesno_names, wi);
 
     /* Energy group exclusions */
-    CCTYPE ("ENERGY GROUP EXCLUSIONS");
-    CTYPE ("Pairs of energy groups for which all non-bonded interactions are excluded");
-    STYPE ("energygrp-excl", is->egpexcl,     nullptr);
+    printStringNewline(&ninp, &inp, "ENERGY GROUP EXCLUSIONS");
+    printStringNoNewline(&ninp, &inp, "Pairs of energy groups for which all non-bonded interactions are excluded");
+    setStringEntry(&ninp, &inp, "energygrp-excl", is->egpexcl,     nullptr);
 
     /* Walls */
-    CCTYPE ("WALLS");
-    CTYPE ("Number of walls, type, atom types, densities and box-z scale factor for Ewald");
-    ITYPE ("nwall", ir->nwall, 0);
-    EETYPE("wall-type",     ir->wall_type,   ewt_names);
-    RTYPE ("wall-r-linpot", ir->wall_r_linpot, -1);
-    STYPE ("wall-atomtype", is->wall_atomtype, nullptr);
-    STYPE ("wall-density",  is->wall_density,  nullptr);
-    RTYPE ("wall-ewald-zfac", ir->wall_ewald_zfac, 3);
+    printStringNewline(&ninp, &inp, "WALLS");
+    printStringNoNewline(&ninp, &inp, "Number of walls, type, atom types, densities and box-z scale factor for Ewald");
+    ir->nwall         = get_eint(&ninp, &inp, "nwall", 0, wi);
+    ir->wall_type     = get_eeenum(&ninp, &inp, "wall-type",   ewt_names, wi);
+    ir->wall_r_linpot = get_ereal(&ninp, &inp, "wall-r-linpot", -1, wi);
+    setStringEntry(&ninp, &inp, "wall-atomtype", is->wall_atomtype, nullptr);
+    setStringEntry(&ninp, &inp, "wall-density",  is->wall_density,  nullptr);
+    ir->wall_ewald_zfac = get_ereal(&ninp, &inp, "wall-ewald-zfac", 3, wi);
 
     /* COM pulling */
-    CCTYPE("COM PULLING");
-    EETYPE("pull",          ir->bPull, yesno_names);
+    printStringNewline(&ninp, &inp, "COM PULLING");
+    ir->bPull = get_eeenum(&ninp, &inp, "pull", yesno_names, wi);
     if (ir->bPull)
     {
         snew(ir->pull, 1);
@@ -2080,8 +2079,8 @@ void get_ir(const char *mdparin, const char *mdparout,
 
     /* AWH biasing
        NOTE: needs COM pulling input */
-    CCTYPE("AWH biasing");
-    EETYPE("awh", ir->bDoAwh, yesno_names);
+    printStringNewline(&ninp, &inp, "AWH biasing");
+    ir->bDoAwh = get_eeenum(&ninp, &inp, "awh", yesno_names, wi);
     if (ir->bDoAwh)
     {
         if (ir->bPull)
@@ -2095,9 +2094,9 @@ void get_ir(const char *mdparin, const char *mdparout,
     }
 
     /* Enforced rotation */
-    CCTYPE("ENFORCED ROTATION");
-    CTYPE("Enforced rotation: No or Yes");
-    EETYPE("rotation",       ir->bRot, yesno_names);
+    printStringNewline(&ninp, &inp, "ENFORCED ROTATION");
+    printStringNoNewline(&ninp, &inp, "Enforced rotation: No or Yes");
+    ir->bRot = get_eeenum(&ninp, &inp, "rotation", yesno_names, wi);
     if (ir->bRot)
     {
         snew(ir->rot, 1);
@@ -2106,8 +2105,8 @@ void get_ir(const char *mdparin, const char *mdparout,
 
     /* Interactive MD */
     ir->bIMD = FALSE;
-    CCTYPE("Group to display and/or manipulate in interactive MD session");
-    STYPE ("IMD-group", is->imd_grp, nullptr);
+    printStringNewline(&ninp, &inp, "Group to display and/or manipulate in interactive MD session");
+    setStringEntry(&ninp, &inp, "IMD-group", is->imd_grp, nullptr);
     if (is->imd_grp[0] != '\0')
     {
         snew(ir->imd, 1);
@@ -2115,78 +2114,77 @@ void get_ir(const char *mdparin, const char *mdparout,
     }
 
     /* Refinement */
-    CCTYPE("NMR refinement stuff");
-    CTYPE ("Distance restraints type: No, Simple or Ensemble");
-    EETYPE("disre",       ir->eDisre,     edisre_names);
-    CTYPE ("Force weighting of pairs in one distance restraint: Conservative or Equal");
-    EETYPE("disre-weighting", ir->eDisreWeighting, edisreweighting_names);
-    CTYPE ("Use sqrt of the time averaged times the instantaneous violation");
-    EETYPE("disre-mixed", ir->bDisreMixed, yesno_names);
-    RTYPE ("disre-fc",    ir->dr_fc,  1000.0);
-    RTYPE ("disre-tau",   ir->dr_tau, 0.0);
-    CTYPE ("Output frequency for pair distances to energy file");
-    ITYPE ("nstdisreout", ir->nstdisreout, 100);
-    CTYPE ("Orientation restraints: No or Yes");
-    EETYPE("orire",       opts->bOrire,   yesno_names);
-    CTYPE ("Orientation restraints force constant and tau for time averaging");
-    RTYPE ("orire-fc",    ir->orires_fc,  0.0);
-    RTYPE ("orire-tau",   ir->orires_tau, 0.0);
-    STYPE ("orire-fitgrp", is->orirefitgrp,    nullptr);
-    CTYPE ("Output frequency for trace(SD) and S to energy file");
-    ITYPE ("nstorireout", ir->nstorireout, 100);
+    printStringNewline(&ninp, &inp, "NMR refinement stuff");
+    printStringNoNewline(&ninp, &inp, "Distance restraints type: No, Simple or Ensemble");
+    ir->eDisre = get_eeenum(&ninp, &inp, "disre",     edisre_names, wi);
+    printStringNoNewline(&ninp, &inp, "Force weighting of pairs in one distance restraint: Conservative or Equal");
+    ir->eDisreWeighting = get_eeenum(&ninp, &inp, "disre-weighting", edisreweighting_names, wi);
+    printStringNoNewline(&ninp, &inp, "Use sqrt of the time averaged times the instantaneous violation");
+    ir->bDisreMixed = get_eeenum(&ninp, &inp, "disre-mixed", yesno_names, wi);
+    ir->dr_fc       = get_ereal(&ninp, &inp, "disre-fc",  1000.0, wi);
+    ir->dr_tau      = get_ereal(&ninp, &inp, "disre-tau", 0.0, wi);
+    printStringNoNewline(&ninp, &inp, "Output frequency for pair distances to energy file");
+    ir->nstdisreout = get_eint(&ninp, &inp, "nstdisreout", 100, wi);
+    printStringNoNewline(&ninp, &inp, "Orientation restraints: No or Yes");
+    opts->bOrire = get_eeenum(&ninp, &inp, "orire",   yesno_names, wi);
+    printStringNoNewline(&ninp, &inp, "Orientation restraints force constant and tau for time averaging");
+    ir->orires_fc  = get_ereal(&ninp, &inp, "orire-fc",  0.0, wi);
+    ir->orires_tau = get_ereal(&ninp, &inp, "orire-tau", 0.0, wi);
+    setStringEntry(&ninp, &inp, "orire-fitgrp", is->orirefitgrp,    nullptr);
+    printStringNoNewline(&ninp, &inp, "Output frequency for trace(SD) and S to energy file");
+    ir->nstorireout = get_eint(&ninp, &inp, "nstorireout", 100, wi);
 
     /* free energy variables */
-    CCTYPE ("Free energy variables");
-    EETYPE("free-energy", ir->efep, efep_names);
-    STYPE ("couple-moltype",  is->couple_moltype,  nullptr);
-    EETYPE("couple-lambda0", opts->couple_lam0, couple_lam);
-    EETYPE("couple-lambda1", opts->couple_lam1, couple_lam);
-    EETYPE("couple-intramol", opts->bCoupleIntra, yesno_names);
-
-    RTYPE ("init-lambda", fep->init_lambda, -1); /* start with -1 so
-                                                    we can recognize if
-                                                    it was not entered */
-    ITYPE ("init-lambda-state", fep->init_fep_state, -1);
-    RTYPE ("delta-lambda", fep->delta_lambda, 0.0);
-    ITYPE ("nstdhdl", fep->nstdhdl, 50);
-    STYPE ("fep-lambdas", is->fep_lambda[efptFEP], nullptr);
-    STYPE ("mass-lambdas", is->fep_lambda[efptMASS], nullptr);
-    STYPE ("coul-lambdas", is->fep_lambda[efptCOUL], nullptr);
-    STYPE ("vdw-lambdas", is->fep_lambda[efptVDW], nullptr);
-    STYPE ("bonded-lambdas", is->fep_lambda[efptBONDED], nullptr);
-    STYPE ("restraint-lambdas", is->fep_lambda[efptRESTRAINT], nullptr);
-    STYPE ("temperature-lambdas", is->fep_lambda[efptTEMPERATURE], nullptr);
-    ITYPE ("calc-lambda-neighbors", fep->lambda_neighbors, 1);
-    STYPE ("init-lambda-weights", is->lambda_weights, nullptr);
-    EETYPE("dhdl-print-energy", fep->edHdLPrintEnergy, edHdLPrintEnergy_names);
-    RTYPE ("sc-alpha", fep->sc_alpha, 0.0);
-    ITYPE ("sc-power", fep->sc_power, 1);
-    RTYPE ("sc-r-power", fep->sc_r_power, 6.0);
-    RTYPE ("sc-sigma", fep->sc_sigma, 0.3);
-    EETYPE("sc-coul", fep->bScCoul, yesno_names);
-    ITYPE ("dh_hist_size", fep->dh_hist_size, 0);
-    RTYPE ("dh_hist_spacing", fep->dh_hist_spacing, 0.1);
-    EETYPE("separate-dhdl-file", fep->separate_dhdl_file,
-           separate_dhdl_file_names);
-    EETYPE("dhdl-derivatives", fep->dhdl_derivatives, dhdl_derivatives_names);
-    ITYPE ("dh_hist_size", fep->dh_hist_size, 0);
-    RTYPE ("dh_hist_spacing", fep->dh_hist_spacing, 0.1);
+    printStringNewline(&ninp, &inp, "Free energy variables");
+    ir->efep = get_eeenum(&ninp, &inp, "free-energy", efep_names, wi);
+    setStringEntry(&ninp, &inp, "couple-moltype",  is->couple_moltype,  nullptr);
+    opts->couple_lam0  = get_eeenum(&ninp, &inp, "couple-lambda0", couple_lam, wi);
+    opts->couple_lam1  = get_eeenum(&ninp, &inp, "couple-lambda1", couple_lam, wi);
+    opts->bCoupleIntra = get_eeenum(&ninp, &inp, "couple-intramol", yesno_names, wi);
+
+    fep->init_lambda    = get_ereal(&ninp, &inp, "init-lambda", -1, wi); /* start with -1 so
+                                                                            we can recognize if
+                                                                            it was not entered */
+    fep->init_fep_state = get_eint(&ninp, &inp, "init-lambda-state", -1, wi);
+    fep->delta_lambda   = get_ereal(&ninp, &inp, "delta-lambda", 0.0, wi);
+    fep->nstdhdl        = get_eint(&ninp, &inp, "nstdhdl", 50, wi);
+    setStringEntry(&ninp, &inp, "fep-lambdas", is->fep_lambda[efptFEP], nullptr);
+    setStringEntry(&ninp, &inp, "mass-lambdas", is->fep_lambda[efptMASS], nullptr);
+    setStringEntry(&ninp, &inp, "coul-lambdas", is->fep_lambda[efptCOUL], nullptr);
+    setStringEntry(&ninp, &inp, "vdw-lambdas", is->fep_lambda[efptVDW], nullptr);
+    setStringEntry(&ninp, &inp, "bonded-lambdas", is->fep_lambda[efptBONDED], nullptr);
+    setStringEntry(&ninp, &inp, "restraint-lambdas", is->fep_lambda[efptRESTRAINT], nullptr);
+    setStringEntry(&ninp, &inp, "temperature-lambdas", is->fep_lambda[efptTEMPERATURE], nullptr);
+    fep->lambda_neighbors = get_eint(&ninp, &inp, "calc-lambda-neighbors", 1, wi);
+    setStringEntry(&ninp, &inp, "init-lambda-weights", is->lambda_weights, nullptr);
+    fep->edHdLPrintEnergy   = get_eeenum(&ninp, &inp, "dhdl-print-energy", edHdLPrintEnergy_names, wi);
+    fep->sc_alpha           = get_ereal(&ninp, &inp, "sc-alpha", 0.0, wi);
+    fep->sc_power           = get_eint(&ninp, &inp, "sc-power", 1, wi);
+    fep->sc_r_power         = get_ereal(&ninp, &inp, "sc-r-power", 6.0, wi);
+    fep->sc_sigma           = get_ereal(&ninp, &inp, "sc-sigma", 0.3, wi);
+    fep->bScCoul            = get_eeenum(&ninp, &inp, "sc-coul", yesno_names, wi);
+    fep->dh_hist_size       = get_eint(&ninp, &inp, "dh_hist_size", 0, wi);
+    fep->dh_hist_spacing    = get_ereal(&ninp, &inp, "dh_hist_spacing", 0.1, wi);
+    fep->separate_dhdl_file = get_eeenum(&ninp, &inp, "separate-dhdl-file", separate_dhdl_file_names, wi);
+    fep->dhdl_derivatives   = get_eeenum(&ninp, &inp, "dhdl-derivatives", dhdl_derivatives_names, wi);
+    fep->dh_hist_size       = get_eint(&ninp, &inp, "dh_hist_size", 0, wi);
+    fep->dh_hist_spacing    = get_ereal(&ninp, &inp, "dh_hist_spacing", 0.1, wi);
 
     /* Non-equilibrium MD stuff */
-    CCTYPE("Non-equilibrium MD stuff");
-    STYPE ("acc-grps",    is->accgrps,        nullptr);
-    STYPE ("accelerate",  is->acc,            nullptr);
-    STYPE ("freezegrps",  is->freeze,         nullptr);
-    STYPE ("freezedim",   is->frdim,          nullptr);
-    RTYPE ("cos-acceleration", ir->cos_accel, 0);
-    STYPE ("deform",      is->deform,         nullptr);
+    printStringNewline(&ninp, &inp, "Non-equilibrium MD stuff");
+    setStringEntry(&ninp, &inp, "acc-grps",    is->accgrps,        nullptr);
+    setStringEntry(&ninp, &inp, "accelerate",  is->acc,            nullptr);
+    setStringEntry(&ninp, &inp, "freezegrps",  is->freeze,         nullptr);
+    setStringEntry(&ninp, &inp, "freezedim",   is->frdim,          nullptr);
+    ir->cos_accel = get_ereal(&ninp, &inp, "cos-acceleration", 0, wi);
+    setStringEntry(&ninp, &inp, "deform",      is->deform,         nullptr);
 
     /* simulated tempering variables */
-    CCTYPE("simulated tempering variables");
-    EETYPE("simulated-tempering", ir->bSimTemp, yesno_names);
-    EETYPE("simulated-tempering-scaling", ir->simtempvals->eSimTempScale, esimtemp_names);
-    RTYPE("sim-temp-low", ir->simtempvals->simtemp_low, 300.0);
-    RTYPE("sim-temp-high", ir->simtempvals->simtemp_high, 300.0);
+    printStringNewline(&ninp, &inp, "simulated tempering variables");
+    ir->bSimTemp                   = get_eeenum(&ninp, &inp, "simulated-tempering", yesno_names, wi);
+    ir->simtempvals->eSimTempScale = get_eeenum(&ninp, &inp, "simulated-tempering-scaling", esimtemp_names, wi);
+    ir->simtempvals->simtemp_low   = get_ereal(&ninp, &inp, "sim-temp-low", 300.0, wi);
+    ir->simtempvals->simtemp_high  = get_ereal(&ninp, &inp, "sim-temp-high", 300.0, wi);
 
     /* expanded ensemble variables */
     if (ir->efep == efepEXPANDED || ir->bSimTemp)
@@ -2216,9 +2214,9 @@ void get_ir(const char *mdparin, const char *mdparout,
     }
 
     /* Ion/water position swapping ("computational electrophysiology") */
-    CCTYPE("Ion/water position swapping for computational electrophysiology setups");
-    CTYPE("Swap positions along direction: no, X, Y, Z");
-    EETYPE("swapcoords", ir->eSwapCoords, eSwapTypes_names);
+    printStringNewline(&ninp, &inp, "Ion/water position swapping for computational electrophysiology setups");
+    printStringNoNewline(&ninp, &inp, "Swap positions along direction: no, X, Y, Z");
+    ir->eSwapCoords = get_eeenum(&ninp, &inp, "swapcoords", eSwapTypes_names, wi);
     if (ir->eSwapCoords != eswapNO)
     {
         char buf[STRLEN];
@@ -2226,10 +2224,10 @@ void get_ir(const char *mdparin, const char *mdparout,
 
 
         snew(ir->swap, 1);
-        CTYPE("Swap attempt frequency");
-        ITYPE("swap-frequency", ir->swap->nstswap, 1);
-        CTYPE("Number of ion types to be controlled");
-        ITYPE("iontypes", nIonTypes, 1);
+        printStringNoNewline(&ninp, &inp, "Swap attempt frequency");
+        ir->swap->nstswap = get_eint(&ninp, &inp, "swap-frequency", 1, wi);
+        printStringNoNewline(&ninp, &inp, "Number of ion types to be controlled");
+        nIonTypes = get_eint(&ninp, &inp, "iontypes", 1, wi);
         if (nIonTypes < 1)
         {
             warning_error(wi, "You need to provide at least one ion type for position exchanges.");
@@ -2240,76 +2238,76 @@ void get_ir(const char *mdparin, const char *mdparout,
         {
             snew(ir->swap->grp[i].molname, STRLEN);
         }
-        CTYPE("Two index groups that contain the compartment-partitioning atoms");
-        STYPE("split-group0", ir->swap->grp[eGrpSplit0].molname, nullptr);
-        STYPE("split-group1", ir->swap->grp[eGrpSplit1].molname, nullptr);
-        CTYPE("Use center of mass of split groups (yes/no), otherwise center of geometry is used");
-        EETYPE("massw-split0", ir->swap->massw_split[0], yesno_names);
-        EETYPE("massw-split1", ir->swap->massw_split[1], yesno_names);
-
-        CTYPE("Name of solvent molecules");
-        STYPE("solvent-group", ir->swap->grp[eGrpSolvent].molname, nullptr);
-
-        CTYPE("Split cylinder: radius, upper and lower extension (nm) (this will define the channels)");
-        CTYPE("Note that the split cylinder settings do not have an influence on the swapping protocol,");
-        CTYPE("however, if correctly defined, the permeation events are recorded per channel");
-        RTYPE("cyl0-r", ir->swap->cyl0r, 2.0);
-        RTYPE("cyl0-up", ir->swap->cyl0u, 1.0);
-        RTYPE("cyl0-down", ir->swap->cyl0l, 1.0);
-        RTYPE("cyl1-r", ir->swap->cyl1r, 2.0);
-        RTYPE("cyl1-up", ir->swap->cyl1u, 1.0);
-        RTYPE("cyl1-down", ir->swap->cyl1l, 1.0);
-
-        CTYPE("Average the number of ions per compartment over these many swap attempt steps");
-        ITYPE("coupl-steps", ir->swap->nAverage, 10);
-
-        CTYPE("Names of the ion types that can be exchanged with solvent molecules,");
-        CTYPE("and the requested number of ions of this type in compartments A and B");
-        CTYPE("-1 means fix the numbers as found in step 0");
+        printStringNoNewline(&ninp, &inp, "Two index groups that contain the compartment-partitioning atoms");
+        setStringEntry(&ninp, &inp, "split-group0", ir->swap->grp[eGrpSplit0].molname, nullptr);
+        setStringEntry(&ninp, &inp, "split-group1", ir->swap->grp[eGrpSplit1].molname, nullptr);
+        printStringNoNewline(&ninp, &inp, "Use center of mass of split groups (yes/no), otherwise center of geometry is used");
+        ir->swap->massw_split[0] = get_eeenum(&ninp, &inp, "massw-split0", yesno_names, wi);
+        ir->swap->massw_split[1] = get_eeenum(&ninp, &inp, "massw-split1", yesno_names, wi);
+
+        printStringNoNewline(&ninp, &inp, "Name of solvent molecules");
+        setStringEntry(&ninp, &inp, "solvent-group", ir->swap->grp[eGrpSolvent].molname, nullptr);
+
+        printStringNoNewline(&ninp, &inp, "Split cylinder: radius, upper and lower extension (nm) (this will define the channels)");
+        printStringNoNewline(&ninp, &inp, "Note that the split cylinder settings do not have an influence on the swapping protocol,");
+        printStringNoNewline(&ninp, &inp, "however, if correctly defined, the permeation events are recorded per channel");
+        ir->swap->cyl0r = get_ereal(&ninp, &inp, "cyl0-r", 2.0, wi);
+        ir->swap->cyl0u = get_ereal(&ninp, &inp, "cyl0-up", 1.0, wi);
+        ir->swap->cyl0l = get_ereal(&ninp, &inp, "cyl0-down", 1.0, wi);
+        ir->swap->cyl1r = get_ereal(&ninp, &inp, "cyl1-r", 2.0, wi);
+        ir->swap->cyl1u = get_ereal(&ninp, &inp, "cyl1-up", 1.0, wi);
+        ir->swap->cyl1l = get_ereal(&ninp, &inp, "cyl1-down", 1.0, wi);
+
+        printStringNoNewline(&ninp, &inp, "Average the number of ions per compartment over these many swap attempt steps");
+        ir->swap->nAverage = get_eint(&ninp, &inp, "coupl-steps", 10, wi);
+
+        printStringNoNewline(&ninp, &inp, "Names of the ion types that can be exchanged with solvent molecules,");
+        printStringNoNewline(&ninp, &inp, "and the requested number of ions of this type in compartments A and B");
+        printStringNoNewline(&ninp, &inp, "-1 means fix the numbers as found in step 0");
         for (i = 0; i < nIonTypes; i++)
         {
             int ig = eSwapFixedGrpNR + i;
 
             sprintf(buf, "iontype%d-name", i);
-            STYPE(buf, ir->swap->grp[ig].molname, nullptr);
+            setStringEntry(&ninp, &inp, buf, ir->swap->grp[ig].molname, nullptr);
             sprintf(buf, "iontype%d-in-A", i);
-            ITYPE(buf, ir->swap->grp[ig].nmolReq[0], -1);
+            ir->swap->grp[ig].nmolReq[0] = get_eint(&ninp, &inp, buf, -1, wi);
             sprintf(buf, "iontype%d-in-B", i);
-            ITYPE(buf, ir->swap->grp[ig].nmolReq[1], -1);
+            ir->swap->grp[ig].nmolReq[1] = get_eint(&ninp, &inp, buf, -1, wi);
         }
 
-        CTYPE("By default (i.e. bulk offset = 0.0), ion/water exchanges happen between layers");
-        CTYPE("at maximum distance (= bulk concentration) to the split group layers. However,");
-        CTYPE("an offset b (-1.0 < b < +1.0) can be specified to offset the bulk layer from the middle at 0.0");
-        CTYPE("towards one of the compartment-partitioning layers (at +/- 1.0).");
-        RTYPE("bulk-offsetA", ir->swap->bulkOffset[0], 0.0);
-        RTYPE("bulk-offsetB", ir->swap->bulkOffset[1], 0.0);
+        printStringNoNewline(&ninp, &inp, "By default (i.e. bulk offset = 0.0), ion/water exchanges happen between layers");
+        printStringNoNewline(&ninp, &inp, "at maximum distance (= bulk concentration) to the split group layers. However,");
+        printStringNoNewline(&ninp, &inp, "an offset b (-1.0 < b < +1.0) can be specified to offset the bulk layer from the middle at 0.0");
+        printStringNoNewline(&ninp, &inp, "towards one of the compartment-partitioning layers (at +/- 1.0).");
+        ir->swap->bulkOffset[0] = get_ereal(&ninp, &inp, "bulk-offsetA", 0.0, wi);
+        ir->swap->bulkOffset[1] = get_ereal(&ninp, &inp, "bulk-offsetB", 0.0, wi);
         if (!(ir->swap->bulkOffset[0] > -1.0 && ir->swap->bulkOffset[0] < 1.0)
             || !(ir->swap->bulkOffset[1] > -1.0 && ir->swap->bulkOffset[1] < 1.0) )
         {
             warning_error(wi, "Bulk layer offsets must be > -1.0 and < 1.0 !");
         }
 
-        CTYPE("Start to swap ions if threshold difference to requested count is reached");
-        RTYPE("threshold", ir->swap->threshold, 1.0);
+        printStringNoNewline(&ninp, &inp, "Start to swap ions if threshold difference to requested count is reached");
+        ir->swap->threshold = get_ereal(&ninp, &inp, "threshold", 1.0, wi);
     }
 
     /* AdResS is no longer supported, but we need grompp to be able to
        refuse to process old .mdp files that used it. */
-    EETYPE("adress", ir->bAdress, no_names);
+    ir->bAdress = get_eeenum(&ninp, &inp, "adress", no_names, wi);
 
     /* User defined thingies */
-    CCTYPE ("User defined thingies");
-    STYPE ("user1-grps",  is->user1,          nullptr);
-    STYPE ("user2-grps",  is->user2,          nullptr);
-    ITYPE ("userint1",    ir->userint1,   0);
-    ITYPE ("userint2",    ir->userint2,   0);
-    ITYPE ("userint3",    ir->userint3,   0);
-    ITYPE ("userint4",    ir->userint4,   0);
-    RTYPE ("userreal1",   ir->userreal1,  0);
-    RTYPE ("userreal2",   ir->userreal2,  0);
-    RTYPE ("userreal3",   ir->userreal3,  0);
-    RTYPE ("userreal4",   ir->userreal4,  0);
+    printStringNewline(&ninp, &inp, "User defined thingies");
+    setStringEntry(&ninp, &inp, "user1-grps",  is->user1,          nullptr);
+    setStringEntry(&ninp, &inp, "user2-grps",  is->user2,          nullptr);
+    ir->userint1  = get_eint(&ninp, &inp, "userint1",   0, wi);
+    ir->userint2  = get_eint(&ninp, &inp, "userint2",   0, wi);
+    ir->userint3  = get_eint(&ninp, &inp, "userint3",   0, wi);
+    ir->userint4  = get_eint(&ninp, &inp, "userint4",   0, wi);
+    ir->userreal1 = get_ereal(&ninp, &inp, "userreal1",  0, wi);
+    ir->userreal2 = get_ereal(&ninp, &inp, "userreal2",  0, wi);
+    ir->userreal3 = get_ereal(&ninp, &inp, "userreal3",  0, wi);
+    ir->userreal4 = get_ereal(&ninp, &inp, "userreal4",  0, wi);
 #undef CTYPE
 
     {
index f06509ddc38a3a01f5e74a0f9183acbe00effa07..2b6f5414aaa48758a065ab755bfb86bd718da81f 100644 (file)
@@ -267,9 +267,7 @@ char **read_pullparams(int *ninp_p, t_inpfile **inp_p,
                        pull_params_t *pull,
                        warninp_t wi)
 {
-    int           ninp, nscan, idum;
-    t_inpfile    *inp;
-    const char   *tmp;
+    int           nscan, idum;
     char        **grpbuf;
     char          buf[STRLEN];
     char          provider[STRLEN], groups[STRLEN], dim_buf[STRLEN];
@@ -278,22 +276,19 @@ char **read_pullparams(int *ninp_p, t_inpfile **inp_p,
     t_pull_group *pgrp;
     t_pull_coord *pcrd;
 
-    ninp   = *ninp_p;
-    inp    = *inp_p;
-
     /* read pull parameters */
-    CTYPE("Cylinder radius for dynamic reaction force groups (nm)");
-    RTYPE("pull-cylinder-r",  pull->cylinder_r, 1.5);
-    RTYPE("pull-constr-tol",  pull->constr_tol, 1E-6);
-    EETYPE("pull-print-com", pull->bPrintCOM, yesno_names);
-    EETYPE("pull-print-ref-value", pull->bPrintRefValue, yesno_names);
-    EETYPE("pull-print-components", pull->bPrintComp, yesno_names);
-    ITYPE("pull-nstxout",     pull->nstxout, 50);
-    ITYPE("pull-nstfout",     pull->nstfout, 50);
-    CTYPE("Number of pull groups");
-    ITYPE("pull-ngroups",     pull->ngroup, 1);
-    CTYPE("Number of pull coordinates");
-    ITYPE("pull-ncoords",     pull->ncoord, 1);
+    printStringNoNewline(ninp_p, inp_p, "Cylinder radius for dynamic reaction force groups (nm)");
+    pull->cylinder_r     = get_ereal(ninp_p, inp_p, "pull-cylinder-r", 1.5, wi);
+    pull->constr_tol     = get_ereal(ninp_p, inp_p, "pull-constr-tol", 1E-6, wi);
+    pull->bPrintCOM      = get_eeenum(ninp_p, inp_p, "pull-print-com", yesno_names, wi);
+    pull->bPrintRefValue = get_eeenum(ninp_p, inp_p, "pull-print-ref-value", yesno_names, wi);
+    pull->bPrintComp     = get_eeenum(ninp_p, inp_p, "pull-print-components", yesno_names, wi);
+    pull->nstxout        = get_eint(ninp_p, inp_p, "pull-nstxout", 50, wi);
+    pull->nstfout        = get_eint(ninp_p, inp_p, "pull-nstfout", 50, wi);
+    printStringNoNewline(ninp_p, inp_p, "Number of pull groups");
+    pull->ngroup = get_eint(ninp_p, inp_p, "pull-ngroups", 1, wi);
+    printStringNoNewline(ninp_p, inp_p, "Number of pull coordinates");
+    pull->ncoord = get_eint(ninp_p, inp_p, "pull-ncoords", 1, wi);
 
     if (pull->ngroup < 1)
     {
@@ -312,7 +307,7 @@ char **read_pullparams(int *ninp_p, t_inpfile **inp_p,
     snew(pull->coord, pull->ncoord);
 
     /* pull group options */
-    CTYPE("Group and coordinate parameters");
+    printStringNoNewline(ninp_p, inp_p, "Group and coordinate parameters");
 
     /* Read the pull groups */
     snew(grpbuf, pull->ngroup);
@@ -322,11 +317,11 @@ char **read_pullparams(int *ninp_p, t_inpfile **inp_p,
         pgrp = &pull->group[groupNum];
         snew(grpbuf[groupNum], STRLEN);
         sprintf(buf, "pull-group%d-name", groupNum);
-        STYPE(buf,              grpbuf[groupNum], "");
+        setStringEntry(ninp_p, inp_p, buf, grpbuf[groupNum], "");
         sprintf(buf, "pull-group%d-weights", groupNum);
-        STYPE(buf,              wbuf, "");
+        setStringEntry(ninp_p, inp_p, buf, wbuf, "");
         sprintf(buf, "pull-group%d-pbcatom", groupNum);
-        ITYPE(buf,              pgrp->pbcatom, 0);
+        pgrp->pbcatom = get_eint(ninp_p, inp_p, buf, 0, wi);
 
         /* Initialize the pull group */
         init_pull_group(pgrp, wbuf);
@@ -337,14 +332,14 @@ char **read_pullparams(int *ninp_p, t_inpfile **inp_p,
     {
         pcrd = &pull->coord[coordNum - 1];
         sprintf(buf, "pull-coord%d-type", coordNum);
-        EETYPE(buf,             pcrd->eType, epull_names);
+        pcrd->eType = get_eeenum(ninp_p, inp_p, buf, epull_names, wi);
         sprintf(buf, "pull-coord%d-potential-provider", coordNum);
-        STYPE(buf,              provider, "");
+        setStringEntry(ninp_p, inp_p, buf, provider, "");
         pcrd->externalPotentialProvider = gmx_strdup(provider);
         sprintf(buf, "pull-coord%d-geometry", coordNum);
-        EETYPE(buf,             pcrd->eGeom, epullg_names);
+        pcrd->eGeom = get_eeenum(ninp_p, inp_p, buf, epullg_names, wi);
         sprintf(buf, "pull-coord%d-groups", coordNum);
-        STYPE(buf,              groups, "");
+        setStringEntry(ninp_p, inp_p, buf, groups, "");
 
         switch (pcrd->eGeom)
         {
@@ -378,29 +373,26 @@ char **read_pullparams(int *ninp_p, t_inpfile **inp_p,
         }
 
         sprintf(buf, "pull-coord%d-dim", coordNum);
-        STYPE(buf,              dim_buf,     "Y Y Y");
+        setStringEntry(ninp_p, inp_p, buf, dim_buf, "Y Y Y");
         sprintf(buf, "pull-coord%d-origin", coordNum);
-        STYPE(buf,              origin_buf,  "0.0 0.0 0.0");
+        setStringEntry(ninp_p, inp_p, buf, origin_buf, "0.0 0.0 0.0");
         sprintf(buf, "pull-coord%d-vec", coordNum);
-        STYPE(buf,              vec_buf,     "0.0 0.0 0.0");
+        setStringEntry(ninp_p, inp_p, buf, vec_buf, "0.0 0.0 0.0");
         sprintf(buf, "pull-coord%d-start", coordNum);
-        EETYPE(buf,             pcrd->bStart, yesno_names);
+        pcrd->bStart = get_eeenum(ninp_p, inp_p, buf, yesno_names, wi);
         sprintf(buf, "pull-coord%d-init", coordNum);
-        RTYPE(buf,              pcrd->init,  0.0);
+        pcrd->init = get_ereal(ninp_p, inp_p, buf, 0.0, wi);
         sprintf(buf, "pull-coord%d-rate", coordNum);
-        RTYPE(buf,              pcrd->rate,  0.0);
+        pcrd->rate = get_ereal(ninp_p, inp_p, buf, 0.0, wi);
         sprintf(buf, "pull-coord%d-k", coordNum);
-        RTYPE(buf,              pcrd->k,     0.0);
+        pcrd->k = get_ereal(ninp_p, inp_p, buf, 0.0, wi);
         sprintf(buf, "pull-coord%d-kB", coordNum);
-        RTYPE(buf,              pcrd->kB,    pcrd->k);
+        pcrd->kB = get_ereal(ninp_p, inp_p, buf, pcrd->k, wi);
 
         /* Initialize the pull coordinate */
         init_pull_coord(pcrd, coordNum, dim_buf, origin_buf, vec_buf, wi);
     }
 
-    *ninp_p   = ninp;
-    *inp_p    = inp;
-
     return grpbuf;
 }
 
index e92b8e45a34c38308454f303aaf8b4b93fe28fc3..e6d9351e0bc40d4b406bc9b6b2ebec10e9622e9a 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -68,25 +68,20 @@ static void string2dvec(char buf[], dvec nums)
 extern char **read_rotparams(int *ninp_p, t_inpfile **inp_p, t_rot *rot,
                              warninp_t wi)
 {
-    int         ninp, g, m;
-    t_inpfile  *inp;
-    const char *tmp;
+    int         g, m;
     char      **grpbuf;
     char        buf[STRLEN];
     char        warn_buf[STRLEN];
     dvec        vec;
     t_rotgrp   *rotg;
 
-    ninp   = *ninp_p;
-    inp    = *inp_p;
-
     /* read rotation parameters */
-    CTYPE("Output frequency for angle, torque and rotation potential energy for the whole group");
-    ITYPE("rot-nstrout",     rot->nstrout, 100);
-    CTYPE("Output frequency for per-slab data (angles, torques and slab centers)");
-    ITYPE("rot-nstsout",     rot->nstsout, 1000);
-    CTYPE("Number of rotation groups");
-    ITYPE("rot-ngroups",     rot->ngrp, 1);
+    printStringNoNewline(ninp_p, inp_p, "Output frequency for angle, torque and rotation potential energy for the whole group");
+    rot->nstrout = get_eint(ninp_p, inp_p, "rot-nstrout", 100, wi);
+    printStringNoNewline(ninp_p, inp_p, "Output frequency for per-slab data (angles, torques and slab centers)");
+    rot->nstsout = get_eint(ninp_p, inp_p, "rot-nstsout", 1000, wi);
+    printStringNoNewline(ninp_p, inp_p, "Number of rotation groups");
+    rot->ngrp = get_eint(ninp_p, inp_p, "rot-ngroups", 1, wi);
 
     if (rot->ngrp < 1)
     {
@@ -101,21 +96,21 @@ extern char **read_rotparams(int *ninp_p, t_inpfile **inp_p, t_rot *rot,
     {
         rotg = &rot->grp[g];
         snew(grpbuf[g], STRLEN);
-        CTYPE("Rotation group name");
+        printStringNoNewline(ninp_p, inp_p, "Rotation group name");
         sprintf(buf, "rot-group%d", g);
-        STYPE(buf, grpbuf[g], "");
+        setStringEntry(ninp_p, inp_p, buf, grpbuf[g], "");
 
-        CTYPE("Rotation potential. Can be iso, iso-pf, pm, pm-pf, rm, rm-pf, rm2, rm2-pf, flex, flex-t, flex2, flex2-t");
+        printStringNoNewline(ninp_p, inp_p, "Rotation potential. Can be iso, iso-pf, pm, pm-pf, rm, rm-pf, rm2, rm2-pf, flex, flex-t, flex2, flex2-t");
         sprintf(buf, "rot-type%d", g);
-        ETYPE(buf, rotg->eType, erotg_names);
+        rotg->eType = get_eenum(ninp_p, inp_p, buf, erotg_names);
 
-        CTYPE("Use mass-weighting of the rotation group positions");
+        printStringNoNewline(ninp_p, inp_p, "Use mass-weighting of the rotation group positions");
         sprintf(buf, "rot-massw%d", g);
-        ETYPE(buf, rotg->bMassW, yesno_names);
+        rotg->bMassW = get_eenum(ninp_p, inp_p, buf, yesno_names);
 
-        CTYPE("Rotation vector, will get normalized");
+        printStringNoNewline(ninp_p, inp_p, "Rotation vector, will get normalized");
         sprintf(buf, "rot-vec%d", g);
-        STYPE(buf, s_vec, "1.0 0.0 0.0");
+        setStringEntry(ninp_p, inp_p, buf, s_vec, "1.0 0.0 0.0");
         string2dvec(s_vec, vec);
         /* Normalize the rotation vector */
         if (dnorm(vec) != 0)
@@ -134,9 +129,9 @@ extern char **read_rotparams(int *ninp_p, t_inpfile **inp_p, t_rot *rot,
             rotg->vec[m] = vec[m];
         }
 
-        CTYPE("Pivot point for the potentials iso, pm, rm, and rm2 (nm)");
+        printStringNoNewline(ninp_p, inp_p, "Pivot point for the potentials iso, pm, rm, and rm2 (nm)");
         sprintf(buf, "rot-pivot%d", g);
-        STYPE(buf, s_vec, "0.0 0.0 0.0");
+        setStringEntry(ninp_p, inp_p, buf, s_vec, "0.0 0.0 0.0");
         clear_dvec(vec);
         if ( (rotg->eType == erotgISO) || (rotg->eType == erotgPM) || (rotg->eType == erotgRM) || (rotg->eType == erotgRM2) )
         {
@@ -147,64 +142,61 @@ extern char **read_rotparams(int *ninp_p, t_inpfile **inp_p, t_rot *rot,
             rotg->pivot[m] = vec[m];
         }
 
-        CTYPE("Rotation rate (degree/ps) and force constant (kJ/(mol*nm^2))");
+        printStringNoNewline(ninp_p, inp_p, "Rotation rate (degree/ps) and force constant (kJ/(mol*nm^2))");
         sprintf(buf, "rot-rate%d", g);
-        RTYPE(buf, rotg->rate, 0.0);
+        rotg->rate = get_ereal(ninp_p, inp_p, buf, 0.0, wi);
 
         sprintf(buf, "rot-k%d", g);
-        RTYPE(buf, rotg->k, 0.0);
+        rotg->k = get_ereal(ninp_p, inp_p, buf, 0.0, wi);
         if (rotg->k <= 0.0)
         {
             sprintf(warn_buf, "rot-k%d <= 0", g);
             warning_note(wi, warn_buf);
         }
 
-        CTYPE("Slab distance for flexible axis rotation (nm)");
+        printStringNoNewline(ninp_p, inp_p, "Slab distance for flexible axis rotation (nm)");
         sprintf(buf, "rot-slab-dist%d", g);
-        RTYPE(buf, rotg->slab_dist, 1.5);
+        rotg->slab_dist = get_ereal(ninp_p, inp_p, buf, 1.5, wi);
         if (rotg->slab_dist <= 0.0)
         {
             sprintf(warn_buf, "rot-slab-dist%d <= 0", g);
             warning_error(wi, warn_buf);
         }
 
-        CTYPE("Minimum value of Gaussian function for the force to be evaluated (for flex* potentials)");
+        printStringNoNewline(ninp_p, inp_p, "Minimum value of Gaussian function for the force to be evaluated (for flex* potentials)");
         sprintf(buf, "rot-min-gauss%d", g);
-        RTYPE(buf, rotg->min_gaussian, 1e-3);
+        rotg->min_gaussian = get_ereal(ninp_p, inp_p, buf, 1e-3, wi);
         if (rotg->min_gaussian <= 0.0)
         {
             sprintf(warn_buf, "rot-min-gauss%d <= 0", g);
             warning_error(wi, warn_buf);
         }
 
-        CTYPE("Value of additive constant epsilon' (nm^2) for rm2* and flex2* potentials");
+        printStringNoNewline(ninp_p, inp_p, "Value of additive constant epsilon' (nm^2) for rm2* and flex2* potentials");
         sprintf(buf, "rot-eps%d", g);
-        RTYPE(buf, rotg->eps, 1e-4);
+        rotg->eps = get_ereal(ninp_p, inp_p, buf, 1e-4, wi);
         if ( (rotg->eps <= 0.0) && (rotg->eType == erotgRM2 || rotg->eType == erotgFLEX2) )
         {
             sprintf(warn_buf, "rot-eps%d <= 0", g);
             warning_error(wi, warn_buf);
         }
 
-        CTYPE("Fitting method to determine angle of rotation group (rmsd, norm, or potential)");
+        printStringNoNewline(ninp_p, inp_p, "Fitting method to determine angle of rotation group (rmsd, norm, or potential)");
         sprintf(buf, "rot-fit-method%d", g);
-        ETYPE(buf, rotg->eFittype, erotg_fitnames);
-        CTYPE("For fit type 'potential', nr. of angles around the reference for which the pot. is evaluated");
+        rotg->eFittype = get_eenum(ninp_p, inp_p, buf, erotg_fitnames);
+        printStringNoNewline(ninp_p, inp_p, "For fit type 'potential', nr. of angles around the reference for which the pot. is evaluated");
         sprintf(buf, "rot-potfit-nsteps%d", g);
-        ITYPE(buf, rotg->PotAngle_nstep, 21);
+        rotg->PotAngle_nstep = get_eint(ninp_p, inp_p, buf, 21, wi);
         if ( (rotg->eFittype == erotgFitPOT) && (rotg->PotAngle_nstep < 1) )
         {
             sprintf(warn_buf, "rot-potfit-nsteps%d < 1", g);
             warning_error(wi, warn_buf);
         }
-        CTYPE("For fit type 'potential', distance in degrees between two consecutive angles");
+        printStringNoNewline(ninp_p, inp_p, "For fit type 'potential', distance in degrees between two consecutive angles");
         sprintf(buf, "rot-potfit-step%d", g);
-        RTYPE(buf, rotg->PotAngle_step, 0.25);
+        rotg->PotAngle_step = get_ereal(ninp_p, inp_p, buf, 0.25, wi);
     }
 
-    *ninp_p   = ninp;
-    *inp_p    = inp;
-
     return grpbuf;
 }
 
index 841aa6053d824588eadbf8b1817128badfab6dfe..1918e06c3f121c3b13f38d6930e3fe578d4eaad4 100644 (file)
@@ -226,17 +226,17 @@ static void get_input(const char *membed_input, real *xy_fac, real *xy_max, real
         inp = read_inpfile(&stream, membed_input, &ninp, wi);
         stream.close();
     }
-    ITYPE ("nxy", *it_xy, 1000);
-    ITYPE ("nz", *it_z, 0);
-    RTYPE ("xyinit", *xy_fac, 0.5);
-    RTYPE ("xyend", *xy_max, 1.0);
-    RTYPE ("zinit", *z_fac, 1.0);
-    RTYPE ("zend", *z_max, 1.0);
-    RTYPE ("rad", *probe_rad, 0.22);
-    ITYPE ("ndiff", *low_up_rm, 0);
-    ITYPE ("maxwarn", *maxwarn, 0);
-    ITYPE ("pieces", *pieces, 1);
-    EETYPE("asymmetry", *bALLOW_ASYMMETRY, yesno_names);
+    *it_xy            = get_eint(&ninp, &inp, "nxy", 1000, wi);
+    *it_z             = get_eint(&ninp, &inp, "nz", 0, wi);
+    *xy_fac           = get_ereal(&ninp, &inp, "xyinit", 0.5, wi);
+    *xy_max           = get_ereal(&ninp, &inp, "xyend", 1.0, wi);
+    *z_fac            = get_ereal(&ninp, &inp, "zinit", 1.0, wi);
+    *z_max            = get_ereal(&ninp, &inp, "zend", 1.0, wi);
+    *probe_rad        = get_ereal(&ninp, &inp, "rad", 0.22, wi);
+    *low_up_rm        = get_eint(&ninp, &inp, "ndiff", 0, wi);
+    *maxwarn          = get_eint(&ninp, &inp, "maxwarn", 0, wi);
+    *pieces           = get_eint(&ninp, &inp, "pieces", 1, wi);
+    *bALLOW_ASYMMETRY = get_eeenum(&ninp, &inp, "asymmetry", yesno_names, wi);
 
     check_warning_error(wi, FARGS);
     {