Пример #1
0
static const char *bootloader_result_command(libxl__gc *gc, const char *buf,
        const char *prefix, size_t prefixlen) {
    if (strncmp(buf, prefix, prefixlen))
        return 0;

    const char *rhs = buf + prefixlen;
    if (!CTYPE(isspace,*rhs))
        return 0;

    while (CTYPE(isspace,*rhs))
        rhs++;

    LOG(DEBUG,"bootloader output contained %s %s", prefix, rhs);

    return rhs;
}
Пример #2
0
/* Test 'buffer' to see if it contains a .so include. If so and it's not an 
 * absolute filename, return newly allocated string whose contents are the
 * include.
 */
static char *test_for_include (const char *buffer)
{
	if (!buffer)
		return NULL;

	/* strip out any leading whitespace (if any) */
	while (CTYPE (isspace, *buffer))
		buffer++;

	/* see if the `command' is a .so */
	if (strncmp (buffer, ".so", 3) == 0) {
		buffer += 3;

		/* strip out any whitespace between the command and 
		   it's argumant */
		while (CTYPE (isspace, *buffer))
			buffer++;

		/* If .so's argument is an absolute filename, it could be
		 * either (i) a macro inclusion, (ii) a non local manual page
		 * or (iii) a (somewhat bogus) reference to a local manual 
		 * page.
		 * 
		 * If (i) or (ii), we must not follow the reference. (iii) is
		 * a problem with the manual page, thus we don't want to 
		 * follow any absolute inclusions in our quest for the 
		 * ultimate source file */
		if (*buffer != '/') {
			const char *end = buffer;
			while (*end && !CTYPE (isspace, *end))
				++end;
			return xstrndup (buffer, end - buffer);
		}
	}
	return NULL;
}
Пример #3
0
/* return 1 on word match */
static int match (const char *lowpage, const char *whatis)
{
	char *lowwhatis = lower (whatis);
	size_t len = strlen (lowpage);
	char *p, *begin;

	begin = lowwhatis;
	
	/* check for string match, then see if it is a _word_ */
	while (lowwhatis && (p = strstr (lowwhatis, lowpage))) {
		char *left = p - 1; 
		char *right = p + len;

		if ((p == begin || (!CTYPE (islower, *left) && *left != '_')) &&
		    (!*right || (!CTYPE (islower, *right) && *right != '_'))) {
		    	free (begin);
		    	return 1;
		}
		lowwhatis = p + 1;
	}

	free (begin);
	return 0;
}
Пример #4
0
int libxl_domain_qualifier_to_domid(libxl_ctx *ctx, const char *name,
                                    uint32_t *domid)
{
    int i, rv;
    for (i=0; name[i]; i++) {
        if (!CTYPE(isdigit, name[i])) {
            goto nondigit_found;
        }
    }
    *domid = strtoul(name, NULL, 10);
    return 0;

 nondigit_found:
    /* this could also check for uuids */
    rv = libxl_name_to_domid(ctx, name, domid);
    return rv;
}
Пример #5
0
/* {{{ proto bool ctype_xdigit(mixed c)
   Checks for character(s) representing a hexadecimal digit */
static PHP_FUNCTION(ctype_xdigit)
{
	CTYPE(isxdigit);
}
Пример #6
0
/* {{{ proto bool ctype_alpha(mixed c)
   Checks for alphabetic character(s) */
static PHP_FUNCTION(ctype_alpha)
{
	CTYPE(isalpha);
}
Пример #7
0
/* {{{ proto bool ctype_space(mixed c)
   Checks for whitespace character(s)*/
static PHP_FUNCTION(ctype_space)
{
	CTYPE(isspace);
}
Пример #8
0
/* {{{ proto bool ctype_upper(mixed c)
   Checks for uppercase character(s) */
static PHP_FUNCTION(ctype_upper)
{
	CTYPE(isupper);
}
Пример #9
0
/* {{{ proto bool ctype_print(mixed c)
   Checks for printable character(s) */
