Bulk change to const ref for mtop
[alexxy/gromacs.git] / src / gromacs / mdrun / rerun.cpp
index a73f407dc72cacded5bba8bdef175c02ec7c15e9..8b11f9630e8464228e297c9bfa2fb78b0d151367 100644 (file)
@@ -181,7 +181,7 @@ void gmx::LegacySimulator::do_rerun()
     t_trxstatus*      status = nullptr;
     rvec              mu_tot;
     t_trxframe        rerun_fr;
-    gmx_localtop_t    top(top_global->ffparams);
+    gmx_localtop_t    top(top_global.ffparams);
     ForceBuffers      f;
     gmx_global_stat_t gstat;
     gmx_shellfc_t*    shellfc;
@@ -276,11 +276,11 @@ void gmx::LegacySimulator::do_rerun()
     int        nstglobalcomm = 1;
     const bool bNS           = true;
 
-    const SimulationGroups* groups = &top_global->groups;
+    const SimulationGroups* groups = &top_global.groups;
     if (ir->eI == IntegrationAlgorithm::Mimic)
     {
-        auto nonConstGlobalTopology                          = const_cast<gmx_mtop_t*>(top_global);
-        nonConstGlobalTopology->intermolecularExclusionGroup = genQmmmIndices(*top_global);
+        auto nonConstGlobalTopology                          = const_cast<gmx_mtop_t*>(&top_global);
+        nonConstGlobalTopology->intermolecularExclusionGroup = genQmmmIndices(top_global);
     }
     int*                fep_state = MASTER(cr) ? &state_global->fep_state : nullptr;
     gmx::ArrayRef<real> lambda    = MASTER(cr) ? state_global->lambda : gmx::ArrayRef<real>();
@@ -301,7 +301,7 @@ void gmx::LegacySimulator::do_rerun()
                                    simulationsShareState,
                                    ms);
     gmx::EnergyOutput energyOutput(mdoutf_get_fp_ene(outf),
-                                   *top_global,
+                                   top_global,
                                    *ir,
                                    pull_work,
                                    mdoutf_get_fp_dhdl(outf),
@@ -321,7 +321,7 @@ void gmx::LegacySimulator::do_rerun()
                                  runScheduleWork->simulationWork.useGpuPme);
 
     {
-        double io = compute_io(ir, top_global->natoms, *groups, energyOutput.numEnergyTerms(), 1);
+        double io = compute_io(ir, top_global.natoms, *groups, energyOutput.numEnergyTerms(), 1);
         if ((io > 2000) && MASTER(cr))
         {
             fprintf(stderr, "\nWARNING: This run will generate roughly %.0f Mb of data\n\n", io);
@@ -346,7 +346,7 @@ void gmx::LegacySimulator::do_rerun()
                             TRUE,
                             1,
                             state_global,
-                            *top_global,
+                            top_global,
                             *ir,
                             imdSession,
                             pull_work,
@@ -368,7 +368,7 @@ void gmx::LegacySimulator::do_rerun()
         /* Copy the pointer to the global state */
         state = state_global;
 
-        mdAlgorithmsSetupAtomData(cr, *ir, *top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
+        mdAlgorithmsSetupAtomData(cr, *ir, top_global, &top, fr, &f, mdAtoms, constr, vsite, shellfc);
     }
 
     auto mdatoms = mdAtoms->mdatoms();
@@ -418,7 +418,7 @@ void gmx::LegacySimulator::do_rerun()
     checkNumberOfBondedInteractions(mdlog,
                                     cr,
                                     totalNumberOfBondedInteractions,
-                                    *top_global,
+                                    top_global,
                                     &top,
                                     makeConstArrayRef(state->x),
                                     state->box,
@@ -429,7 +429,7 @@ void gmx::LegacySimulator::do_rerun()
         fprintf(stderr,
                 "starting md rerun '%s', reading coordinates from"
                 " input trajectory '%s'\n\n",
-                *(top_global->name),
+                *(top_global.name),
                 opt2fn("-rerun", nfile, fnm));
         if (mdrunOptions.verbose)
         {
@@ -462,13 +462,13 @@ void gmx::LegacySimulator::do_rerun()
     if (MASTER(cr))
     {
         isLastStep = !read_first_frame(oenv, &status, opt2fn("-rerun", nfile, fnm), &rerun_fr, TRX_NEED_X);
-        if (rerun_fr.natoms != top_global->natoms)
+        if (rerun_fr.natoms != top_global.natoms)
         {
             gmx_fatal(FARGS,
                       "Number of atoms in trajectory (%d) does not match the "
                       "run input file (%d)\n",
                       rerun_fr.natoms,
-                      top_global->natoms);
+                      top_global.natoms);
         }
 
         if (ir->pbcType != PbcType::No)
@@ -598,7 +598,7 @@ void gmx::LegacySimulator::do_rerun()
                                 bMasterState,
                                 nstglobalcomm,
                                 state_global,
-                                *top_global,
+                                top_global,
                                 *ir,
                                 imdSession,
                                 pull_work,
@@ -772,7 +772,7 @@ void gmx::LegacySimulator::do_rerun()
             checkNumberOfBondedInteractions(mdlog,
                                             cr,
                                             totalNumberOfBondedInteractions,
-                                            *top_global,
+                                            top_global,
                                             &top,
                                             makeConstArrayRef(state->x),
                                             state->box,