Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / mdlib / energyoutput.cpp
index 5253f3b010e2e1aad4d4334cc2db3874f2719f9c..bb71c96b0f02c6763f6f60139571fa47e85421a2 100644 (file)
 
 //! Labels for energy file quantities
 //! \{
-static const char                 *conrmsd_nm[] = { "Constr. rmsd", "Constr.2 rmsd" };
+static const charconrmsd_nm[] = { "Constr. rmsd", "Constr.2 rmsd" };
 
-static std::array<const char *, 3> boxs_nm = { "Box-X", "Box-Y", "Box-Z" };
+static std::array<const char*, 3> boxs_nm = { "Box-X", "Box-Y", "Box-Z" };
 
-static std::array<const char *, 6> tricl_boxs_nm = {
-    "Box-XX", "Box-YY", "Box-ZZ",
-    "Box-YX", "Box-ZX", "Box-ZY"
-};
+static std::array<const char*, 6> tricl_boxs_nm = { "Box-XX", "Box-YY", "Box-ZZ",
+                                                    "Box-YX", "Box-ZX", "Box-ZY" };
 
-static const char                 *vol_nm[] = { "Volume" };
+static const charvol_nm[] = { "Volume" };
 
-static const char                 *dens_nm[] = {"Density" };
+static const char* dens_nm[] = { "Density" };
 
-static const char                 *pv_nm[] = {"pV" };
+static const char* pv_nm[] = { "pV" };
 
-static const char                 *enthalpy_nm[] = {"Enthalpy" };
+static const char* enthalpy_nm[] = { "Enthalpy" };
 
-static std::array<const char *, 6> boxvel_nm = {
-    "Box-Vel-XX", "Box-Vel-YY", "Box-Vel-ZZ",
-    "Box-Vel-YX", "Box-Vel-ZX", "Box-Vel-ZY"
-};
+static std::array<const char*, 6> boxvel_nm = { "Box-Vel-XX", "Box-Vel-YY", "Box-Vel-ZZ",
+                                                "Box-Vel-YX", "Box-Vel-ZX", "Box-Vel-ZY" };
 
-const char *egrp_nm[egNR+1] = {
-    "Coul-SR", "LJ-SR", "Buck-SR",
-    "Coul-14", "LJ-14", nullptr
-};
+const char* egrp_nm[egNR + 1] = { "Coul-SR", "LJ-SR", "Buck-SR", "Coul-14", "LJ-14", nullptr };
 //! \}
 
 namespace gmx
@@ -125,57 +118,37 @@ namespace gmx
  * \todo Remove GMX_CONSTRAINTVIR
  * \todo Write free-energy output also to energy file (after adding more tests)
  */
