* 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.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
bool bInitStep,
gmx::StartingBehavior startingBehavior,
int nstglobalcomm,
- t_inputrec* ir,
+ const t_inputrec* ir,
t_forcerec* fr,
t_commrec* cr,
t_state* state,
}
void integrateVVSecondStep(int64_t step,
- t_inputrec* ir,
+ const t_inputrec* ir,
t_forcerec* fr,
t_commrec* cr,
t_state* state,
* 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.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
bool bInitStep,
gmx::StartingBehavior startingBehavior,
int nstglobalcomm,
- t_inputrec* ir,
+ const t_inputrec* ir,
t_forcerec* fr,
t_commrec* cr,
t_state* state,
* \param[in] wcycle Wall-clock cycle counter.
*/
void integrateVVSecondStep(int64_t step,
- t_inputrec* ir,
+ const t_inputrec* ir,
t_forcerec* fr,
t_commrec* cr,
t_state* state,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, 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.
IMDOutputProvider* outputProvider;
//! Handles notifications to MdModules for checkpoint writing
const MdModulesNotifier& mdModulesNotifier;
- //! Contains user input mdp options.
- t_inputrec* inputrec;
+ //! Contains user input mdp options. Note: The const-ness is casted away in a few instances, see #3854.
+ const t_inputrec* inputrec;
//! The Interactive Molecular Dynamics session.
ImdSession* imdSession;
//! The pull work object.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011-2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2011-2019,2020,2021, 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.
// alias to avoid a large ripple of nearly useless changes.
// t_inputrec is being replaced by IMdpOptionsProvider, so this
// will go away eventually.
- t_inputrec* ir = inputrec;
+ const t_inputrec* ir = inputrec;
+
int64_t step, step_rel;
double t, t0 = ir->init_t;
gmx_bool bGStatEveryStep, bGStat, bCalcVir, bCalcEnerStep, bCalcEner;
int* fep_state = MASTER(cr) ? &state_global->fep_state : nullptr;
gmx::ArrayRef<real> lambda = MASTER(cr) ? state_global->lambda : gmx::ArrayRef<real>();
initialize_lambdas(fplog, *ir, MASTER(cr), fep_state, lambda);
- Update upd(*ir, deform);
- const bool doSimulatedAnnealing = initSimulatedAnnealing(ir, &upd);
- const bool useReplicaExchange = (replExParams.exchangeInterval > 0);
+ Update upd(*ir, deform);
+ bool doSimulatedAnnealing = false;
+ {
+ // TODO: Avoid changing inputrec (#3854)
+ // Simulated annealing updates the reference temperature.
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ doSimulatedAnnealing = initSimulatedAnnealing(nonConstInputrec, &upd);
+ }
+ const bool useReplicaExchange = (replExParams.exchangeInterval > 0);
const t_fcdata& fcdata = *fr->fcdata;
if (doSimulatedAnnealing)
{
- update_annealing_target_temp(ir, t, &upd);
+ // TODO: Avoid changing inputrec (#3854)
+ // Simulated annealing updates the reference temperature.
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ update_annealing_target_temp(nonConstInputrec, t, &upd);
}
/* Stop Center of Mass motion */
actually move to the new state before outputting
statistics, but if performing simulated tempering, we
do update the velocities and the tau_t. */
-
- lamnew = ExpandedEnsembleDynamics(
- fplog, ir, enerd, state, &MassQ, state->fep_state, state->dfhist, step, state->v.rvec_array(), mdatoms);
+ // TODO: Avoid changing inputrec (#3854)
+ // Simulated tempering updates the reference temperature.
+ // Expanded ensemble without simulated tempering does not change the inputrec.
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ lamnew = ExpandedEnsembleDynamics(fplog,
+ nonConstInputrec,
+ enerd,
+ state,
+ &MassQ,
+ state->fep_state,
+ state->dfhist,
+ step,
+ state->v.rvec_array(),
+ mdatoms);
/* history is maintained in state->dfhist, but state_global is what is sent to trajectory and log output */
if (MASTER(cr))
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
void gmx::LegacySimulator::do_mimic()
{
- t_inputrec* ir = inputrec;
+ const t_inputrec* ir = inputrec;
int64_t step, step_rel;
double t;
bool isLastStep = false;
}
/* Settings for rerun */
- ir->nstlist = 1;
- ir->nstcalcenergy = 1;
+ {
+ // TODO: Avoid changing inputrec (#3854)
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ nonConstInputrec->nstlist = 1;
+ nonConstInputrec->nstcalcenergy = 1;
+ nonConstInputrec->nstxout_compressed = 0;
+ }
int nstglobalcomm = 1;
const bool bNS = true;
MimicCommunicator::init();
auto nonConstGlobalTopology = const_cast<gmx_mtop_t*>(top_global);
MimicCommunicator::sendInitData(nonConstGlobalTopology, state_global->x);
- ir->nsteps = MimicCommunicator::getStepNumber();
+ // TODO: Avoid changing inputrec (#3854)
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ nonConstInputrec->nsteps = MimicCommunicator::getStepNumber();
+ }
+ if (DOMAINDECOMP(cr))
+ {
+ // TODO: Avoid changing inputrec (#3854)
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ gmx_bcast(sizeof(ir->nsteps), &nonConstInputrec->nsteps, cr->mpi_comm_mygroup);
}
- ir->nstxout_compressed = 0;
const SimulationGroups* groups = &top_global->groups;
{
auto nonConstGlobalTopology = const_cast<gmx_mtop_t*>(top_global);
nullptr,
FALSE);
shouldCheckNumberOfBondedInteractions = true;
- gmx_bcast(sizeof(ir->nsteps), &ir->nsteps, cr->mpi_comm_mygroup);
}
else
{
finish_em(cr, outf, walltime_accounting, wcycle);
/* To print the actual number of steps we needed somewhere */
- inputrec->nsteps = count;
+ {
+ // TODO: Avoid changing inputrec (#3854)
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ nonConstInputrec->nsteps = count;
+ }
walltime_accounting_set_nsteps_done(walltime_accounting, count);
}
print_em_start(fplog, cr, walltime_accounting, wcycle, NM);
/* fudge nr of steps to nr of atoms */
- inputrec->nsteps = atom_index.size() * 2;
+ {
+ // TODO: Avoid changing inputrec (#3854)
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ nonConstInputrec->nsteps = atom_index.size() * 2;
+ }
if (bIsMaster)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
// alias to avoid a large ripple of nearly useless changes.
// t_inputrec is being replaced by IMdpOptionsProvider, so this
// will go away eventually.
- t_inputrec* ir = inputrec;
+ const t_inputrec* ir = inputrec;
int64_t step, step_rel;
double t;
bool isLastStep = false;
}
/* Settings for rerun */
- ir->nstlist = 1;
- ir->nstcalcenergy = 1;
+ {
+ // TODO: Avoid changing inputrec (#3854)
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ nonConstInputrec->nstlist = 1;
+ nonConstInputrec->nstcalcenergy = 1;
+ nonConstInputrec->nstxout_compressed = 0;
+ }
int nstglobalcomm = 1;
const bool bNS = true;
- ir->nstxout_compressed = 0;
const SimulationGroups* groups = &top_global->groups;
if (ir->eI == eiMimic)
{
* 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.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
* inserted atoms located in the center of the sphere, so we need
* a buffer of size of the sphere and molecule radius.
*/
- inputrec->rlist = maxCutoff + 2 * inputrec->rtpi + 2 * molRadius;
- fr->rlist = inputrec->rlist;
+ {
+ // TODO: Avoid changing inputrec (#3854)
+ auto* nonConstInputrec = const_cast<t_inputrec*>(inputrec);
+ nonConstInputrec->rlist = maxCutoff + 2 * inputrec->rtpi + 2 * molRadius;
+ }
+ fr->rlist = inputrec->rlist;
fr->nbv->changePairlistRadii(inputrec->rlist, inputrec->rlist);
ngid = groups->groups[SimulationAtomGroupType::EnergyOutput].size();