static PHP_FUNCTION(ctype_print)
{
	CTYPE(isprint);
}
Пример #10
0
/* {{{ proto bool ctype_punct(mixed c)
   Checks for any printable character which is not whitespace or an alphanumeric character */
static PHP_FUNCTION(ctype_punct)
{
	CTYPE(ispunct);
}
Пример #11
0
/* {{{ proto bool ctype_lower(mixed c)
   Checks for lowercase character(s)  */
static PHP_FUNCTION(ctype_lower)
{
	CTYPE(islower);
}
Пример #12
0
/* {{{ proto bool ctype_graph(mixed c)
   Checks for any printable character(s) except space */
static PHP_FUNCTION(ctype_graph)
{
	CTYPE(isgraph);
}
Пример #13
0
void read_pullparams(t_pull *pull, char *infile, char *outfile) 
{
  t_inpfile *inp;
  int ninp,i;
  char *tmp;           /* for the input parsing macros */
  char dummy[STRLEN];  /* idem */
  char grp1buf[STRLEN], grp2buf[STRLEN], grp3buf[STRLEN], grp4buf[STRLEN],
       grp5buf[STRLEN],
       bf1[STRLEN], bf2[STRLEN], dir[STRLEN], 
       refdir1[STRLEN],refdir2[STRLEN];

  int bReverse; int tmpref; int tmprun; 

  enum {erunSTART, erunAFM, erunConstraint, erunUmbrella, erunTest, erunNR};
  static char *runtypes[erunNR+1] = { 
    "start", "afm", "constraint", "umbrella", "test", NULL
  };
  enum {erefCom, erefComT0, erefDyn, erefDynT0, erefNR};
  static char *reftypes[erefNR+1] = {
    "com", "com_t0", "dynamic", "dynamic_t0", NULL
  };
  enum {ereverseTO_REF, ereverseFROM_REF, ereverseNR};
  static char *reversetypes[ereverseNR+1] = {
    "from_reference", "to_reference", NULL
  };
  enum {everboseYES, everboseNO, everboseNR};
  static char *verbosetypes[erefNR+1] = {
    "no", "yes", NULL
  };
  int nerror = 0;

  /* read input parameter file */
  fprintf(stderr,"Reading parameter file %s\n",infile);
  inp=read_inpfile(infile,&ninp);

  /* general options */
  CTYPE("GENERAL");
  EETYPE("verbose",         pull->bVerbose, verbosetypes, &nerror, TRUE);
  CTYPE("Runtype: start, afm, constraint, umbrella, test");
  EETYPE("runtype",         tmprun, runtypes, &nerror, TRUE);
  CTYPE("Groups to be pulled");
  STYPE("group_1",          grp1buf, "");
  STYPE("group_2",          grp2buf, "");
  STYPE("group_3",          grp3buf, "");
  STYPE("group_4",          grp4buf, "");
  CTYPE("The group for the reaction force.");
  STYPE("reference_group",  grp5buf, "");
  CTYPE("Ref. type: com, com_t0, dynamic, dynamic_t0");
  EETYPE("reftype",         tmpref, reftypes, &nerror, TRUE);
  CTYPE("Use running average for reflag steps for com calculation");
  ITYPE("reflag",           pull->reflag, 1);
  CTYPE("Select components for constraint vector. default: z-only");
  STYPE("direction",        dir, "0.0 0.0 1.0");
  CTYPE("Direction for start/afm: to_reference, from_reference");
  EETYPE("reverse",          pull->bReverse, reversetypes, &nerror, TRUE);

  /* options for dynamic reference groups */
  CTYPE("DYNAMIC REFERENCE GROUP OPTIONS");
  CTYPE("Cylinder radius for dynamic reaction force groups (nm)");
  RTYPE("r",                pull->r, 0.0);
  CTYPE("Switch from r to rc in case of dynamic reaction force");
  RTYPE("rc",   pull->rc,   0.0);
  CTYPE("Update frequency for dynamic reference groups (steps)");
  ITYPE("update",           pull->update, 1);

  /* constraint run options */
  CCTYPE("CONSTRAINT RUN OPTIONS");
  CTYPE("Tolerance of constraints, in nm");
  RTYPE("constraint_tolerance",            pull->constr_tol, 1E-6);

  /* options for AFM type pulling simulations */
  CCTYPE("AFM OPTIONS");
  CTYPE("pull rate in nm/timestep");
  RTYPE("pullrate",         pull->rate,    0.0);
  CTYPE("forceconstant in kJ/(mol*nm^2)");
  RTYPE("forceconstant",    pull->k, 0.0);

  /* umbrella sampling options */
  CCTYPE("UMBRELLA SAMPLING OPTIONS");
  CTYPE("Width of umbrella sampling potential in kJ/(mol*nm^2)");
  RTYPE("width",            pull->um_width, 0.0);

  /* options for making starting structures */
  CCTYPE("STARTING STRUCTURE OPTIONS");
  CTYPE("Start coord. for making starting struct, rel. to ref. grp.: x y z");
  STYPE("r0_group1",        bf1, "");
  STYPE("r0_group2",        bf2, ""); 
  /*  CTYPE("Constrain rotations around principle axes? Needs work");
      ITYPE("rotation_x",       pull->bRot[0], 0);
      ITYPE("rotation_y",       pull->bRot[1], 0);
      ITYPE("rotation_z",       pull->bRot[2], 0);
      CTYPE("Rate of rotation (degrees/step)");
      RTYPE("rotation_rate",    pull->rot_rate, 0.0);
  */
  RTYPE("tolerance",        pull->tolerance, 0.05);
  CTYPE("Rate of translation in all directions (nm/step)");
  RTYPE("translation_rate", pull->xlt_rate, 0.0); 
  CTYPE("Write out structure every ndegr degrees, transstep nm");
  ITYPE("ndegr",            pull->rot_incr, 0);
  RTYPE("transstep",        pull->xlt_incr, 0.001);

  write_inpfile(outfile,ninp,inp);
  for (i=0; (i<ninp); i++) {
    sfree(inp[i].name);
    sfree(inp[i].value);
  }
  sfree(inp);

  pull->runtype = (t_runtype)tmprun;
  pull->reftype = (t_reftype)tmpref;

  /* sort out the groups */
  fprintf(stderr,"Groups: %s %s %s %s %s\n",
	  grp1buf,grp2buf,grp3buf,grp4buf,grp4buf);

  if (!strcmp(grp1buf,"") || !strcmp(grp5buf,"")) 
    fatal_error(0,"Need to specify at least group_1 and reference_group");
  pull->pull.n = 1;
  if (strcmp(grp2buf,"")) 
    pull->pull.n += 1;
  if (strcmp(grp3buf,"")) 
    pull->pull.n += 1;
  if (strcmp(grp4buf,""))
    pull->pull.n += 1;
     
  fprintf(stderr,"Using %d pull groups\n",pull->pull.n);
     
  /* initialize the names of the groups */
  snew(pull->pull.grps,pull->pull.n);
  snew(pull->ref.grps,1);
  pull->pull.grps[0] = (char *)strdup(grp1buf);
  pull->pull.grps[1] = (char *)strdup(grp2buf);
  pull->pull.grps[2] = (char *)strdup(grp3buf);
  pull->pull.grps[3] = (char *)strdup(grp4buf);
  pull->ref.grps[0]  = (char *)strdup(grp5buf);

  if (pull->runtype == eStart) {
    snew(pull->pull.xtarget,pull->pull.n);
    string2rvec(bf1,pull->pull.xtarget[0]);
    if (pull->pull.n == 2)
      string2rvec(bf2,pull->pull.xtarget[1]);
  }

  string2rvec(dir,pull->dims);
  fprintf(stderr,"Using distance components %2.1f %2.1f %2.1f\n",
	  pull->dims[0],pull->dims[1],pull->dims[2]);

  if (pull->r > 0.001) 
    pull->bCyl = TRUE;
  else
    pull->bCyl = FALSE;
}
Пример #14
0
/* {{{ proto bool ctype_cntrl(mixed c)
   Checks for control character(s) */
