#include "gromacs/applied_forces/awh/read_params.h"
#include "gromacs/math/veccompare.h"
#include "gromacs/math/vecdump.h"
+#include "gromacs/mdlib/vcm.h"
#include "gromacs/mdtypes/awh_params.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/multipletimestepping.h"
constexpr int c_defaultNstTCouple = 10;
constexpr int c_defaultNstPCouple = 10;
-t_inputrec::t_inputrec()
+t_inputrec::t_inputrec() :
+ fepvals(std::make_unique<t_lambda>()),
+ simtempvals(std::make_unique<t_simtemp>()),
+ expandedvals(std::make_unique<t_expanded>())
{
- // TODO When this memset is removed, remove the suppression of
- // gcc -Wno-class-memaccess in a CMakeLists.txt file.
- std::memset(this, 0, sizeof(*this)); // NOLINT(bugprone-undefined-memory-manipulation)
- fepvals = std::make_unique<t_lambda>();
- expandedvals = std::make_unique<t_expanded>();
- simtempvals = std::make_unique<t_simtemp>();
}
t_inputrec::~t_inputrec()
sfree(rot);
}
+static void done_t_swapCoords(t_swapcoords* swapCoords)
+{
+ if (swapCoords == nullptr)
+ {
+ return;
+ }
+ for (int i = 0; i < swapCoords->ngrp; i++)
+ {
+ sfree(swapCoords->grp[i].ind);
+ sfree(swapCoords->grp[i].molname);
+ }
+ sfree(swapCoords->grp);
+ sfree(swapCoords);
+}
+
void done_inputrec(t_inputrec* ir)
{
sfree(ir->opts.nrdf);
sfree(ir->opts.anneal_time);
sfree(ir->opts.anneal_temp);
sfree(ir->opts.tau_t);
+ sfree(ir->opts.acceleration);
sfree(ir->opts.nFreeze);
sfree(ir->opts.egp_flags);
+ done_t_swapCoords(ir->swap);
done_t_rot(ir->rot);
delete ir->params;
}
}
}
+ pr_indent(out, indent);
+ fprintf(out, "acc:\t");
+ for (i = 0; (i < opts->ngacc); i++)
+ {
+ for (m = 0; (m < DIM); m++)
+ {
+ fprintf(out, " %10g", opts->acceleration[i][m]);
+ }
+ }
+ fprintf(out, "\n");
+
pr_indent(out, indent);
fprintf(out, "nfreeze:");
for (i = 0; (i < opts->ngfrz); i++)
static void pr_pull_coord(FILE* fp, int indent, int c, const t_pull_coord* pcrd)
{
- int g;
-
pr_indent(fp, indent);
fprintf(fp, "pull-coord %d:\n", c);
PS("type", enumValueToString(pcrd->eType));
PS("potential-provider", pcrd->externalPotentialProvider.c_str());
}
PS("geometry", enumValueToString(pcrd->eGeom));
- for (g = 0; g < pcrd->ngroup; g++)
+ for (int g = 0; g < pcrd->ngroup; g++)
{
- char buf[STRLEN];
-
- sprintf(buf, "group[%d]", g);
- PI(buf, pcrd->group[g]);
+ std::string buffer = gmx::formatString("group[%d]", g);
+ PI(buffer.c_str(), pcrd->group[g]);
}
pr_ivec(fp, indent, "dim", pcrd->dim, DIM, TRUE);
pr_rvec(fp, indent, "origin", pcrd->origin, DIM, TRUE);
PS("simulated-tempering-scaling", enumValueToString(simtemp->eSimTempScale));
PR("sim-temp-low", simtemp->simtemp_low);
PR("sim-temp-high", simtemp->simtemp_high);
- pr_rvec(fp, indent, "simulated tempering temperatures", simtemp->temperatures, n_lambda, TRUE);
+ pr_rvec(fp, indent, "simulated tempering temperatures", simtemp->temperatures.data(), n_lambda, TRUE);
}
static void pr_expandedvals(FILE* fp, int indent, const t_expanded* expand, int n_lambda)
PD("dh-hist-spacing", fep->dh_hist_spacing);
PS("separate-dhdl-file", enumValueToString(fep->separate_dhdl_file));
PS("dhdl-derivatives", enumValueToString(fep->dhdl_derivatives));
+ PS("sc-function", enumValueToString(fep->softcoreFunction));
+ PR("sc-gapsys-scale-linpoint-lj", fep->scGapsysScaleLinpointLJ);
+ PR("sc-gapsys-scale-linpoint-q", fep->scGapsysScaleLinpointQ);
+ PR("sc-gapsys-sigma-lj", fep->scGapsysSigmaLJ);
};
static void pr_pull(FILE* fp, int indent, const pull_params_t& pull)
char buf1[256], buf2[256];
cmp_int(fp, "inputrec->grpopts.ngtc", -1, opt1->ngtc, opt2->ngtc);
+ cmp_int(fp, "inputrec->grpopts.ngacc", -1, opt1->ngacc, opt2->ngacc);
cmp_int(fp, "inputrec->grpopts.ngfrz", -1, opt1->ngfrz, opt2->ngfrz);
cmp_int(fp, "inputrec->grpopts.ngener", -1, opt1->ngener, opt2->ngener);
for (i = 0; (i < std::min(opt1->ngtc, opt2->ngtc)); i++)
}
}
}
+ for (i = 0; (i < std::min(opt1->ngacc, opt2->ngacc)); i++)
+ {
+ cmp_rvec(fp, "inputrec->grpopts.acceleration", i, opt1->acceleration[i], opt2->acceleration[i], ftol, abstol);
+ }
for (i = 0; (i < std::min(opt1->ngfrz, opt2->ngfrz)); i++)
{
cmp_ivec(fp, "inputrec->grpopts.nFreeze", i, opt1->nFreeze[i], opt2->nFreeze[i]);
cmpEnum(fp, "inputrec->dhdl_derivatives", fep1->dhdl_derivatives, fep2->dhdl_derivatives);
cmp_int(fp, "inputrec->dh_hist_size", -1, fep1->dh_hist_size, fep2->dh_hist_size);
cmp_double(fp, "inputrec->dh_hist_spacing", -1, fep1->dh_hist_spacing, fep2->dh_hist_spacing, ftol, abstol);
+ cmpEnum(fp, "inputrec->fepvals->softcoreFunction", fep1->softcoreFunction, fep2->softcoreFunction);
+ cmp_real(fp,
+ "inputrec->fepvals->scGapsysScaleLinpointLJ",
+ -1,
+ fep1->scGapsysScaleLinpointLJ,
+ fep2->scGapsysScaleLinpointLJ,
+ ftol,
+ abstol);
+ cmp_real(fp,
+ "inputrec->fepvals->scGapsysScaleLinpointQ",
+ -1,
+ fep1->scGapsysScaleLinpointQ,
+ fep2->scGapsysScaleLinpointQ,
+ ftol,
+ abstol);
+ cmp_real(fp, "inputrec->fepvals->scGapsysSigmaLJ", -1, fep1->scGapsysSigmaLJ, fep2->scGapsysSigmaLJ, ftol, abstol);
}
void cmp_inputrec(FILE* fp, const t_inputrec* ir1, const t_inputrec* ir2, real ftol, real abstol)
return (ir->pbcType == PbcType::XY && ir->nwall == 2);
}
+bool inputrecFrozenAtoms(const t_inputrec* ir)
+{
+ return ((ir->opts.nFreeze != nullptr)
+ && (ir->opts.ngfrz > 1 || ir->opts.nFreeze[0][XX] != 0 || ir->opts.nFreeze[0][YY] != 0
+ || ir->opts.nFreeze[0][ZZ] != 0));
+}
+
bool integratorHasConservedEnergyQuantity(const t_inputrec* ir)
{
if (!EI_MD(ir->eI))