-EnergyOutput::EnergyOutput(ener_file *              fp_ene,
-                           const gmx_mtop_t *       mtop,
-                           const t_inputrec *       ir,
-                           const pull_t *           pull_work,
-                           FILE *                   fp_dhdl,
+EnergyOutput::EnergyOutput(ener_file              fp_ene,
+                           const gmx_mtop_t       mtop,
+                           const t_inputrec       ir,
+                           const pull_t           pull_work,
+                           FILE                   fp_dhdl,
                            bool                     isRerun,
-                           const MdModulesNotifier &mdModulesNotifier)
+                           const MdModulesNotifiermdModulesNotifier)
 {
-    const char                *ener_nm[F_NRE];
-    static const char         *vir_nm[] = {
-        "Vir-XX", "Vir-XY", "Vir-XZ",
-        "Vir-YX", "Vir-YY", "Vir-YZ",
-        "Vir-ZX", "Vir-ZY", "Vir-ZZ"
-    };
-    static const char         *sv_nm[] = {
-        "ShakeVir-XX", "ShakeVir-XY", "ShakeVir-XZ",
-        "ShakeVir-YX", "ShakeVir-YY", "ShakeVir-YZ",
-        "ShakeVir-ZX", "ShakeVir-ZY", "ShakeVir-ZZ"
-    };
-    static const char         *fv_nm[] = {
-        "ForceVir-XX", "ForceVir-XY", "ForceVir-XZ",
-        "ForceVir-YX", "ForceVir-YY", "ForceVir-YZ",
-        "ForceVir-ZX", "ForceVir-ZY", "ForceVir-ZZ"
-    };
-    static const char         *pres_nm[] = {
-        "Pres-XX", "Pres-XY", "Pres-XZ",
-        "Pres-YX", "Pres-YY", "Pres-YZ",
-        "Pres-ZX", "Pres-ZY", "Pres-ZZ"
-    };
-    static const char         *surft_nm[] = {
-        "#Surf*SurfTen"
-    };
-    static const char         *mu_nm[] = {
-        "Mu-X", "Mu-Y", "Mu-Z"
-    };
-    static const char         *vcos_nm[] = {
-        "2CosZ*Vel-X"
-    };
-    static const char         *visc_nm[] = {
-        "1/Viscosity"
-    };
-    static const char         *baro_nm[] = {
-        "Barostat"
-    };
-
-    const SimulationGroups    *groups;
-    char                     **gnm;
-    char                       buf[256];
-    const char                *bufi;
-    int                        i, j, ni, nj, n, k, kk, ncon, nset;
-    bool                       bBHAM, b14;
+    const char*        ener_nm[F_NRE];
+    static const char* vir_nm[]   = { "Vir-XX", "Vir-XY", "Vir-XZ", "Vir-YX", "Vir-YY",
+                                    "Vir-YZ", "Vir-ZX", "Vir-ZY", "Vir-ZZ" };
+    static const char* sv_nm[]    = { "ShakeVir-XX", "ShakeVir-XY", "ShakeVir-XZ",
+                                   "ShakeVir-YX", "ShakeVir-YY", "ShakeVir-YZ",
+                                   "ShakeVir-ZX", "ShakeVir-ZY", "ShakeVir-ZZ" };
+    static const char* fv_nm[]    = { "ForceVir-XX", "ForceVir-XY", "ForceVir-XZ",
+                                   "ForceVir-YX", "ForceVir-YY", "ForceVir-YZ",
+                                   "ForceVir-ZX", "ForceVir-ZY", "ForceVir-ZZ" };
+    static const char* pres_nm[]  = { "Pres-XX", "Pres-XY", "Pres-XZ", "Pres-YX", "Pres-YY",
+                                     "Pres-YZ", "Pres-ZX", "Pres-ZY", "Pres-ZZ" };
+    static const char* surft_nm[] = { "#Surf*SurfTen" };
+    static const char* mu_nm[]    = { "Mu-X", "Mu-Y", "Mu-Z" };
+    static const char* vcos_nm[]  = { "2CosZ*Vel-X" };
+    static const char* visc_nm[]  = { "1/Viscosity" };
+    static const char* baro_nm[]  = { "Barostat" };
+
+    const SimulationGroups* groups;
+    char**                  gnm;
+    char                    buf[256];
+    const char*             bufi;
+    int                     i, j, ni, nj, n, k, kk, ncon, nset;
+    bool                    bBHAM, b14;
 
     if (EI_DYNAMICS(ir->eI))
     {
@@ -189,14 +162,13 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     groups = &mtop->groups;
 
     bBHAM = (mtop->ffparams.numTypes() > 0) && (mtop->ffparams.functype[0] == F_BHAM);
-    b14   = (gmx_mtop_ftype_count(mtop, F_LJ14) > 0 ||
-             gmx_mtop_ftype_count(mtop, F_LJC14_Q) > 0);
-
-    ncon           = gmx_mtop_ftype_count(mtop, F_CONSTR);
-    nset           = gmx_mtop_ftype_count(mtop, F_SETTLE);
-    bool bConstr   = (ncon > 0 || nset > 0) && !isRerun;
-    bConstrVir_ = false;
-    nCrmsd_     = 0;
+    b14   = (gmx_mtop_ftype_count(mtop, F_LJ14) > 0 || gmx_mtop_ftype_count(mtop, F_LJC14_Q) > 0);
+
+    ncon         = gmx_mtop_ftype_count(mtop, F_CONSTR);
+    nset         = gmx_mtop_ftype_count(mtop, F_SETTLE);
+    bool bConstr = (ncon > 0 || nset > 0) && !isRerun;
+    bConstrVir_  = false;
+    nCrmsd_      = 0;
     if (bConstr)
     {
         if (ncon > 0 && ir->eConstrAlg == econtLINCS)
@@ -220,31 +192,31 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     // are not vsite terms (not VSITE2, VSITE3, VSITE3FD, VSITE3FAD, VSITE3OUT, VSITE4FD, VSITE4FDN, or VSITEN)
     for (i = 0; i < F_NRE; i++)
     {
-        bEner_[i] = (gmx_mtop_ftype_count(mtop, i) > 0) &&
-            ((interaction_function[i].flags & IF_VSITE) == 0);
+        bEner_[i] = (gmx_mtop_ftype_count(mtop, i) > 0)
+                    && ((interaction_function[i].flags & IF_VSITE) == 0);
     }
 
     if (!isRerun)
     {
-        bEner_[F_EKIN]           = EI_DYNAMICS(ir->eI);
-        bEner_[F_ETOT]           = EI_DYNAMICS(ir->eI);
-        bEner_[F_TEMP]           = EI_DYNAMICS(ir->eI);
+        bEner_[F_EKIN] = EI_DYNAMICS(ir->eI);
+        bEner_[F_ETOT] = EI_DYNAMICS(ir->eI);
+        bEner_[F_TEMP] = EI_DYNAMICS(ir->eI);
 
-        bEner_[F_ECONSERVED]     = integratorHasConservedEnergyQuantity(ir);
-        bEner_[F_PDISPCORR]      = (ir->eDispCorr != edispcNO);
-        bEner_[F_PRES]           = true;
+        bEner_[F_ECONSERVED] = integratorHasConservedEnergyQuantity(ir);
+        bEner_[F_PDISPCORR]  = (ir->eDispCorr != edispcNO);
+        bEner_[F_PRES]       = true;
     }
 
-    bEner_[F_LJ]             = !bBHAM;
-    bEner_[F_BHAM]           = bBHAM;
-    bEner_[F_EQM]            = ir->bQMMM;
-    bEner_[F_RF_EXCL]        = (EEL_RF(ir->coulombtype) && ir->cutoff_scheme == ecutsGROUP);
-    bEner_[F_COUL_RECIP]     = EEL_FULL(ir->coulombtype);
-    bEner_[F_LJ_RECIP]       = EVDW_PME(ir->vdwtype);
-    bEner_[F_LJ14]           = b14;
-    bEner_[F_COUL14]         = b14;
-    bEner_[F_LJC14_Q]        = false;
-    bEner_[F_LJC_PAIRS_NB]   = false;
+    bEner_[F_LJ]           = !bBHAM;
+    bEner_[F_BHAM]         = bBHAM;
+    bEner_[F_EQM]          = ir->bQMMM;
+    bEner_[F_RF_EXCL]      = (EEL_RF(ir->coulombtype) && ir->cutoff_scheme == ecutsGROUP);
+    bEner_[F_COUL_RECIP]   = EEL_FULL(ir->coulombtype);
+    bEner_[F_LJ_RECIP]     = EVDW_PME(ir->vdwtype);
+    bEner_[F_LJ14]         = b14;
+    bEner_[F_COUL14]       = b14;
+    bEner_[F_LJC14_Q]      = false;
+    bEner_[F_LJC_PAIRS_NB] = false;
 
 
     bEner_[F_DVDL_COUL]      = (ir->efep != efepNO) && ir->fepvals->separate_dvdl[efptCOUL];
@@ -254,17 +226,17 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     bEner_[F_DKDL]           = (ir->efep != efepNO) && ir->fepvals->separate_dvdl[efptMASS];
     bEner_[F_DVDL]           = (ir->efep != efepNO) && ir->fepvals->separate_dvdl[efptFEP];
 
-    bEner_[F_CONSTR]         = false;
-    bEner_[F_CONSTRNC]       = false;
-    bEner_[F_SETTLE]         = false;
+    bEner_[F_CONSTR]   = false;
+    bEner_[F_CONSTRNC] = false;
+    bEner_[F_SETTLE]   = false;
 
-    bEner_[F_COUL_SR]        = true;
-    bEner_[F_EPOT]           = true;
+    bEner_[F_COUL_SR] = true;
+    bEner_[F_EPOT]    = true;
 
-    bEner_[F_DISPCORR]       = (ir->eDispCorr != edispcNO);
-    bEner_[F_DISRESVIOL]     = (gmx_mtop_ftype_count(mtop, F_DISRES) > 0);
-    bEner_[F_ORIRESDEV]      = (gmx_mtop_ftype_count(mtop, F_ORIRES) > 0);
-    bEner_[F_COM_PULL]       = ((ir->bPull && pull_have_potential(pull_work)) || ir->bRot);
+    bEner_[F_DISPCORR]   = (ir->eDispCorr != edispcNO);
+    bEner_[F_DISRESVIOL] = (gmx_mtop_ftype_count(mtop, F_DISRES) > 0);
+    bEner_[F_ORIRESDEV]  = (gmx_mtop_ftype_count(mtop, F_ORIRES) > 0);
+    bEner_[F_COM_PULL]   = ((ir->bPull && pull_have_potential(pull_work)) || ir->bRot);
 
     MdModulesEnergyOutputToDensityFittingRequestChecker mdModulesAddOutputToDensityFittingFieldRequest;
     mdModulesNotifier.notifier_.notify(&mdModulesAddOutputToDensityFittingFieldRequest);
@@ -285,7 +257,7 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
 
     epc_            = isRerun ? epcNO : ir->epc;
     bDiagPres_      = !TRICLINIC(ir->ref_p) && !isRerun;
-    ref_p_          = (ir->ref_p[XX][XX]+ir->ref_p[YY][YY]+ir->ref_p[ZZ][ZZ])/DIM;
+    ref_p_          = (ir->ref_p[XX][XX] + ir->ref_p[YY][YY] + ir->ref_p[ZZ][ZZ]) / DIM;
     bTricl_         = TRICLINIC(ir->compress) || TRICLINIC(ir->deform);
     bDynBox_        = inputrecDynamicBox(ir);
     etc_            = isRerun ? etcNO : ir->etc;
@@ -295,11 +267,11 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     bMu_            = inputrecNeedMutot(ir);
     bPres_          = !isRerun;
 
-    ebin_  = mk_ebin();
+    ebin_ = mk_ebin();
     /* Pass NULL for unit to let get_ebin_space determine the units
      * for interaction_function[i].longname
      */
-    ie_    = get_ebin_space(ebin_, f_nre_, ener_nm, nullptr);
+    ie_ = get_ebin_space(ebin_, f_nre_, ener_nm, nullptr);
     if (nCrmsd_)
     {
         /* This should be called directly after the call for ie_,
@@ -309,16 +281,14 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     }
     if (bDynBox_)
     {
-        ib_    = get_ebin_space(ebin_,
-                                bTricl_ ? tricl_boxs_nm.size() : boxs_nm.size(),
-                                bTricl_ ? tricl_boxs_nm.data() : boxs_nm.data(),
-                                unit_length);
-        ivol_  = get_ebin_space(ebin_, 1, vol_nm,  unit_volume);
+        ib_    = get_ebin_space(ebin_, bTricl_ ? tricl_boxs_nm.size() : boxs_nm.size(),
+                             bTricl_ ? tricl_boxs_nm.data() : boxs_nm.data(), unit_length);
+        ivol_  = get_ebin_space(ebin_, 1, vol_nm, unit_volume);
         idens_ = get_ebin_space(ebin_, 1, dens_nm, unit_density_SI);
         if (bDiagPres_)
         {
-            ipv_       = get_ebin_space(ebin_, 1, pv_nm,   unit_energy);
-            ienthalpy_ = get_ebin_space(ebin_, 1, enthalpy_nm,   unit_energy);
+            ipv_       = get_ebin_space(ebin_, 1, pv_nm, unit_energy);
+            ienthalpy_ = get_ebin_space(ebin_, 1, enthalpy_nm, unit_energy);
         }
     }
     if (bConstrVir_)
@@ -330,23 +300,20 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     {
         ivir_   = get_ebin_space(ebin_, asize(vir_nm), vir_nm, unit_energy);
         ipres_  = get_ebin_space(ebin_, asize(pres_nm), pres_nm, unit_pres_bar);
-        isurft_ = get_ebin_space(ebin_, asize(surft_nm), surft_nm,
-                                 unit_surft_bar);
+        isurft_ = get_ebin_space(ebin_, asize(surft_nm), surft_nm, unit_surft_bar);
     }
     if (epc_ == epcPARRINELLORAHMAN || epc_ == epcMTTK)
     {
-        ipc_ = get_ebin_space(ebin_, bTricl_ ? boxvel_nm.size() : DIM,
-                              boxvel_nm.data(), unit_vel);
+        ipc_ = get_ebin_space(ebin_, bTricl_ ? boxvel_nm.size() : DIM, boxvel_nm.data(), unit_vel);
     }
     if (bMu_)
     {
-        imu_    = get_ebin_space(ebin_, asize(mu_nm), mu_nm, unit_dipole_D);
+        imu_ = get_ebin_space(ebin_, asize(mu_nm), mu_nm, unit_dipole_D);
     }
     if (ir->cos_accel != 0)
     {
         ivcos_ = get_ebin_space(ebin_, asize(vcos_nm), vcos_nm, unit_vel);
-        ivisc_ = get_ebin_space(ebin_, asize(visc_nm), visc_nm,
-                                unit_invvisc_SI);
+        ivisc_ = get_ebin_space(ebin_, asize(visc_nm), visc_nm, unit_invvisc_SI);
     }
 
     /* Energy monitoring */
@@ -355,7 +322,7 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
         bEInd_[i] = false;
     }
     bEInd_[egCOULSR] = true;
-    bEInd_[egLJSR  ] = true;
+    bEInd_[egLJSR]   = true;
 
     if (bBHAM)
     {
@@ -375,9 +342,9 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
             nEc_++;
         }
     }
-    n         = groups->groups[SimulationAtomGroupType::EnergyOutput].size();
-    nEg_      = n;
-    nE_       = (n*(n+1))/2;
+    n    = groups->groups[SimulationAtomGroupType::EnergyOutput].size();
+    nEg_ = n;
+    nE_  = (n * (n + 1)) / 2;
 
     snew(igrp_, nE_);
     if (nE_ > 1)
@@ -398,13 +365,12 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
                 {
                     if (bEInd_[k])
                     {
-                        sprintf(gnm[kk], "%s:%s-%s", egrp_nm[k],
-                                *(groups->groupNames[ni]), *(groups->groupNames[nj]));
+                        sprintf(gnm[kk], "%s:%s-%s", egrp_nm[k], *(groups->groupNames[ni]),
+                                *(groups->groupNames[nj]));
                         kk++;
                     }
                 }
-                igrp_[n] = get_ebin_space(ebin_, nEc_,
-                                          gnm, unit_energy);
+                igrp_[n] = get_ebin_space(ebin_, nEc_, gnm, unit_energy);
                 n++;
             }
         }
