Merge branch release-2016
authorBerk Hess <hess@kth.se>
Sun, 4 Sep 2016 16:29:34 +0000 (18:29 +0200)
committerBerk Hess <hess@kth.se>
Sun, 4 Sep 2016 16:55:30 +0000 (18:55 +0200)
Change-Id: I11339f3f6ce583827af85fc8187c4f42ae5a8e52

1  2 
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/minimize.cpp
src/programs/mdrun/md.cpp

index 6dd0b2e808667eb4d5a4b8f135340c6b2591220e,6b5a102f83a2f9adc68960e8b672e1c253384ca1..9b9b983734d1370c94ebb51d7412cd301c09888f
@@@ -53,6 -53,7 +53,6 @@@
  #include "gromacs/domdec/domdec_struct.h"
  #include "gromacs/ewald/ewald.h"
  #include "gromacs/fileio/filetypes.h"
 -#include "gromacs/gmxlib/md_logging.h"
  #include "gromacs/gmxlib/network.h"
  #include "gromacs/gmxlib/nonbonded/nonbonded.h"
  #include "gromacs/gpu_utils/gpu_utils.h"
@@@ -92,7 -93,6 +92,7 @@@
  #include "gromacs/utility/exceptions.h"
  #include "gromacs/utility/fatalerror.h"
  #include "gromacs/utility/gmxassert.h"
 +#include "gromacs/utility/logger.h"
  #include "gromacs/utility/pleasecite.h"
  #include "gromacs/utility/smalloc.h"
  #include "gromacs/utility/stringutil.h"