static PHP_FUNCTION(ctype_cntrl)
{
	CTYPE(iscntrl);
}
Пример #15
0
/* {{{ proto bool ctype_alnum(mixed c)
   Checks for alphanumeric character(s) */
static PHP_FUNCTION(ctype_alnum)
{
	CTYPE(isalnum);
}
Пример #16
0
    const char *str;
    
    
    str    = lua_tolstring(L, 1, &str_len);
    result = strndup(str, str_len);

    php_stripslashes(result, &str_len);
    lua_pushlstring(L, result, str_len);
    free(result);
    result = NULL;
    return 1;
}

static int ctype_alnum(lua_State *L)
{
    CTYPE(isalnum)
}

static int ctype_alpha(lua_State *L)
{
    CTYPE(isalpha)
}

static int ctype_digit(lua_State *L)
{
    CTYPE(isdigit)
}

static int ctype_lower(lua_State *L)
{
    CTYPE(islower)
Пример #17
0
/*! \brief
 * Read parameters of an AWH bias dimension.
 *
 * \param[in,out] ninp_p     Number of read input file entries.
 * \param[in,out] inp_p      Input file entries.
 * \param[in] prefix         Prefix for dimension parameters.
 * \param[in,out] dimParams  AWH dimensional parameters.
 * \param[in] pull_params    Pull parameters.
 * \param[in,out] wi         Struct for bookeeping warnings.
 * \param[in] bComment       True if comments should be printed.
 */
static void readDimParams(int *ninp_p, t_inpfile **inp_p, const char *prefix,
                          AwhDimParams *dimParams, const pull_params_t *pull_params,
                          warninp_t wi, bool bComment)
{
    char       warningmsg[STRLEN];

    int        ninp = *ninp_p;
    t_inpfile *inp  = *inp_p;

    if (bComment)
    {
        CTYPE("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);

    if (bComment)
    {
        CTYPE("The coordinate index for this dimension");
    }
    sprintf(opt, "%s-coord-index", prefix);
    int coordIndexInput;
    ITYPE(opt, coordIndexInput, 1);
    if (coordIndexInput <  1)
    {
        gmx_fatal(FARGS, "Failed to read a valid coordinate index for %s. "
                  "Note that the pull coordinate indexing starts at 1.", opt);
    }

    /* The pull coordinate indices start at 1 in the input file, at 0 internally */
    dimParams->coordIndex = coordIndexInput - 1;

    /* The pull settings need to be consistent with the AWH settings */
    if (!(pull_params->coord[dimParams->coordIndex].eType == epullEXTERNAL) )
    {
        gmx_fatal(FARGS, "AWH biasing can only be  applied to pull type %s",
                  EPULLTYPE(epullEXTERNAL));
    }

    if (dimParams->coordIndex >= pull_params->ncoord)
    {
        gmx_fatal(FARGS, "The given AWH coordinate index (%d) is larger than the number of pull coordinates (%d)",
                  coordIndexInput, pull_params->ncoord);
    }
    if (pull_params->coord[dimParams->coordIndex].rate != 0)
    {
        sprintf(warningmsg, "Setting pull-coord%d-rate (%g) is incompatible with AWH biasing this coordinate", coordIndexInput, pull_params->coord[dimParams->coordIndex].rate);
        warning_error(wi, warningmsg);
    }

    /* Grid params for each axis */
    int eGeom = pull_params->coord[dimParams->coordIndex].eGeom;

    if (bComment)
    {
        CTYPE("Start and end values for each coordinate dimension");
    }

    sprintf(opt, "%s-start", prefix);
    RTYPE(opt, dimParams->origin, 0.);

    sprintf(opt, "%s-end", prefix);
    RTYPE(opt, dimParams->end, 0.);

    if (gmx_within_tol(dimParams->end - dimParams->origin, 0, GMX_REAL_EPS))
    {
        sprintf(warningmsg, "The given interval length given by %s-start (%g) and %s-end (%g) is zero. "
                "This will result in only one point along this axis in the coordinate value grid.",
                prefix, dimParams->origin, prefix, dimParams->end);
        warning(wi, warningmsg);
    }
    /* Check that the requested interval is in allowed range */
    if (eGeom == epullgDIST)
    {
        if (dimParams->origin < 0 || dimParams->end < 0)
        {
            gmx_fatal(FARGS, "%s-start (%g) or %s-end (%g) set to a negative value. With pull geometry distance coordinate values are non-negative. "
                      "Perhaps you want to use geometry %s instead?",
                      prefix, dimParams->origin, prefix, dimParams->end, EPULLGEOM(epullgDIR));
        }
    }
    else if (eGeom == epullgANGLE || eGeom == epullgANGLEAXIS)
    {
        if (dimParams->origin < 0 || dimParams->end > 180)
        {
            gmx_fatal(FARGS, "%s-start (%g) and %s-end (%g) are outside of the allowed range 0 to 180 deg for pull geometries %s and %s ",
                      prefix, dimParams->origin, prefix, dimParams->end, EPULLGEOM(epullgANGLE), EPULLGEOM(epullgANGLEAXIS));
        }
    }
    else if (eGeom == epullgDIHEDRAL)
    {
        if (dimParams->origin < -180 || dimParams->end > 180)
        {
            gmx_fatal(FARGS, "%s-start (%g) and %s-end (%g) are outside of the allowed range -180 to 180 deg for pull geometry %s. ",
                      prefix, dimParams->origin, prefix, dimParams->end, EPULLGEOM(epullgDIHEDRAL));
        }
    }

    if (bComment)
    {
        CTYPE("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);
    if (dimParams->forceConstant <= 0)
    {
        warning_error(wi, "The force AWH bias force constant should be > 0");
    }

    if (bComment)
    {
        CTYPE("Estimated diffusion constant (nm^2/ps or rad^2/ps)");
    }
    sprintf(opt, "%s-diffusion", prefix);
    RTYPE(opt, dimParams->diffusion, 0);

    if (dimParams->diffusion <= 0)
    {
        const double diffusion_default = 1e-5;
        sprintf(warningmsg, "%s not explicitly set by user."
                " You can choose to use a default value (%g nm^2/ps or rad^2/ps) but this may very well be non-optimal for your system!",
                opt, diffusion_default);
        warning(wi, warningmsg);
        dimParams->diffusion = diffusion_default;
    }

    if (bComment)
    {
        CTYPE("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);

    if (dimParams->coverDiameter < 0)
    {
        gmx_fatal(FARGS, "%s (%g) cannot be negative.",
                  opt, dimParams->coverDiameter);
    }

    *ninp_p   = ninp;
    *inp_p    = inp;
}
Пример #18
0
AwhParams *readAndCheckAwhParams(int *ninp_p, t_inpfile **inp_p, const t_inputrec *ir, warninp_t wi)
{
    char       opt[STRLEN], prefix[STRLEN], prefixawh[STRLEN];

    AwhParams *awhParams;
    snew(awhParams, 1);

    int        ninp = *ninp_p;
    t_inpfile *inp  = *inp_p;

    sprintf(prefix, "%s", "awh");

    /* Parameters common for all biases */

    CTYPE("The way to apply the biasing potential: convolved or umbrella");
    sprintf(opt, "%s-potential", prefix);
    EETYPE(opt, awhParams->ePotential, eawhpotential_names);

    CTYPE("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);
    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");
    sprintf(opt, "%s-nstout", prefix);
    ITYPE(opt, awhParams->nstOut, 100000);
    if (awhParams->nstOut <= 0)
    {
        char buf[STRLEN];
        sprintf(buf, "Not writing AWH output with AWH (%s = %d) does not make sense",
                opt, awhParams->nstOut);
        warning_error(wi, buf);
    }
    /* This restriction can be removed by changing a flag of print_ebin() */
    if (ir->nstenergy == 0 || awhParams->nstOut % ir->nstenergy != 0)
    {
        char buf[STRLEN];
        sprintf(buf, "%s (%d) should be a multiple of nstenergy (%d)",
                opt, awhParams->nstOut, ir->nstenergy);
        warning_error(wi, buf);
    }

    CTYPE("Coordinate sampling interval in number of steps");
    sprintf(opt, "%s-nstsample", prefix);
    ITYPE(opt, awhParams->nstSampleCoord, 10);

    CTYPE("Free energy and bias update interval in number of samples");
    sprintf(opt, "%s-nsamples-update", prefix);
    ITYPE(opt, awhParams->numSamplesUpdateFreeEnergy, 10);

    CTYPE("When true, biases with share-group>0 are shared between multiple simulations");
    sprintf(opt, "%s-share-multisim", prefix);
    EETYPE(opt, awhParams->shareBiasMultisim, yesno_names);

    CTYPE("The number of independent AWH biases");
    sprintf(opt, "%s-nbias", prefix);
    ITYPE(opt, awhParams->numBias, 1);
    if (awhParams->numBias <= 0)
    {
        gmx_fatal(FARGS, "%s needs to be an integer > 0", opt);
    }

    /* Read the parameters specific to each AWH bias */
    snew(awhParams->awhBiasParams, awhParams->numBias);

    for (int k = 0; k < awhParams->numBias; k++)
    {
        bool bComment = (k == 0);
        sprintf(prefixawh, "%s%d", prefix, k + 1);
        read_bias_params(&ninp, &inp, &awhParams->awhBiasParams[k], prefixawh, ir, wi, bComment);
    }

    /* Do a final consistency check before returning */
    checkInputConsistencyAwh(*awhParams, wi);

    if (ir->init_step != 0)
    {
        warning_error(wi, "With AWH init-step should be 0");
    }

    *ninp_p   = ninp;
    *inp_p    = inp;

    return awhParams;
}
Пример #19
0
/*! \brief
 * Read parameters of an AWH bias.
 *
 * \param[in,out] ninp_p         Number of read input file entries.
 * \param[in,out] inp_p          Input file entries.
 * \param[in,out] awhBiasParams  AWH dimensional parameters.
 * \param[in]     prefix         Prefix for bias parameters.
 * \param[in]     ir             Input parameter struct.
 * \param[in,out] wi             Struct for bookeeping warnings.
 * \param[in]     bComment       True if comments should be printed.
 */
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;
    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)");
    }
    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);
    if (awhBiasParams->errorInitial <= 0)
    {
        gmx_fatal(FARGS, "%s (%d) needs to be > 0.", opt);
    }

    if (bComment)
    {
        CTYPE("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);

    if (bComment)
    {
        CTYPE("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);
    if (awhBiasParams->equilibrateHistogram && awhBiasParams->eGrowth != eawhgrowthEXP_LINEAR)
    {
        sprintf(warningmsg, "Option %s will only have an effect for histogram growth type '%s'.",
                opt, EAWHGROWTH(eawhgrowthEXP_LINEAR));
        warning(wi, warningmsg);
    }

    if (bComment)
    {
        CTYPE("Target distribution type: constant, cutoff, boltzmann or local-boltzmann");
    }
    sprintf(opt, "%s-target", prefix);
    EETYPE(opt, awhBiasParams->eTarget, eawhtarget_names);

    if ((awhBiasParams->eTarget == eawhtargetLOCALBOLTZMANN) &&
        (awhBiasParams->eGrowth == eawhgrowthEXP_LINEAR))
    {
        sprintf(warningmsg, "Target type '%s' combined with histogram growth type '%s' is not "
                "expected to give stable bias updates. You probably want to use growth type "
                "'%s' instead.",
                EAWHTARGET(eawhtargetLOCALBOLTZMANN), EAWHGROWTH(eawhgrowthEXP_LINEAR),
                EAWHGROWTH(eawhgrowthLINEAR));
        warning(wi, warningmsg);
    }

    if (bComment)
    {
        CTYPE("Boltzmann beta scaling factor for target distribution types 'boltzmann' and 'boltzmann-local'");
    }
    sprintf(opt, "%s-target-beta-scaling", prefix);
    RTYPE(opt, awhBiasParams->targetBetaScaling, 0);

    switch (awhBiasParams->eTarget)
    {
        case eawhtargetBOLTZMANN:
        case eawhtargetLOCALBOLTZMANN:
            if (awhBiasParams->targetBetaScaling < 0 || awhBiasParams->targetBetaScaling > 1)
            {
                gmx_fatal(FARGS, "%s = %g is not useful for target type %s.",
                          opt, awhBiasParams->targetBetaScaling, EAWHTARGET(awhBiasParams->eTarget));
            }
            break;
        default:
            if (awhBiasParams->targetBetaScaling != 0)
            {
                gmx_fatal(FARGS, "Value for %s (%g) set explicitly but will not be used for target type %s.",
                          opt, awhBiasParams->targetBetaScaling, EAWHTARGET(awhBiasParams->eTarget));
            }
            break;
    }

    if (bComment)
    {
        CTYPE("Free energy cutoff value for target distribution type 'cutoff'");
    }
    sprintf(opt, "%s-target-cutoff", prefix);
    RTYPE(opt, awhBiasParams->targetCutoff, 0);

    switch (awhBiasParams->eTarget)
    {
        case eawhtargetCUTOFF:
            if (awhBiasParams->targetCutoff <= 0)
            {
                gmx_fatal(FARGS, "%s = %g is not useful for target type %s.",
                          opt, awhBiasParams->targetCutoff, EAWHTARGET(awhBiasParams->eTarget));
            }
            break;
        default:
            if (awhBiasParams->targetCutoff != 0)
            {
                gmx_fatal(FARGS, "Value for %s (%g) set explicitly but will not be used for target type %s.",
                          opt, awhBiasParams->targetCutoff, EAWHTARGET(awhBiasParams->eTarget));
            }
            break;
    }

    if (bComment)
    {
        CTYPE("Initialize PMF and target with user data: no or yes");
    }
    sprintf(opt, "%s-user-data", prefix);
    EETYPE(opt, awhBiasParams->bUserData, yesno_names);

    if (bComment)
    {
        CTYPE("Group index to share the bias with, 0 means not shared");
    }
    sprintf(opt, "%s-share-group", prefix);
    ITYPE(opt, awhBiasParams->shareGroup, 0);
    if (awhBiasParams->shareGroup < 0)
    {
        warning_error(wi, "AWH bias share-group should be >= 0");
    }

    if (bComment)
    {
        CTYPE("Dimensionality of the coordinate");
    }
    sprintf(opt, "%s-ndim", prefix);
    ITYPE(opt, awhBiasParams->ndim, 0);

    if (awhBiasParams->ndim <= 0 ||
        awhBiasParams->ndim > c_biasMaxNumDim)
    {
        gmx_fatal(FARGS, "%s-ndim (%d) needs to be > 0 and at most %d\n", prefix,  awhBiasParams->ndim, c_biasMaxNumDim);
    }
    if (awhBiasParams->ndim > 2)
    {
        warning_note(wi, "For awh-dim > 2 the estimate based on the diffusion and the initial error is currently only a rough guideline."
                     " You should verify its usefulness for your system before production runs!");
    }
    snew(awhBiasParams->dimParams, awhBiasParams->ndim);
    for (int d = 0; d < awhBiasParams->ndim; d++)
    {
        bComment = bComment && d == 0;
        sprintf(prefixdim, "%s-dim%d", prefix, d + 1);
        readDimParams(&ninp, &inp, prefixdim, &awhBiasParams->dimParams[d], ir->pull, wi, bComment);
    }

    /* Check consistencies here that cannot be checked at read time at a lower level. */
    checkInputConsistencyAwhBias(*awhBiasParams, wi);

    *ninp_p   = ninp;
    *inp_p    = inp;
}