@@ -424,8 +390,8 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     nNHC_ = ir->opts.nhchainlength; /* shorthand for number of NH chains */
     if (bMTTK_)
     {
-        nTCP_ = 1;  /* assume only one possible coupling system for barostat
-                            for now */
+        nTCP_ = 1; /* assume only one possible coupling system for barostat
+                           for now */
     }
     else
     {
@@ -435,15 +401,15 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     {
         if (bNHC_trotter_)
         {
-            mde_n_ = 2*nNHC_*nTC_;
+            mde_n_ = 2 * nNHC_ * nTC_;
         }
         else
         {
-            mde_n_ = 2*nTC_;
+            mde_n_ = 2 * nTC_;
         }
         if (epc_ == epcMTTK)
         {
-            mdeb_n_ = 2*nNHC_*nTCP_;
+            mdeb_n_ = 2 * nNHC_ * nTCP_;
         }
     }
     else
@@ -454,7 +420,7 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
 
     snew(tmp_r_, mde_n_);
     // TODO redo the group name memory management to make it more clear
-    char **grpnms;
+    char** grpnms;
     snew(grpnms, std::max(mde_n_, mdeb_n_)); // Just in case mdeb_n_ > mde_n_
 
     for (i = 0; (i < nTC_); i++)
@@ -463,8 +429,7 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
         sprintf(buf, "T-%s", *(groups->groupNames[ni]));
         grpnms[i] = gmx_strdup(buf);
     }
-    itemp_ = get_ebin_space(ebin_, nTC_, grpnms,
-                            unit_temp_K);
+    itemp_ = get_ebin_space(ebin_, nTC_, grpnms, unit_temp_K);
     for (i = 0; i < nTC_; i++)
     {
         sfree(grpnms[i]);
@@ -484,29 +449,27 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
                     for (j = 0; (j < nNHC_); j++)
                     {
                         sprintf(buf, "Xi-%d-%s", j, bufi);
-                        grpnms[2*(i*nNHC_+j)] = gmx_strdup(buf);
+                        grpnms[2 * (i * nNHC_ + j)] = gmx_strdup(buf);
                         sprintf(buf, "vXi-%d-%s", j, bufi);
-                        grpnms[2*(i*nNHC_+j)+1] = gmx_strdup(buf);
+                        grpnms[2 * (i * nNHC_ + j) + 1] = gmx_strdup(buf);
                     }
                 }
