Merge branch release-2021 into merge-2021-into-master
[alexxy/gromacs.git] / src / gromacs / mdlib / trajectory_writing.cpp
index 09f1b6512da27fb796354a730669625a2a4a60ac..dd7e85afef3ddfd6b284912e37031a5ad9c3d582 100644 (file)
@@ -62,11 +62,11 @@ void do_md_trajectory_writing(FILE*                          fplog,
                               int64_t                        step,
                               int64_t                        step_rel,
                               double                         t,
-                              t_inputrec*                    ir,
+                              const t_inputrec*              ir,
                               t_state*                       state,
                               t_state*                       state_global,
                               ObservablesHistory*            observablesHistory,
-                              const gmx_mtop_t*              top_global,
+                              const gmx_mtop_t&              top_global,
                               t_forcerec*                    fr,
                               gmx_mdoutf_t                   outf,
                               const gmx::EnergyOutput&       energyOutput,
@@ -121,7 +121,7 @@ void do_md_trajectory_writing(FILE*                          fplog,
 
     if (mdof_flags != 0)
     {
-        wallcycle_start(mdoutf_get_wcycle(outf), ewcTRAJ);
+        wallcycle_start(mdoutf_get_wcycle(outf), WallCycleCounter::Traj);
         if (bCPT)
         {
             if (MASTER(cr))
@@ -146,8 +146,8 @@ void do_md_trajectory_writing(FILE*                          fplog,
         // Note that part of the following code is duplicated in StatePropagatorData::trajectoryWriterTeardown.
         // This duplication is needed while both legacy and modular code paths are in use.
         // TODO: Remove duplication asap, make sure to keep in sync in the meantime.
-        mdoutf_write_to_trajectory_files(fplog, cr, outf, mdof_flags, top_global->natoms, step, t, state,
-                                         state_global, observablesHistory, f, &checkpointDataHolder);
+        mdoutf_write_to_trajectory_files(
+                fplog, cr, outf, mdof_flags, top_global.natoms, step, t, state, state_global, observablesHistory, f, &checkpointDataHolder);
         if (bLastStep && step_rel == ir->nsteps && bDoConfOut && MASTER(cr) && !bRerunMD)
         {
             if (fr->bMolPBC && state == state_global)
@@ -177,16 +177,21 @@ void do_md_trajectory_writing(FILE*                          fplog,
             if (fr->bMolPBC && !ir->bPeriodicMols)
             {
                 /* Make molecules whole only for confout writing */
-                do_pbc_mtop(ir->pbcType, state->box, top_global, x_for_confout);
+                do_pbc_mtop(ir->pbcType, state->box, &top_global, x_for_confout);
             }
-            write_sto_conf_mtop(ftp2fn(efSTO, nfile, fnm), *top_global->name, top_global,
-                                x_for_confout, state_global->v.rvec_array(), ir->pbcType, state->box);
+            write_sto_conf_mtop(ftp2fn(efSTO, nfile, fnm),
+                                *top_global.name,
+                                top_global,
+                                x_for_confout,
+                                state_global->v.rvec_array(),
+                                ir->pbcType,
+                                state->box);
             if (fr->bMolPBC && state == state_global)
             {
                 sfree(x_for_confout);
             }
         }
-        wallcycle_stop(mdoutf_get_wcycle(outf), ewcTRAJ);
+        wallcycle_stop(mdoutf_get_wcycle(outf), WallCycleCounter::Traj);
     }
 #if GMX_FAHCORE
     if (MASTER(cr))