Make global topology constant in energyOutput.printAnnealingTemperatures()
authorPascal Merz <pascal.merz@me.com>
Tue, 24 Mar 2020 02:50:56 +0000 (20:50 -0600)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 7 Apr 2020 07:17:19 +0000 (07:17 +0000)
energyOutput.printAnnealingTemperatures() takes a non-const pointer
to the SimulationGroups object stored in the global topology, but
only ever reads its information. This makes the pointer const.

Refs #3467

src/gromacs/mdlib/energyoutput.cpp
src/gromacs/mdlib/energyoutput.h
src/gromacs/mdrun/md.cpp
src/gromacs/mdrun/mimic.cpp
src/gromacs/mdrun/rerun.cpp
src/gromacs/mdrun/tpi.cpp

index 345b8438fd9ac15b72e48125aaf50cd4ba1e94ef..567af7d88040e64e3c7b4663f4a6b8f92c0a3534 100644 (file)
@@ -1294,7 +1294,7 @@ void EnergyOutput::printStepToEnergyFile(ener_file* fp_ene,
     }
 }
 
-void EnergyOutput::printAnnealingTemperatures(FILE* log, SimulationGroups* groups, t_grpopts* opts)
+void EnergyOutput::printAnnealingTemperatures(FILE* log, const SimulationGroups* groups, t_grpopts* opts)
 {
     if (log)
     {
index 898093092af71d56660432b150d836a4bbd447f8..fe9b06f311d97a88867ca1f854472d47b3c19e37 100644 (file)
@@ -216,7 +216,7 @@ public:
      * \param[in] opts    Atom temperature coupling groups options
      *                    (annealing is done by groups).
      */
-    void printAnnealingTemperatures(FILE* log, SimulationGroups* groups, t_grpopts* opts);
+    void printAnnealingTemperatures(FILE* log, const SimulationGroups* groups, t_grpopts* opts);
 
     /*! \brief Prints average values to log file.
      *
index 4147925cdf1118c7c1051329668822606ee374e6..91ec7978129e9e4a783a499b0da7d6c6fa840756 100644 (file)
@@ -236,7 +236,7 @@ void gmx::LegacySimulator::do_md()
     int nstglobalcomm = computeGlobalCommunicationPeriod(mdlog, ir, cr);
     bGStatEveryStep   = (nstglobalcomm == 1);
 
-    SimulationGroups* groups = &top_global->groups;
+    const SimulationGroups* groups = &top_global->groups;
 
     std::unique_ptr<EssentialDynamics> ed = nullptr;
     if (opt2bSet("-ei", nfile, fnm))
index bfb2cca0e3b1c92f4e6bd354bf350e1d50256bd9..a8130c680c8c81b22959e70be4e694ea94cf6d60 100644 (file)
@@ -218,7 +218,7 @@ void gmx::LegacySimulator::do_mimic()
     }
 
     ir->nstxout_compressed                   = 0;
-    SimulationGroups* groups                 = &top_global->groups;
+    const SimulationGroups* groups           = &top_global->groups;
     top_global->intermolecularExclusionGroup = genQmmmIndices(*top_global);
 
     initialize_lambdas(fplog, *ir, MASTER(cr), &state_global->fep_state, state_global->lambda, lam0);
index 6fe368c30e69c93960052a9fc0c38f7683bcff6c..dfa8d39ae499d9862d81e1a9ae5f1dda0c985da8 100644 (file)
@@ -276,8 +276,8 @@ void gmx::LegacySimulator::do_rerun()
     int        nstglobalcomm = 1;
     const bool bNS           = true;
 
-    ir->nstxout_compressed   = 0;
-    SimulationGroups* groups = &top_global->groups;
+    ir->nstxout_compressed         = 0;
+    const SimulationGroups* groups = &top_global->groups;
     if (ir->eI == eiMimic)
     {
         top_global->intermolecularExclusionGroup = genQmmmIndices(*top_global);
index e33081a46a37a729d3c6ec10ce0ce5e61f04d1e0..68836614a66e1d7ae0f8a04538c75ab3da0d1a0e 100644 (file)
@@ -223,7 +223,7 @@ void LegacySimulator::do_tpi()
 
     gmx_mtop_generate_local_top(*top_global, &top, inputrec->efep != efepNO);
 
-    SimulationGroups* groups = &top_global->groups;
+    const SimulationGroups* groups = &top_global->groups;
 
     bCavity = (inputrec->eI == eiTPIC);
     if (bCavity)