-                itc_ = get_ebin_space(ebin_, mde_n_,
-                                      grpnms, unit_invtime);
+                itc_      = get_ebin_space(ebin_, mde_n_, grpnms, unit_invtime);
                 allocated = mde_n_;
                 if (bMTTK_)
                 {
                     for (i = 0; (i < nTCP_); i++)
                     {
-                        bufi = baro_nm[0];  /* All barostat DOF's together for now. */
+                        bufi = baro_nm[0]; /* All barostat DOF's together for now. */
                         for (j = 0; (j < nNHC_); j++)
                         {
                             sprintf(buf, "Xi-%d-%s", j, bufi);
-                            grpnms[2*(i*nNHC_+j)] = gmx_strdup(buf);
+                            grpnms[2 * (i * nNHC_ + j)] = gmx_strdup(buf);
                             sprintf(buf, "vXi-%d-%s", j, bufi);
-                            grpnms[2*(i*nNHC_+j)+1] = gmx_strdup(buf);
+                            grpnms[2 * (i * nNHC_ + j) + 1] = gmx_strdup(buf);
                         }
                     }
-                    itcb_ = get_ebin_space(ebin_, mdeb_n_,
-                                           grpnms, unit_invtime);
+                    itcb_     = get_ebin_space(ebin_, mdeb_n_, grpnms, unit_invtime);
                     allocated = mdeb_n_;
                 }
             }
@@ -517,18 +480,16 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
                     ni   = groups->groups[SimulationAtomGroupType::TemperatureCoupling][i];
                     bufi = *(groups->groupNames[ni]);
                     sprintf(buf, "Xi-%s", bufi);
-                    grpnms[2*i] = gmx_strdup(buf);
+                    grpnms[2 * i] = gmx_strdup(buf);
                     sprintf(buf, "vXi-%s", bufi);
-                    grpnms[2*i+1] = gmx_strdup(buf);
+                    grpnms[2 * i + 1] = gmx_strdup(buf);
                 }
-                itc_ = get_ebin_space(ebin_, mde_n_,
-                                      grpnms, unit_invtime);
+                itc_      = get_ebin_space(ebin_, mde_n_, grpnms, unit_invtime);
                 allocated = mde_n_;
             }
         }
     }
-    else if (etc_ == etcBERENDSEN || etc_ == etcYES ||
-             etc_ == etcVRESCALE)
+    else if (etc_ == etcBERENDSEN || etc_ == etcYES || etc_ == etcVRESCALE)
     {
         for (i = 0; (i < nTC_); i++)
         {
@@ -536,8 +497,8 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
             sprintf(buf, "Lamb-%s", *(groups->groupNames[ni]));
             grpnms[i] = gmx_strdup(buf);
         }
-        itc_        = get_ebin_space(ebin_, mde_n_, grpnms, "");
-        allocated   = mde_n_;
+        itc_      = get_ebin_space(ebin_, mde_n_, grpnms, "");
+        allocated = mde_n_;
     }
 
     for (i = 0; i < allocated; i++)
@@ -550,19 +511,19 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     snew(tmp_v_, nU_);
     if (nU_ > 1)
     {
-        snew(grpnms, 3*nU_);
+        snew(grpnms, 3 * nU_);
         for (i = 0; (i < nU_); i++)
         {
             ni = groups->groups[SimulationAtomGroupType::Acceleration][i];
             sprintf(buf, "Ux-%s", *(groups->groupNames[ni]));
-            grpnms[3*i+XX] = gmx_strdup(buf);
+            grpnms[3 * i + XX] = gmx_strdup(buf);
             sprintf(buf, "Uy-%s", *(groups->groupNames[ni]));
-            grpnms[3*i+YY] = gmx_strdup(buf);
+            grpnms[3 * i + YY] = gmx_strdup(buf);
             sprintf(buf, "Uz-%s", *(groups->groupNames[ni]));
-            grpnms[3*i+ZZ] = gmx_strdup(buf);
+            grpnms[3 * i + ZZ] = gmx_strdup(buf);
         }
-        iu_ = get_ebin_space(ebin_, 3*nU_, grpnms, unit_vel);
-        for (i = 0; i < 3*nU_; i++)
+        iu_ = get_ebin_space(ebin_, 3 * nU_, grpnms, unit_vel);
+        for (i = 0; i < 3 * nU_; i++)
         {
             sfree(grpnms[i]);
         }
@@ -607,7 +568,6 @@ EnergyOutput::EnergyOutput(ener_file *              fp_ene,
     {
         numTemperatures_ = 0;
     }
-
 }
 
 EnergyOutput::~EnergyOutput()
@@ -634,12 +594,10 @@ EnergyOutput::~EnergyOutput()
  * \param[in] get_names          Whether to print the names rather than the values
  * \param[in,out] str            The pre-allocated string buffer to print to.
  */
-static void print_lambda_vector(t_lambda *fep, int i,
-                                bool get_native_lambda, bool get_names,
-                                char *str)
+static void print_lambda_vector(t_lambda* fep, int i, bool get_native_lambda, bool get_names, char* str)
 {
-    int    j, k = 0;
-    int    Nsep = 0;
+    int j, k = 0;
+    int Nsep = 0;
 
     for (j = 0; j < efptNR; j++)
     {
@@ -673,7 +631,7 @@ static void print_lambda_vector(t_lambda *fep, int i,
                 str += sprintf(str, "%s", efpt_singular_names[j]);
             }
             /* print comma for the next item */
-            if (k < Nsep-1)
+            if (k < Nsep - 1)
             {
                 str += sprintf(str, ", ");
             }
@@ -687,22 +645,21 @@ static void print_lambda_vector(t_lambda *fep, int i,
     }
 }
 
-FILE *open_dhdl(const char *filename, const t_inputrec *ir,
-                const gmx_output_env_t *oenv)
+FILE* open_dhdl(const char* filename, const t_inputrec* ir, const gmx_output_env_t* oenv)
 {
-    FILE       *fp;
+    FILE*       fp;
     const char *dhdl = "dH/d\\lambda", *deltag = "\\DeltaH", *lambda = "\\lambda",
-    *lambdastate     = "\\lambda state";
+               *lambdastate = "\\lambda state";
     int         i, nsets, nsets_de, nsetsbegin;
     int         n_lambda_terms = 0;
-    t_lambda   *fep            = ir->fepvals; /* for simplicity */
-    t_expanded *expand         = ir->expandedvals;
+    t_lambda*   fep            = ir->fepvals; /* for simplicity */
+    t_expandedexpand         = ir->expandedvals;
     char        lambda_vec_str[STRLEN], lambda_name_str[STRLEN];
 
-    int         nsets_dhdl = 0;
-    int         s          = 0;
-    int         nsetsextend;
-    bool        write_pV = false;
+    int  nsets_dhdl = 0;
+    int  s          = 0;
+    int  nsetsextend;
+    bool write_pV = false;
 
     /* count the number of different lambda terms */
     for (i = 0; i < efptNR; i++)
@@ -718,15 +675,14 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
     {
         title   = gmx::formatString("%s", dhdl);
         label_x = gmx::formatString("Time (ps)");
-        label_y = gmx::formatString("%s (%s %s)",
-                                    dhdl, unit_energy, "[\\lambda]\\S-1\\N");
+        label_y = gmx::formatString("%s (%s %s)", dhdl, unit_energy, "[\\lambda]\\S-1\\N");
     }
     else
     {
         title   = gmx::formatString("%s and %s", dhdl, deltag);
         label_x = gmx::formatString("Time (ps)");
-        label_y = gmx::formatString("%s and %s (%s %s)",
-                                    dhdl, deltag, unit_energy, "[\\8l\\4]\\S-1\\N");
+        label_y = gmx::formatString("%s and %s (%s %s)", dhdl, deltag, unit_energy,
+                                    "[\\8l\\4]\\S-1\\N");
     }
     fp = gmx_fio_fopen(filename, "w+");
     xvgr_header(fp, title.c_str(), label_x, label_y, exvggtXNY, oenv);
@@ -738,19 +694,16 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
     }
     if ((ir->efep != efepSLOWGROWTH) && (ir->efep != efepEXPANDED))
     {
-        if ( (fep->init_lambda >= 0)  && (n_lambda_terms == 1 ))
+        if ((fep->init_lambda >= 0) && (n_lambda_terms == 1))
         {
             /* compatibility output */
             buf += gmx::formatString("%s = %.4f", lambda, fep->init_lambda);
         }
         else
         {
-            print_lambda_vector(fep, fep->init_fep_state, true, false,
-                                lambda_vec_str);
-            print_lambda_vector(fep, fep->init_fep_state, true, true,
-                                lambda_name_str);
-            buf += gmx::formatString("%s %d: %s = %s",
-                                     lambdastate, fep->init_fep_state,
+            print_lambda_vector(fep, fep->init_fep_state, true, false, lambda_vec_str);
+            print_lambda_vector(fep, fep->init_fep_state, true, true, lambda_name_str);
+            buf += gmx::formatString("%s %d: %s = %s", lambdastate, fep->init_fep_state,
                                      lambda_name_str, lambda_vec_str);
         }
     }
@@ -769,12 +722,12 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
 
     if (fep->n_lambda > 0 && (expand->elmcmove > elmcmoveNO))
     {
-        nsets += 1;   /*add fep state for expanded ensemble */
+        nsets += 1; /*add fep state for expanded ensemble */
     }
 
     if (fep->edHdLPrintEnergy != edHdLPrintEnergyNO)
     {
-        nsets += 1;  /* add energy to the dhdl as well */
+        nsets += 1; /* add energy to the dhdl as well */
     }
 
     nsetsextend = nsets;
@@ -785,7 +738,7 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
                              lambda, and only output when init_lambda is not
                              set in order to maintain compatibility of the
                              dhdl.xvg file) */
-        write_pV     = true;
+        write_pV = true;
     }
     std::vector<std::string> setname(nsetsextend);
 
@@ -805,8 +758,7 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
                 break;
             case edHdLPrintEnergyTOTAL:
             case edHdLPrintEnergyYES:
-            default:
-                energy = gmx::formatString("%s (%s)", "Total Energy", unit_energy);
+            default: energy = gmx::formatString("%s (%s)", "Total Energy", unit_energy);
         }
         setname[s++] = energy;
     }