@@@ -1574,9 -1574,10 +1574,9 @@@ gmx_bool can_use_allvsall(const t_input
  }
  
  
 -gmx_bool nbnxn_gpu_acceleration_supported(FILE             *fplog,
 -                                          const t_commrec  *cr,
 -                                          const t_inputrec *ir,
 -                                          gmx_bool          bRerunMD)
 +gmx_bool nbnxn_gpu_acceleration_supported(const gmx::MDLogger &mdlog,
 +                                          const t_inputrec    *ir,
 +                                          gmx_bool             bRerunMD)
  {
      if (bRerunMD && ir->opts.ngener > 1)
      {
           * (which runs much faster than a multiple-energy-groups
           * implementation would), and issue a note in the .log
           * file. Users can re-run if they want the information. */
 -        md_print_warn(cr, fplog, "Rerun with energy groups is not implemented for GPUs, falling back to the CPU\n");
 +        GMX_LOG(mdlog.warning).asParagraph().appendText("Rerun with energy groups is not implemented for GPUs, falling back to the CPU");
          return FALSE;
      }
  
      return TRUE;
  }
  
 -gmx_bool nbnxn_simd_supported(FILE             *fplog,
 -                              const t_commrec  *cr,
 -                              const t_inputrec *ir)
 +gmx_bool nbnxn_simd_supported(const gmx::MDLogger &mdlog,
 +                              const t_inputrec    *ir)
  {
      if (ir->vdwtype == evdwPME && ir->ljpme_combination_rule == eljpmeLB)
      {
          /* LJ PME with LB combination rule does 7 mesh operations.
           * This so slow that we don't compile SIMD non-bonded kernels
           * for that. */
 -        md_print_warn(cr, fplog, "LJ-PME with Lorentz-Berthelot is not supported with SIMD kernels, falling back to plain C kernels\n");
 +        GMX_LOG(mdlog.warning).asParagraph().appendText("LJ-PME with Lorentz-Berthelot is not supported with SIMD kernels, falling back to plain C kernels");
          return FALSE;
      }
  
@@@ -1734,7 -1736,7 +1734,7 @@@ const char *lookup_nbnxn_kernel_name(in
  };
  
  static void pick_nbnxn_kernel(FILE                *fp,
 -                              const t_commrec     *cr,
 +                              const gmx::MDLogger &mdlog,
                                gmx_bool             use_simd_kernels,
                                gmx_bool             bUseGPU,
                                gmx_bool             bEmulateGPU,
  
          if (bDoNonbonded)
          {
 -            md_print_warn(cr, fp, "Emulating a GPU run on the CPU (slow)");
 +            GMX_LOG(mdlog.warning).asParagraph().appendText("Emulating a GPU run on the CPU (slow)");
          }
      }
      else if (bUseGPU)
      if (*kernel_type == nbnxnkNotSet)
      {
          if (use_simd_kernels &&
 -            nbnxn_simd_supported(fp, cr, ir))
 +            nbnxn_simd_supported(mdlog, ir))
          {
              pick_nbnxn_kernel_cpu(ir, kernel_type, ewald_excl);
          }
          if (nbnxnk4x4_PlainC == *kernel_type ||
              nbnxnk8x8x8_PlainC == *kernel_type)
          {
 -            md_print_warn(cr, fp,
 -                          "WARNING: Using the slow %s kernels. This should\n"
 -                          "not happen during routine usage on supported platforms.\n\n",
 -                          lookup_nbnxn_kernel_name(*kernel_type));
 +            GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted(
 +                    "WARNING: Using the slow %s kernels. This should\n"
 +                    "not happen during routine usage on supported platforms.",
 +                    lookup_nbnxn_kernel_name(*kernel_type));
          }
      }
  }
  
 -static void pick_nbnxn_resources(FILE                *fp,
 +static void pick_nbnxn_resources(const gmx::MDLogger &mdlog,
                                   const t_commrec     *cr,
                                   const gmx_hw_info_t *hwinfo,
                                   gmx_bool             bDoNonbonded,
      {
          /* Each PP node will use the intra-node id-th device from the
           * list of detected/selected GPUs. */
 -        if (!init_gpu(fp, cr->rank_pp_intranode, gpu_err_str,
 +        if (!init_gpu(mdlog, cr->rank_pp_intranode, gpu_err_str,
                        &hwinfo->gpu_info, gpu_opt))
          {
              /* At this point the init should never fail as we made sure that
@@@ -2112,7 -2114,6 +2112,7 @@@ init_interaction_const(FIL
  }
  
  static void init_nb_verlet(FILE                *fp,
 +                           const gmx::MDLogger &mdlog,
                             nonbonded_verlet_t **nb_verlet,
                             gmx_bool             bFEP_NonBonded,
                             const t_inputrec    *ir,
  
      snew(nbv, 1);
  
 -    pick_nbnxn_resources(fp, cr, fr->hwinfo,
 +    pick_nbnxn_resources(mdlog, cr, fr->hwinfo,
                           fr->bNonbonded,
                           &nbv->bUseGPU,
                           &bEmulateGPU,
  
          if (i == 0) /* local */
          {
 -            pick_nbnxn_kernel(fp, cr, fr->use_simd_kernels,
 +            pick_nbnxn_kernel(fp, mdlog, fr->use_simd_kernels,
                                nbv->bUseGPU, bEmulateGPU, ir,
                                &nbv->grp[i].kernel_type,
                                &nbv->grp[i].ewald_excl,
              if (nbpu_opt != NULL && strcmp(nbpu_opt, "gpu_cpu") == 0)
              {
                  /* Use GPU for local, select a CPU kernel for non-local */
 -                pick_nbnxn_kernel(fp, cr, fr->use_simd_kernels,
 +                pick_nbnxn_kernel(fp, mdlog, fr->use_simd_kernels,
                                    FALSE, FALSE, ir,
                                    &nbv->grp[i].kernel_type,
                                    &nbv->grp[i].ewald_excl,
@@@ -2312,20 -2313,19 +2312,20 @@@ gmx_bool usingGpu(nonbonded_verlet_t *n
      return nbv != NULL && nbv->bUseGPU;
  }
  
 -void init_forcerec(FILE              *fp,
 -                   t_forcerec        *fr,
 -                   t_fcdata          *fcd,
 -                   const t_inputrec  *ir,
 -                   const gmx_mtop_t  *mtop,
 -                   const t_commrec   *cr,
 -                   matrix             box,
 -                   const char        *tabfn,
 -                   const char        *tabpfn,
 -                   const t_filenm    *tabbfnm,
 -                   const char        *nbpu_opt,
 -                   gmx_bool           bNoSolvOpt,
 -                   real               print_force)
 +void init_forcerec(FILE                *fp,
 +                   const gmx::MDLogger &mdlog,
 +                   t_forcerec          *fr,
 +                   t_fcdata            *fcd,
 +                   const t_inputrec    *ir,
 +                   const gmx_mtop_t    *mtop,
 +                   const t_commrec     *cr,
 +                   matrix               box,
 +                   const char          *tabfn,
 +                   const char          *tabpfn,
 +                   const t_filenm      *tabbfnm,
 +                   const char          *nbpu_opt,
 +                   gmx_bool             bNoSolvOpt,
 +                   real                 print_force)
  {
      int            i, m, negp_pp, negptable, egi, egj;
      real           rtab;
           * In mdrun, hwinfo has already been set before calling init_forcerec.
           * Here we ignore GPUs, as tools will not use them anyhow.
           */
 -        fr->hwinfo = gmx_detect_hardware(fp, cr, FALSE);
 +        fr->hwinfo = gmx_detect_hardware(mdlog, cr, FALSE);
      }
  
      /* By default we turn SIMD kernels on, but it might be turned off further down... */
      {
          /* turn off non-bonded calculations */
          fr->bNonbonded = FALSE;
 -        md_print_warn(cr, fp,
 -                      "Found environment variable GMX_NO_NONBONDED.\n"
 -                      "Disabling nonbonded calculations.\n");
 +        GMX_LOG(mdlog.warning).asParagraph().appendText(
 +                "Found environment variable GMX_NO_NONBONDED.\n"
 +                "Disabling nonbonded calculations.");
      }
  
      bGenericKernelOnly = FALSE;
                      fr->bMolPBC = FALSE;
                      if (fp)
                      {
 -                        md_print_warn(cr, fp, "GMX_USE_GRAPH is set, using the graph for bonded interactions\n");
 +                        GMX_LOG(mdlog.warning).asParagraph().appendText("GMX_USE_GRAPH is set, using the graph for bonded interactions");
                      }
  
                      if (mtop->bIntermolecularInteractions)
                      {
 -                        md_print_warn(cr, fp, "WARNING: Molecules linked by intermolecular interactions have to reside in the same periodic image, otherwise artifacts will occur!\n");
 +                        GMX_LOG(mdlog.warning).asParagraph().appendText("WARNING: Molecules linked by intermolecular interactions have to reside in the same periodic image, otherwise artifacts will occur!");
                      }
                  }
  
  
      fr->nthread_ewc = gmx_omp_nthreads_get(emntBonded);
      snew(fr->ewc_t, fr->nthread_ewc);
-     snew(fr->excl_load, fr->nthread_ewc + 1);
  
      /* fr->ic is used both by verlet and group kernels (to some extent) now */
      init_interaction_const(fp, &fr->ic, fr);
              GMX_RELEASE_ASSERT(ir->rcoulomb == ir->rvdw, "With Verlet lists and no PME rcoulomb and rvdw should be identical");
          }
  
 -        init_nb_verlet(fp, &fr->nbv, bFEP_NonBonded, ir, fr, cr, nbpu_opt);
 +        init_nb_verlet(fp, mdlog, &fr->nbv, bFEP_NonBonded, ir, fr, cr, nbpu_opt);
      }
  
      if (ir->eDispCorr != edispcNO)
@@@ -3238,48 -3237,6 +3237,6 @@@ void pr_forcerec(FILE *fp, t_forcerec *
      fflush(fp);
  }
  
- void forcerec_set_excl_load(t_forcerec           *fr,
-                             const gmx_localtop_t *top)
- {
-     const int *ind, *a;
-     int        t, i, j, ntot, n, ntarget;
-     ind = top->excls.index;
-     a   = top->excls.a;
-     ntot = 0;
-     for (i = 0; i < top->excls.nr; i++)
-     {
-         for (j = ind[i]; j < ind[i+1]; j++)
-         {
-             if (a[j] > i)
-             {
-                 ntot++;
-             }
-         }
-     }
-     fr->excl_load[0] = 0;
-     n                = 0;
-     i                = 0;
-     for (t = 1; t <= fr->nthread_ewc; t++)
-     {
-         ntarget = (ntot*t)/fr->nthread_ewc;
-         while (i < top->excls.nr && n < ntarget)
-         {
-             for (j = ind[i]; j < ind[i+1]; j++)
-             {
-                 if (a[j] > i)
-                 {
-                     n++;
-                 }
-             }
-             i++;
-         }
-         fr->excl_load[t] = i;
-     }
- }
  /* Frees GPU memory and destroys the GPU context.
   *
   * Note that this function needs to be called even if GPUs are not used
index f18b48bdee782462ea297a79ede9269e8c263a3d,591e20a7dc88cbfa338f971b35b97ed014b2a718..c111e357f77168fc2dac04fda7a491a0c070f2c5
@@@ -61,6 -61,7 +61,6 @@@
  #include "gromacs/ewald/pme.h"
  #include "gromacs/fileio/confio.h"
  #include "gromacs/fileio/mtxio.h"
 -#include "gromacs/gmxlib/md_logging.h"
  #include "gromacs/gmxlib/network.h"
  #include "gromacs/gmxlib/nrnb.h"
  #include "gromacs/imd/imd.h"
@@@ -94,7 -95,6 +94,7 @@@
  #include "gromacs/utility/cstringutil.h"
  #include "gromacs/utility/exceptions.h"
  #include "gromacs/utility/fatalerror.h"
 +#include "gromacs/utility/logger.h"
  #include "gromacs/utility/smalloc.h"
  
  //! Utility structure for manipulating states during EM
@@@ -401,8 -401,6 +401,6 @@@ void init_em(FILE *fplog, const char *t
  
          *top      = gmx_mtop_generate_local_top(top_global, ir->efep != efepNO);
  
-         forcerec_set_excl_load(fr, *top);
          setup_bonded_threading(fr, &(*top)->idef);
  
          if (ir->ePBC != epbcNONE && !fr->bMolPBC)
@@@ -1001,7 -999,7 +999,7 @@@ namespace gm
  {
  
  /*! \brief Do conjugate gradients minimization
 -    \copydoc integrator_t (FILE *fplog, t_commrec *cr,
 +    \copydoc integrator_t(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
                             int nfile, const t_filenm fnm[],
                             const gmx_output_env_t *oenv, gmx_bool bVerbose,
                             int nstglobalcomm,
                             unsigned long Flags,
                             gmx_walltime_accounting_t walltime_accounting)
   */
 -double do_cg(FILE *fplog, t_commrec *cr,
 +double do_cg(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog,
               int nfile, const t_filenm fnm[],
               const gmx_output_env_t gmx_unused *oenv, gmx_bool bVerbose,
               int gmx_unused nstglobalcomm,
  
  
  /*! \brief Do L-BFGS conjugate gradients minimization
 -    \copydoc integrator_t (FILE *fplog, t_commrec *cr,
 -                           int nfile, const t_filenm fnm[],
 -                           const gmx_output_env_t *oenv, gmx_bool bVerbose,
 -                           int nstglobalcomm,
 -                           gmx_vsite_t *vsite, gmx_constr_t constr,
 -                           int stepout,
 -                           t_inputrec *inputrec,
 -                           gmx_mtop_t *top_global, t_fcdata *fcd,
 -                           t_state *state_global,
 -                           t_mdatoms *mdatoms,
 -                           t_nrnb *nrnb, gmx_wallcycle_t wcycle,
 -                           gmx_edsam_t ed,
 -                           t_forcerec *fr,
 -                           int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
 -                           real cpt_period, real max_hours,
 -                           int imdport,
 -                           unsigned long Flags,
 -                           gmx_walltime_accounting_t walltime_accounting)
 +    \copydoc integrator_t(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
 +                          int nfile, const t_filenm fnm[],
 +                          const gmx_output_env_t *oenv, gmx_bool bVerbose,
 +                          int nstglobalcomm,
 +                          gmx_vsite_t *vsite, gmx_constr_t constr,
 +                          int stepout,
 +                          t_inputrec *inputrec,
 +                          gmx_mtop_t *top_global, t_fcdata *fcd,
 +                          t_state *state_global,
 +                          t_mdatoms *mdatoms,
 +                          t_nrnb *nrnb, gmx_wallcycle_t wcycle,
 +                          gmx_edsam_t ed,
 +                          t_forcerec *fr,
 +                          int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
 +                          real cpt_period, real max_hours,
 +                          int imdport,
 +                          unsigned long Flags,
 +                          gmx_walltime_accounting_t walltime_accounting)
   */
 -double do_lbfgs(FILE *fplog, t_commrec *cr,
 +double do_lbfgs(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog,
                  int nfile, const t_filenm fnm[],
                  const gmx_output_env_t gmx_unused *oenv, gmx_bool bVerbose,
                  int gmx_unused nstglobalcomm,
  }   /* That's all folks */
  
  /*! \brief Do steepest descents minimization
 -    \copydoc integrator_t (FILE *fplog, t_commrec *cr,
 -                           int nfile, const t_filenm fnm[],
 -                           const gmx_output_env_t *oenv, gmx_bool bVerbose,
 -                           int nstglobalcomm,
 -                           gmx_vsite_t *vsite, gmx_constr_t constr,
 -                           int stepout,
 -                           t_inputrec *inputrec,
 -                           gmx_mtop_t *top_global, t_fcdata *fcd,
 -                           t_state *state_global,
 -                           t_mdatoms *mdatoms,
 -                           t_nrnb *nrnb, gmx_wallcycle_t wcycle,
 -                           gmx_edsam_t ed,
 -                           t_forcerec *fr,
 -                           int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
 -                           real cpt_period, real max_hours,
 -                           int imdport,
 -                           unsigned long Flags,
 -                           gmx_walltime_accounting_t walltime_accounting)
 +    \copydoc integrator_t(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
 +                          int nfile, const t_filenm fnm[],
 +                          const gmx_output_env_t *oenv, gmx_bool bVerbose,
 +                          int nstglobalcomm,
 +                          gmx_vsite_t *vsite, gmx_constr_t constr,
 +                          int stepout,
 +                          t_inputrec *inputrec,
 +                          gmx_mtop_t *top_global, t_fcdata *fcd,
 +                          t_state *state_global,
 +                          t_mdatoms *mdatoms,
 +                          t_nrnb *nrnb, gmx_wallcycle_t wcycle,
 +                          gmx_edsam_t ed,
 +                          t_forcerec *fr,
 +                          int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
 +                          real cpt_period, real max_hours,
 +                          int imdport,
 +                          unsigned long Flags,
 +                          gmx_walltime_accounting_t walltime_accounting)
   */
 -double do_steep(FILE *fplog, t_commrec *cr,
 +double do_steep(FILE *fplog, t_commrec *cr, const gmx::MDLogger gmx_unused &mdlog,
                  int nfile, const t_filenm fnm[],
                  const gmx_output_env_t gmx_unused *oenv, gmx_bool bVerbose,
                  int gmx_unused nstglobalcomm,
  }   /* That's all folks */
  
  /*! \brief Do normal modes analysis
 -    \copydoc integrator_t (FILE *fplog, t_commrec *cr,
 -                           int nfile, const t_filenm fnm[],
 -                           const gmx_output_env_t *oenv, gmx_bool bVerbose,
 -                           int nstglobalcomm,
 -                           gmx_vsite_t *vsite, gmx_constr_t constr,
 -                           int stepout,
 -                           t_inputrec *inputrec,
 -                           gmx_mtop_t *top_global, t_fcdata *fcd,
 -                           t_state *state_global,
 -                           t_mdatoms *mdatoms,
 -                           t_nrnb *nrnb, gmx_wallcycle_t wcycle,
 -                           gmx_edsam_t ed,
 -                           t_forcerec *fr,
 -                           int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
 -                           real cpt_period, real max_hours,
 -                           int imdport,
 -                           unsigned long Flags,
 -                           gmx_walltime_accounting_t walltime_accounting)
 +    \copydoc integrator_t(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
 +                          int nfile, const t_filenm fnm[],
 +                          const gmx_output_env_t *oenv, gmx_bool bVerbose,
 +                          int nstglobalcomm,
 +                          gmx_vsite_t *vsite, gmx_constr_t constr,
 +                          int stepout,
 +                          t_inputrec *inputrec,
 +                          gmx_mtop_t *top_global, t_fcdata *fcd,
 +                          t_state *state_global,
 +                          t_mdatoms *mdatoms,
 +                          t_nrnb *nrnb, gmx_wallcycle_t wcycle,
 +                          gmx_edsam_t ed,
 +                          t_forcerec *fr,
 +                          int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
 +                          real cpt_period, real max_hours,
 +                          int imdport,
 +                          unsigned long Flags,
 +                          gmx_walltime_accounting_t walltime_accounting)
   */
 -double do_nm(FILE *fplog, t_commrec *cr,
 +double do_nm(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
               int nfile, const t_filenm fnm[],
               const gmx_output_env_t gmx_unused *oenv, gmx_bool bVerbose,
               int gmx_unused nstglobalcomm,
       */
      if (EEL_FULL(fr->eeltype) || fr->rlist == 0.0)
      {
 -        md_print_info(cr, fplog, "Non-cutoff electrostatics used, forcing full Hessian format.\n");
 +        GMX_LOG(mdlog.warning).appendText("Non-cutoff electrostatics used, forcing full Hessian format.");
          bSparse = FALSE;
      }
      else if (atom_index.size() < 1000)
      {
 -        md_print_info(cr, fplog, "Small system size (N=%d), using full Hessian format.\n", atom_index.size());
 +        GMX_LOG(mdlog.warning).appendTextFormatted("Small system size (N=%d), using full Hessian format.",
 +                                                   atom_index.size());
          bSparse = FALSE;
      }
      else
      {
 -        md_print_info(cr, fplog, "Using compressed symmetric sparse Hessian format.\n");
 +        GMX_LOG(mdlog.warning).appendText("Using compressed symmetric sparse Hessian format.");
          bSparse = TRUE;
      }
  
      /* if forces are not small, warn user */
      get_state_f_norm_max(cr, &(inputrec->opts), mdatoms, state_work);
  
 -    md_print_info(cr, fplog, "Maximum force:%12.5e\n", state_work->fmax);
 +    GMX_LOG(mdlog.warning).appendTextFormatted("Maximum force:%12.5e", state_work->fmax);
      if (state_work->fmax > 1.0e-3)
      {
 -        md_print_info(cr, fplog,
 -                      "The force is probably not small enough to "
 -                      "ensure that you are at a minimum.\n"
 -                      "Be aware that negative eigenvalues may occur\n"
 -                      "when the resulting matrix is diagonalized.\n\n");
 +        GMX_LOG(mdlog.warning).appendText(
 +                "The force is probably not small enough to "
 +                "ensure that you are at a minimum.\n"
 +                "Be aware that negative eigenvalues may occur\n"
 +                "when the resulting matrix is diagonalized.");
      }
  
      /***********************************************************
index 0d6a49b304f50933fe5d5fd936304176433e85cb,06c25f321404e012b870cfff79c5044308431b7e..27722563a45771d416464e64c1449596d5f75433
@@@ -55,6 -55,7 +55,6 @@@
  #include "gromacs/ewald/pme.h"
  #include "gromacs/ewald/pme-load-balancing.h"
  #include "gromacs/fileio/trxio.h"
 -#include "gromacs/gmxlib/md_logging.h"
  #include "gromacs/gmxlib/network.h"
  #include "gromacs/gmxlib/nrnb.h"
  #include "gromacs/gpu_utils/gpu_utils.h"
  #include "gromacs/utility/basedefinitions.h"
  #include "gromacs/utility/cstringutil.h"
  #include "gromacs/utility/fatalerror.h"
 +#include "gromacs/utility/logger.h"
  #include "gromacs/utility/real.h"
  #include "gromacs/utility/smalloc.h"
  
@@@ -153,7 -153,7 +153,7 @@@ static void checkNumberOfBondedInteract
      }
  }
  
 -static void reset_all_counters(FILE *fplog, t_commrec *cr,
 +static void reset_all_counters(FILE *fplog, const gmx::MDLogger &mdlog, t_commrec *cr,
                                 gmx_int64_t step,
                                 gmx_int64_t *step_rel, t_inputrec *ir,
                                 gmx_wallcycle_t wcycle, t_nrnb *nrnb,
      char sbuf[STEPSTRSIZE];
  
      /* Reset all the counters related to performance over the run */
 -    md_print_warn(cr, fplog, "step %s: resetting all time and cycle counters\n",
 -                  gmx_step_str(step, sbuf));
 +    GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted(
 +            "step %s: resetting all time and cycle counters",
 +            gmx_step_str(step, sbuf));
  
      if (use_GPU(nbv))
      {
  }
  
  /*! \libinternal
 -    \copydoc integrator_t (FILE *fplog, t_commrec *cr,
 +    \copydoc integrator_t (FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
                             int nfile, const t_filenm fnm[],
                             const gmx_output_env_t *oenv, gmx_bool bVerbose,
                             int nstglobalcomm,
                             unsigned long Flags,
                             gmx_walltime_accounting_t walltime_accounting)
   */
 -double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
 +double gmx::do_md(FILE *fplog, t_commrec *cr, const gmx::MDLogger &mdlog,
 +                  int nfile, const t_filenm fnm[],
                    const gmx_output_env_t *oenv, gmx_bool bVerbose,
                    int nstglobalcomm,
                    gmx_vsite_t *vsite, gmx_constr_t constr,
          nstglobalcomm     = 1;
      }
  
 -    nstglobalcomm   = check_nstglobalcomm(fplog, cr, nstglobalcomm, ir);
 +    nstglobalcomm   = check_nstglobalcomm(mdlog, nstglobalcomm, ir);
      bGStatEveryStep = (nstglobalcomm == 1);
  
      if (bRerunMD)
      {
          top = gmx_mtop_generate_local_top(top_global, ir->efep != efepNO);
  
-         forcerec_set_excl_load(fr, top);
          state    = serial_init_local_state(state_global);
  
          atoms2md(top_global, ir, 0, NULL, top_global->natoms, mdatoms);
                  !(Flags & MD_REPRODUCIBLE));
      if (bPMETune)
      {
 -        pme_loadbal_init(&pme_loadbal, cr, fplog, ir, state->box,
 +        pme_loadbal_init(&pme_loadbal, cr, mdlog, ir, state->box,
                           fr->ic, fr->pmedata, use_GPU(fr->nbv),
                           &bPMETunePrinting);
      }
      {
          if (!multisim_int_all_are_equal(cr->ms, ir->nsteps))
          {
 -            md_print_info(cr, fplog,
 -                          "Note: The number of steps is not consistent across multi simulations,\n"
 -                          "but we are proceeding anyway!\n");
 +            GMX_LOG(mdlog.warning).appendText(
 +                    "Note: The number of steps is not consistent across multi simulations,\n"
 +                    "but we are proceeding anyway!");
          }
          if (!multisim_int_all_are_equal(cr->ms, ir->init_step))
          {
 -            md_print_info(cr, fplog,
 -                          "Note: The initial step is not consistent across multi simulations,\n"
 -                          "but we are proceeding anyway!\n");
 +            GMX_LOG(mdlog.warning).appendText(
 +                    "Note: The initial step is not consistent across multi simulations,\n"
 +                    "but we are proceeding anyway!");
          }
      }
  
              /* PME grid + cut-off optimization with GPUs or PME nodes */
              pme_loadbal_do(pme_loadbal, cr,
                             (bVerbose && MASTER(cr)) ? stderr : NULL,
 -                           fplog,
 +                           fplog, mdlog,
                             ir, fr, state,
                             wcycle,
                             step, step_rel,
                            "resetting counters later in the run, e.g. with gmx "
                            "mdrun -resetstep.", step);
              }
 -            reset_all_counters(fplog, cr, step, &step_rel, ir, wcycle, nrnb, walltime_accounting,
 +            reset_all_counters(fplog, mdlog, cr, step, &step_rel, ir, wcycle, nrnb, walltime_accounting,
                                 use_GPU(fr->nbv) ? fr->nbv : NULL);
              wcycle_set_reset_counters(wcycle, -1);
              if (!(cr->duty & DUTY_PME))
  
      if (bPMETune)
      {
 -        pme_loadbal_done(pme_loadbal, cr, fplog, use_GPU(fr->nbv));
 +        pme_loadbal_done(pme_loadbal, fplog, mdlog, use_GPU(fr->nbv));
      }
  
      done_shellfc(fplog, shellfc, step_rel);