if (!simulatedAnnealingGroupNames.empty() &&
simulatedAnnealingGroupNames.size() != size_t(nr))
{
- gmx_fatal(FARGS, "Not enough annealing values: %zu (for %d groups)\n",
+ gmx_fatal(FARGS, "Wrong number of annealing values: %zu (for %d groups)\n",
simulatedAnnealingGroupNames.size(), nr);
}
else
simulatedAnnealingPoints.size(), simulatedAnnealingGroupNames.size());
}
convertInts(wi, simulatedAnnealingPoints, "annealing points", ir->opts.anneal_npoints);
- for (k = 0, i = 0; i < nr; i++)
+ int k = 0;
+ for (i = 0; i < nr; i++)
{
if (ir->opts.anneal_npoints[i] == 1)
{
}
auto simulatedAnnealingTimes = gmx::splitString(is->anneal_time);
+
if (simulatedAnnealingTimes.size() != size_t(k))
{
gmx_fatal(FARGS, "Found %zu annealing-time values, wanted %d\n",
simulatedAnnealingTemperatures.size(), k);
}
- convertReals(wi, simulatedAnnealingTimes, "anneal-time", ir->opts.anneal_time[i]);
- convertReals(wi, simulatedAnnealingTemperatures, "anneal-temp", ir->opts.anneal_temp[i]);
+ real *allSimulatedAnnealingTimes;
+ real *allSimulatedAnnealingTemperatures;
+ snew(allSimulatedAnnealingTimes, k);
+ snew(allSimulatedAnnealingTemperatures, k);
+ convertReals(wi, simulatedAnnealingTimes, "anneal-time", allSimulatedAnnealingTimes);
+ convertReals(wi, simulatedAnnealingTemperatures, "anneal-temp", allSimulatedAnnealingTemperatures);
+ /* TODO the code here could use some more general clean up and restructuring.
+ * This will also help in understanding the use of variables in the loop.
+ */
for (i = 0, k = 0; i < nr; i++)
{
for (j = 0; j < ir->opts.anneal_npoints[i]; j++)
{
+ ir->opts.anneal_time[i][j] = allSimulatedAnnealingTimes[k];
+ ir->opts.anneal_temp[i][j] = allSimulatedAnnealingTemperatures[k];
if (j == 0)
{
if (ir->opts.anneal_time[i][0] > (ir->init_t+GMX_REAL_EPS))
k++;
}
}
+ sfree(allSimulatedAnnealingTimes);
+ sfree(allSimulatedAnnealingTemperatures);
/* Print out some summary information, to make sure we got it right */
for (i = 0, k = 0; i < nr; i++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2010, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016,2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2016,2017,2018,2019, 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.
{
sfree(ir->opts.nrdf);
sfree(ir->opts.ref_t);
+ for (int i = 0; i < ir->opts.ngtc; i++)
+ {
+ sfree(ir->opts.anneal_time[i]);
+ sfree(ir->opts.anneal_temp[i]);
+ }
sfree(ir->opts.annealing);
sfree(ir->opts.anneal_npoints);
sfree(ir->opts.anneal_time);