@@ -818,7 +770,7 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
             if (fep->separate_dvdl[i])
             {
                 std::string derivative;
-                if ( (fep->init_lambda >= 0)  && (n_lambda_terms == 1 ))
+                if ((fep->init_lambda >= 0) && (n_lambda_terms == 1))
                 {
                     /* compatibility output */
                     derivative = gmx::formatString("%s %s %.4f", dhdl, lambda, fep->init_lambda);
@@ -830,8 +782,7 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
                     {
                         lam = fep->all_lambda[i][fep->init_fep_state];
                     }
-                    derivative = gmx::formatString("%s %s = %.4f", dhdl, efpt_singular_names[i],
-                                                   lam);
+                    derivative = gmx::formatString("%s %s = %.4f", dhdl, efpt_singular_names[i], lam);
                 }
                 setname[s++] = derivative;
             }
@@ -846,7 +797,7 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
 
         if (expand->elmcmove > elmcmoveNO)
         {
-            nsetsbegin = 1;  /* for including the expanded ensemble */
+            nsetsbegin = 1; /* for including the expanded ensemble */
         }
         else
         {
@@ -863,7 +814,7 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
         {
             print_lambda_vector(fep, i, false, false, lambda_vec_str);
             std::string buf;
-            if ( (fep->init_lambda >= 0)  && (n_lambda_terms == 1 ))
+            if ((fep->init_lambda >= 0) && (n_lambda_terms == 1))
             {
                 /* for compatible dhdl.xvg files */
                 buf = gmx::formatString("%s %s %s", deltag, lambda, lambda_vec_str);
@@ -876,9 +827,8 @@ FILE *open_dhdl(const char *filename, const t_inputrec *ir,
             if (ir->bSimTemp)
             {
                 /* print the temperature for this state if doing simulated annealing */
-                buf += gmx::formatString("T = %g (%s)",
-                                         ir->simtempvals->temperatures[s-(nsetsbegin)],
-                                         unit_temp_K);
+                buf += gmx::formatString(
+                        "T = %g (%s)", ir->simtempvals->temperatures[s - (nsetsbegin)], unit_temp_K);
             }
             setname[s++] = buf;
         }
@@ -900,18 +850,18 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
                                        bool                    bSum,
                                        double                  time,
                                        real                    tmass,
-                                       const gmx_enerdata_t   *enerd,
-                                       const t_state          *state,
-                                       const t_lambda         *fep,
-                                       const t_expanded       *expand,
+                                       const gmx_enerdata_t*   enerd,
+                                       const t_state*          state,
+                                       const t_lambda*         fep,
+                                       const t_expanded*       expand,
                                        const matrix            box,
                                        const tensor            svir,
                                        const tensor            fvir,
                                        const tensor            vir,
                                        const tensor            pres,
-                                       const gmx_ekindata_t   *ekind,
+                                       const gmx_ekindata_t*   ekind,
                                        const rvec              mu_tot,
-                                       const gmx::Constraints *constr)
+                                       const gmx::Constraintsconstr)
 {
     int    j, k, kk, n, gid;
     real   crmsd[2], tmp6[6];
@@ -951,8 +901,8 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
             bs[2] = box[ZZ][ZZ];
             nboxs = boxs_nm.size();
         }
-        vol  = box[XX][XX]*box[YY][YY]*box[ZZ][ZZ];
-        dens = (tmass*AMU)/(vol*NANO*NANO*NANO);
+        vol  = box[XX][XX] * box[YY][YY] * box[ZZ][ZZ];
+        dens = (tmass * AMU) / (vol * NANO * NANO * NANO);
         add_ebin(ebin_, ib_, nboxs, bs, bSum);
         add_ebin(ebin_, ivol_, 1, &vol, bSum);
         add_ebin(ebin_, idens_, 1, &dens, bSum);
@@ -961,7 +911,7 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
         {
             /* This is pV (in kJ/mol).  The pressure is the reference pressure,
                not the instantaneous pressure */
-            pv = vol*ref_p_/PRESFAC;
+            pv = vol * ref_p_ / PRESFAC;
 
             add_ebin(ebin_, ipv_, 1, &pv, bSum);
             enthalpy = pv + enerd->term[F_ETOT];
@@ -977,7 +927,7 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
     {
         add_ebin(ebin_, ivir_, 9, vir[0], bSum);
         add_ebin(ebin_, ipres_, 9, pres[0], bSum);
-        tmp = (pres[ZZ][ZZ]-(pres[XX][XX]+pres[YY][YY])*0.5)*box[ZZ][ZZ];
+        tmp = (pres[ZZ][ZZ] - (pres[XX][XX] + pres[YY][YY]) * 0.5) * box[ZZ][ZZ];
         add_ebin(ebin_, isurft_, 1, &tmp, bSum);
     }
     if (epc_ == epcPARRINELLORAHMAN || epc_ == epcMTTK)
@@ -996,12 +946,13 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
     }
     if (ekind && ekind->cosacc.cos_accel != 0)
     {
-        vol  = box[XX][XX]*box[YY][YY]*box[ZZ][ZZ];
-        dens = (tmass*AMU)/(vol*NANO*NANO*NANO);
+        vol  = box[XX][XX] * box[YY][YY] * box[ZZ][ZZ];
+        dens = (tmass * AMU) / (vol * NANO * NANO * NANO);
         add_ebin(ebin_, ivcos_, 1, &(ekind->cosacc.vcos), bSum);
         /* 1/viscosity, unit 1/(kg m^-1 s^-1) */
-        tmp = 1/(ekind->cosacc.cos_accel/(ekind->cosacc.vcos*PICO)
-                 *dens*gmx::square(box[ZZ][ZZ]*NANO/(2*M_PI)));
+        tmp = 1
+              / (ekind->cosacc.cos_accel / (ekind->cosacc.vcos * PICO) * dens
+                 * gmx::square(box[ZZ][ZZ] * NANO / (2 * M_PI)));
         add_ebin(ebin_, ivisc_, 1, &tmp, bSum);
     }
     if (nE_ > 1)
@@ -1044,9 +995,9 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
                     {
                         for (j = 0; j < nNHC_; j++)
                         {
-                            k                  = i*nNHC_+j;
-                            tmp_r_[2*k]        = state->nosehoover_xi[k];
-                            tmp_r_[2*k+1]      = state->nosehoover_vxi[k];
+                            k                 = i * nNHC_ + j;
+                            tmp_r_[2 * k]     = state->nosehoover_xi[k];
+                            tmp_r_[2 * k + 1] = state->nosehoover_vxi[k];
                         }
                     }
                     add_ebin(ebin_, itc_, mde_n_, tmp_r_, bSum);
@@ -1057,9 +1008,9 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
                         {
                             for (j = 0; j < nNHC_; j++)
                             {
-                                k                  = i*nNHC_+j;
-                                tmp_r_[2*k]        = state->nhpres_xi[k];
-                                tmp_r_[2*k+1]      = state->nhpres_vxi[k];
+                                k                 = i * nNHC_ + j;
+                                tmp_r_[2 * k]     = state->nhpres_xi[k];
+                                tmp_r_[2 * k + 1] = state->nhpres_vxi[k];
                             }
                         }
                         add_ebin(ebin_, itcb_, mdeb_n_, tmp_r_, bSum);
@@ -1069,15 +1020,14 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
                 {
                     for (int i = 0; (i < nTC_); i++)
                     {
-                        tmp_r_[2*i]   = state->nosehoover_xi[i];
-                        tmp_r_[2*i+1] = state->nosehoover_vxi[i];
+                        tmp_r_[2 * i]     = state->nosehoover_xi[i];
+                        tmp_r_[2 * i + 1] = state->nosehoover_vxi[i];
                     }
                     add_ebin(ebin_, itc_, mde_n_, tmp_r_, bSum);
                 }
             }
         }
-        else if (etc_ == etcBERENDSEN || etc_ == etcYES ||
-                 etc_ == etcVRESCALE)
+        else if (etc_ == etcBERENDSEN || etc_ == etcYES || etc_ == etcVRESCALE)
         {
             for (int i = 0; (i < nTC_); i++)
             {
@@ -1093,7 +1043,7 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
         {
             copy_rvec(ekind->grpstat[i].u, tmp_v_[i]);
         }
-        add_ebin(ebin_, iu_, 3*nU_, tmp_v_[0], bSum);
+        add_ebin(ebin_, iu_, 3 * nU_, tmp_v_[0], bSum);
     }
 
     ebin_increase_count(1, ebin_, bSum);
@@ -1104,16 +1054,17 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
         for (gmx::index i = 0; i < static_cast<gmx::index>(enerd->enerpart_lambda.size()) - 1; i++)
         {
             /* zero for simulated tempering */
-            dE_[i] = enerd->enerpart_lambda[i+1]-enerd->enerpart_lambda[0];
+            dE_[i] = enerd->enerpart_lambda[i + 1] - enerd->enerpart_lambda[0];
             if (numTemperatures_ > 0)
             {
-                GMX_RELEASE_ASSERT(numTemperatures_ > state->fep_state, "Number of lambdas in state is bigger then in input record");
-                GMX_RELEASE_ASSERT(numTemperatures_ >= static_cast<gmx::index>(enerd->enerpart_lambda.size()) - 1, "Number of lambdas in energy data is bigger then in input record");
+                GMX_RELEASE_ASSERT(numTemperatures_ > state->fep_state,
+                                   "Number of lambdas in state is bigger then in input record");
+                GMX_RELEASE_ASSERT(
+                        numTemperatures_ >= static_cast<gmx::index>(enerd->enerpart_lambda.size()) - 1,
+                        "Number of lambdas in energy data is bigger then in input record");
                 /* MRS: is this right, given the way we have defined the exchange probabilities? */
                 /* is this even useful to have at all? */
-                dE_[i] += (temperatures_[i]/
-                           temperatures_[state->fep_state]-1.0)*
-                    enerd->term[F_EKIN];
+                dE_[i] += (temperatures_[i] / temperatures_[state->fep_state] - 1.0) * enerd->term[F_EKIN];
             }
         }
 
@@ -1133,13 +1084,10 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
             {
                 switch (fep->edHdLPrintEnergy)
                 {
-                    case edHdLPrintEnergyPOTENTIAL:
-                        store_energy = enerd->term[F_EPOT];
-                        break;
+                    case edHdLPrintEnergyPOTENTIAL: store_energy = enerd->term[F_EPOT]; break;
                     case edHdLPrintEnergyTOTAL:
                     case edHdLPrintEnergyYES:
-                    default:
-                        store_energy = enerd->term[F_ETOT];
+                    default: store_energy = enerd->term[F_ETOT];
                 }
                 fprintf(fp_dhdl_, " %#.8g", store_energy);
             }
@@ -1151,7 +1099,7 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
                     if (fep->separate_dvdl[i])
                     {
                         /* assumes F_DVDL is first */
-                        fprintf(fp_dhdl_, " %#.8g", enerd->term[F_DVDL+i]);
+                        fprintf(fp_dhdl_, " %#.8g", enerd->term[F_DVDL + i]);
                     }
                 }
             }
@@ -1159,16 +1107,13 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
             {
                 fprintf(fp_dhdl_, " %#.8g", dE_[i]);
             }
-            if (bDynBox_ &&
-                bDiagPres_ &&
-                (epc_ != epcNO) &&
-                !enerd->enerpart_lambda.empty() &&
-                (fep->init_lambda < 0))
+            if (bDynBox_ && bDiagPres_ && (epc_ != epcNO) && !enerd->enerpart_lambda.empty()
+                && (fep->init_lambda < 0))
             {
-                fprintf(fp_dhdl_, " %#.8g", pv);  /* PV term only needed when
-                                                          there are alternate state
-                                                          lambda and we're not in
-                                                          compatibility mode */
+                fprintf(fp_dhdl_, " %#.8g", pv); /* PV term only needed when
+                                                         there are alternate state
+                                                         lambda and we're not in
+                                                         compatibility mode */
             }
             fprintf(fp_dhdl_, "\n");
             /* and the binary free energy output */
@@ -1181,22 +1126,16 @@ void EnergyOutput::addDataAtEnergyStep(bool                    bDoDHDL,
                 if (fep->separate_dvdl[i])
                 {
                     /* assumes F_DVDL is first */
-                    store_dhdl[idhdl] = enerd->term[F_DVDL+i];
-                    idhdl            += 1;
+                    store_dhdl[idhdl] = enerd->term[F_DVDL + i];
+                    idhdl += 1;
                 }
             }
             store_energy = enerd->term[F_ETOT];
             /* store_dh is dE */
-            mde_delta_h_coll_add_dh(dhc_,
-                                    static_cast<double>(state->fep_state),
-                                    store_energy,
-                                    pv,
-                                    store_dhdl,
-                                    dE_ + fep->lambda_start_n,
-                                    time);
+            mde_delta_h_coll_add_dh(dhc_, static_cast<double>(state->fep_state), store_energy, pv,
+                                    store_dhdl, dE_ + fep->lambda_start_n, time);
         }
     }
-    ;
 }
 
 void EnergyOutput::recordNonEnergyStep()
@@ -1204,36 +1143,41 @@ void EnergyOutput::recordNonEnergyStep()
     ebin_increase_count(1, ebin_, false);
 }
 
-void EnergyOutput::printHeader(FILE *log, int64_t steps, double time)
+void EnergyOutput::printHeader(FILElog, int64_t steps, double time)
 {
     char buf[22];
 
-    fprintf(log, "   %12s   %12s\n"
+    fprintf(log,
+            "   %12s   %12s\n"
             "   %12s   %12.5f\n\n",
             "Step", "Time", gmx_step_str(steps, buf), time);
 }
 
-void EnergyOutput::printStepToEnergyFile(ener_file *fp_ene, bool bEne, bool bDR, bool bOR,
-                                         FILE *log,
-                                         int64_t step, double time,
-                                         t_fcdata *fcd,
-                                         gmx::Awh *awh)
+void EnergyOutput::printStepToEnergyFile(ener_file* fp_ene,
+                                         bool       bEne,
+                                         bool       bDR,
+                                         bool       bOR,
+                                         FILE*      log,
+                                         int64_t    step,
+                                         double     time,
+                                         t_fcdata*  fcd,
+                                         gmx::Awh*  awh)
 {
-    t_enxframe   fr;
+    t_enxframe fr;
     init_enxframe(&fr);
-    fr.t            = time;
-    fr.step         = step;
-    fr.nsteps       = ebin_->nsteps;
-    fr.dt           = delta_t_;
-    fr.nsum         = ebin_->nsum;
-    fr.nre          = (bEne) ? ebin_->nener : 0;
-    fr.ener         = ebin_->e;
-    int ndisre          = bDR ? fcd->disres.npair : 0;
+    fr.t       = time;
+    fr.step    = step;
+    fr.nsteps  = ebin_->nsteps;
+    fr.dt      = delta_t_;
+    fr.nsum    = ebin_->nsum;
+    fr.nre     = (bEne) ? ebin_->nener : 0;
+    fr.ener    = ebin_->e;
+    int ndisre = bDR ? fcd->disres.npair : 0;
     /* these are for the old-style blocks (1 subblock, only reals), because
        there can be only one per ID for these */
-    int          nr[enxNR];
-    int          id[enxNR];
-    real        *block[enxNR];
+    int   nr[enxNR];
+    int   id[enxNR];
+    realblock[enxNR];
     /* Optional additional old-style (real-only) blocks. */
     for (int i = 0; i < enxNR; i++)
     {
@@ -1246,11 +1190,10 @@ void EnergyOutput::printStepToEnergyFile(ener_file *fp_ene, bool bEne, bool bDR,
         nr[enxOR]     = fcd->orires.nr;
         block[enxOR]  = fcd->orires.otav;
         id[enxOR]     = enxOR;
-        nr[enxORI]    = (fcd->orires.oinsl != fcd->orires.otav) ?
-            fcd->orires.nr : 0;
+        nr[enxORI]    = (fcd->orires.oinsl != fcd->orires.otav) ? fcd->orires.nr : 0;
         block[enxORI] = fcd->orires.oinsl;
         id[enxORI]    = enxORI;
-        nr[enxORT]    = fcd->orires.nex*12;
+        nr[enxORT]    = fcd->orires.nex * 12;
         block[enxORT] = fcd->orires.eig;
         id[enxORT]    = enxORT;
     }
@@ -1277,8 +1220,8 @@ void EnergyOutput::printStepToEnergyFile(ener_file *fp_ene, bool bEne, bool bDR,
             fr.block[b].sub[0].type = xdr_datatype_float;
             fr.block[b].sub[0].fval = block[b];
 #else
-            fr.block[b].sub[0].type = xdr_datatype_double;
-            fr.block[b].sub[0].dval = block[b];
+            fr.block[b].sub[0].type  = xdr_datatype_double;
+            fr.block[b].sub[0].dval  = block[b];
 #endif
         }
 
@@ -1320,7 +1263,7 @@ void EnergyOutput::printStepToEnergyFile(ener_file *fp_ene, bool bEne, bool bDR,
         }
 
         /* AWH bias blocks. */
-        if (awh != nullptr)  // TODO: add boolean flag.
+        if (awh != nullptr) // TODO: add boolean flag.
         {
             awh->writeToEnergyFrame(step, &fr);
         }
@@ -1342,12 +1285,12 @@ void EnergyOutput::printStepToEnergyFile(ener_file *fp_ene, bool bEne, bool bDR,
         }
 
         fprintf(log, "   Energies (%s)\n", unit_energy);
-        pr_ebin(log, ebin_, ie_, f_nre_+nCrmsd_, 5, eprNORMAL, true);
+        pr_ebin(log, ebin_, ie_, f_nre_ + nCrmsd_, 5, eprNORMAL, true);
         fprintf(log, "\n");
     }
 }
 
-void EnergyOutput::printAnnealingTemperatures(FILE *log, SimulationGroups *groups, t_grpopts *opts)
+void EnergyOutput::printAnnealingTemperatures(FILE* log, SimulationGroups* groups, t_grpopts* opts)
 {
     if (log)
     {
@@ -1367,7 +1310,7 @@ void EnergyOutput::printAnnealingTemperatures(FILE *log, SimulationGroups *group
     }
 }
 
-void EnergyOutput::printAverages(FILE *log, const SimulationGroups *groups)
+void EnergyOutput::printAverages(FILE* log, const SimulationGroups* groups)
 {
     if (ebin_->nsum_sim <= 0)
     {
@@ -1387,18 +1330,16 @@ void EnergyOutput::printAverages(FILE *log, const SimulationGroups *groups)
         fprintf(log, "\t<==  ###############  ======>\n\n");
 
         fprintf(log, "\tStatistics over %s steps using %s frames\n",
-                gmx_step_str(ebin_->nsteps_sim, buf1),
-                gmx_step_str(ebin_->nsum_sim, buf2));
+                gmx_step_str(ebin_->nsteps_sim, buf1), gmx_step_str(ebin_->nsum_sim, buf2));
         fprintf(log, "\n");
 
         fprintf(log, "   Energies (%s)\n", unit_energy);
-        pr_ebin(log, ebin_, ie_, f_nre_+nCrmsd_, 5, eprAVER, true);
+        pr_ebin(log, ebin_, ie_, f_nre_ + nCrmsd_, 5, eprAVER, true);
         fprintf(log, "\n");
 
         if (bDynBox_)
         {
-            pr_ebin(log, ebin_, ib_, bTricl_ ? tricl_boxs_nm.size() : boxs_nm.size(), 5,
-                    eprAVER, true);
+            pr_ebin(log, ebin_, ib_, bTricl_ ? tricl_boxs_nm.size() : boxs_nm.size(), 5, eprAVER, true);
             fprintf(log, "\n");
         }
         if (bConstrVir_)
@@ -1445,14 +1386,12 @@ void EnergyOutput::printAverages(FILE *log, const SimulationGroups *groups)
                 int ni = groups->groups[SimulationAtomGroupType::EnergyOutput][i];
                 for (int j = i; (j < nEg_); j++)
                 {
-                    int nj      = groups->groups[SimulationAtomGroupType::EnergyOutput][j];
-                    int padding = 14 - (strlen(*(groups->groupNames[ni])) +
-                                        strlen(*(groups->groupNames[nj])));
-                    fprintf(log, "%*s%s-%s", padding, "",
-                            *(groups->groupNames[ni]),
+                    int nj = groups->groups[SimulationAtomGroupType::EnergyOutput][j];
+                    int padding =
+                            14 - (strlen(*(groups->groupNames[ni])) + strlen(*(groups->groupNames[nj])));
+                    fprintf(log, "%*s%s-%s", padding, "", *(groups->groupNames[ni]),
                             *(groups->groupNames[nj]));
-                    pr_ebin(log, ebin_, igrp_[n], nEc_, nEc_, eprAVER,
-                            false);
+                    pr_ebin(log, ebin_, igrp_[n], nEc_, nEc_, eprAVER, false);
                     n++;
                 }
             }
@@ -1465,22 +1404,21 @@ void EnergyOutput::printAverages(FILE *log, const SimulationGroups *groups)
         }
         if (nU_ > 1)
         {
-            fprintf(log, "%15s   %12s   %12s   %12s\n",
-                    "Group", "Ux", "Uy", "Uz");
+            fprintf(log, "%15s   %12s   %12s   %12s\n", "Group", "Ux", "Uy", "Uz");
             for (int i = 0; (i < nU_); i++)
             {
                 int ni = groups->groups[SimulationAtomGroupType::Acceleration][i];
                 fprintf(log, "%15s", *groups->groupNames[ni]);
-                pr_ebin(log, ebin_, iu_+3*i, 3, 3, eprAVER, false);
+                pr_ebin(log, ebin_, iu_ + 3 * i, 3, 3, eprAVER, false);
             }
             fprintf(log, "\n");
         }
     }
 }
 
-void EnergyOutput::fillEnergyHistory(energyhistory_t *enerhist) const
+void EnergyOutput::fillEnergyHistory(energyhistory_tenerhist) const
 {
-    const t_ebin * const ebin = ebin_;
+    const t_ebin* const ebin = ebin_;
 
     enerhist->nsteps     = ebin->nsteps;
     enerhist->nsum       = ebin->nsum;
@@ -1516,14 +1454,16 @@ void EnergyOutput::fillEnergyHistory(energyhistory_t *enerhist) const
     }
 }
 
-void EnergyOutput::restoreFromEnergyHistory(const energyhistory_t &enerhist)
+void EnergyOutput::restoreFromEnergyHistory(const energyhistory_tenerhist)
 {
     unsigned int nener = static_cast<unsigned int>(ebin_->nener);
 
-    if ((enerhist.nsum     > 0 && nener != enerhist.ener_sum.size()) ||
-        (enerhist.nsum_sim > 0 && nener != enerhist.ener_sum_sim.size()))
+    if ((enerhist.nsum > 0 && nener != enerhist.ener_sum.size())
+        || (enerhist.nsum_sim > 0 && nener != enerhist.ener_sum_sim.size()))
     {
-        gmx_fatal(FARGS, "Mismatch between number of energies in run input (%u) and checkpoint file (%zu or %zu).",
+        gmx_fatal(FARGS,
+                  "Mismatch between number of energies in run input (%u) and checkpoint file (%zu "
+                  "or %zu).",
                   nener, enerhist.ener_sum.size(), enerhist.ener_sum_sim.size());
     }
 
@@ -1534,12 +1474,9 @@ void EnergyOutput::restoreFromEnergyHistory(const energyhistory_t &enerhist)
 
     for (int i = 0; i < ebin_->nener; i++)
     {
-        ebin_->e[i].eav  =
-            (enerhist.nsum > 0 ? enerhist.ener_ave[i] : 0);
-        ebin_->e[i].esum =
-            (enerhist.nsum > 0 ? enerhist.ener_sum[i] : 0);
-        ebin_->e_sim[i].esum =
-            (enerhist.nsum_sim > 0 ? enerhist.ener_sum_sim[i] : 0);
+        ebin_->e[i].eav      = (enerhist.nsum > 0 ? enerhist.ener_ave[i] : 0);
+        ebin_->e[i].esum     = (enerhist.nsum > 0 ? enerhist.ener_sum[i] : 0);
+        ebin_->e_sim[i].esum = (enerhist.nsum_sim > 0 ? enerhist.ener_sum_sim[i] : 0);
     }
     if (dhc_)
     {