Apply clang-format to source tree
[alexxy/gromacs.git] / src / gromacs / mdlib / tgroup.cpp
index 34672750acd07668e12a5be5a68a97ef675dfcf4..22cb5fa1f7927db443a5123a3f2d980a86b387c6 100644 (file)
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"
 
-static void init_grpstat(const gmx_mtop_t *mtop, int ngacc, t_grp_acc gstat[])
+static void init_grpstat(const gmx_mtop_tmtop, int ngacc, t_grp_acc gstat[])
 {
     if (ngacc > 0)
     {
-        const SimulationGroups    &groups = mtop->groups;
+        const SimulationGroupsgroups = mtop->groups;
         for (const AtomProxy atomP : AtomRange(*mtop))
         {
-            const t_atom &local = atomP.atom();
+            const t_atomlocal = atomP.atom();
             int           i     = atomP.globalAtomNumber();
             int           grp   = getGroupType(groups, SimulationAtomGroupType::Acceleration, i);
             if ((grp < 0) && (grp >= ngacc))
@@ -78,8 +78,11 @@ static void init_grpstat(const gmx_mtop_t *mtop, int ngacc, t_grp_acc gstat[])
     }
 }
 
-void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts *opts,
-                   gmx_ekindata_t *ekind, real cos_accel)
+void init_ekindata(FILE gmx_unused*  log,
+                   const gmx_mtop_t* mtop,
+                   const t_grpopts*  opts,
+                   gmx_ekindata_t*   ekind,
+                   real              cos_accel)
 {
     int i;
 
@@ -119,7 +122,7 @@ void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts
              * EKIN_WORK_BUFFER_SIZE*DIM*DIM*sizeof(real) = 72/144 bytes
              * buffer on both sides to avoid cache pollution.
              */
-            snew(ekind->ekin_work_alloc[thread], ekind->ngtc+2*EKIN_WORK_BUFFER_SIZE);
+            snew(ekind->ekin_work_alloc[thread], ekind->ngtc + 2 * EKIN_WORK_BUFFER_SIZE);
             ekind->ekin_work[thread] = ekind->ekin_work_alloc[thread] + EKIN_WORK_BUFFER_SIZE;
             /* Nasty hack so we can have the per-thread accumulation
              * variable for dekindl in the same thread-local cache lines
@@ -128,7 +131,7 @@ void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts
             ekind->dekindl_work[thread] = &(ekind->ekin_work[thread][ekind->ngtc][0][0]);
 #undef EKIN_WORK_BUFFER_SIZE
         }
-        GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+        GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR
     }
 
     ekind->ngacc = opts->ngacc;
@@ -138,10 +141,10 @@ void init_ekindata(FILE gmx_unused *log, const gmx_mtop_t *mtop, const t_grpopts
     ekind->cosacc.cos_accel = cos_accel;
 }
 
-void accumulate_u(const t_commrec *cr, const t_grpopts *opts, gmx_ekindata_t *ekind)
+void accumulate_u(const t_commrec* cr, const t_grpopts* opts, gmx_ekindata_t* ekind)
 {
     /* This routine will only be called when it's necessary */
-    t_bin *rb;
+    t_binrb;
     int    g;
 
     rb = mk_bin();
@@ -154,13 +157,18 @@ void accumulate_u(const t_commrec *cr, const t_grpopts *opts, gmx_ekindata_t *ek
 
     for (g = 0; (g < opts->ngacc); g++)
     {
-        extract_binr(rb, DIM*g, DIM, ekind->grpstat[g].u);
+        extract_binr(rb, DIM * g, DIM, ekind->grpstat[g].u);
     }
     destroy_bin(rb);
 }
 
-void update_ekindata(int start, int homenr, gmx_ekindata_t *ekind,
-                     const t_grpopts *opts, const rvec v[], const t_mdatoms *md, real lambda)
+void update_ekindata(int              start,
+                     int              homenr,
+                     gmx_ekindata_t*  ekind,
+                     const t_grpopts* opts,
+                     const rvec       v[],
+                     const t_mdatoms* md,
+                     real             lambda)
 {
     int  d, g, n;
     real mv;
@@ -179,7 +187,7 @@ void update_ekindata(int start, int homenr, gmx_ekindata_t *ekind,
         }
 
         g = 0;
-        for (n = start; (n < start+homenr); n++)
+        for (n = start; (n < start + homenr); n++)
         {
             if (md->cACC)
             {
@@ -187,7 +195,7 @@ void update_ekindata(int start, int homenr, gmx_ekindata_t *ekind,
             }
             for (d = 0; (d < DIM); d++)
             {
-                mv                      = md->massT[n]*v[n][d];
+                mv = md->massT[n] * v[n][d];
                 ekind->grpstat[g].u[d] += mv;
             }
         }
@@ -197,18 +205,17 @@ void update_ekindata(int start, int homenr, gmx_ekindata_t *ekind,
             for (d = 0; (d < DIM); d++)
             {
                 ekind->grpstat[g].u[d] /=
-                    (1-lambda)*ekind->grpstat[g].mA + lambda*ekind->grpstat[g].mB;
+                        (1 - lambda) * ekind->grpstat[g].mA + lambda * ekind->grpstat[g].mB;
             }
         }
     }
 }
 
-real sum_ekin(const t_grpopts *opts, gmx_ekindata_t *ekind, real *dekindlambda,
-              gmx_bool bEkinAveVel, gmx_bool bScaleEkin)
+real sum_ekin(const t_grpopts* opts, gmx_ekindata_t* ekind, real* dekindlambda, gmx_bool bEkinAveVel, gmx_bool bScaleEkin)
 {
     int           i, j, m, ngtc;
     real          T;
-    t_grp_tcstat *tcstat;
+    t_grp_tcstattcstat;
     real          nrdf, nd, *ndf;
 
     ngtc = opts->ngtc;
@@ -247,8 +254,9 @@ real sum_ekin(const t_grpopts *opts, gmx_ekindata_t *ekind, real *dekindlambda,
                 {
                     for (m = 0; (m < DIM); m++)
                     {
-                        tcstat->ekinf[j][m] =
-                            0.5*(tcstat->ekinh[j][m]*tcstat->ekinscaleh_nhc + tcstat->ekinh_old[j][m]);
+                        tcstat->ekinf[j][m] = 0.5
+                                              * (tcstat->ekinh[j][m] * tcstat->ekinscaleh_nhc
+                                                 + tcstat->ekinh_old[j][m]);
                     }
                 }
             }
@@ -272,7 +280,7 @@ real sum_ekin(const t_grpopts *opts, gmx_ekindata_t *ekind, real *dekindlambda,
             tcstat->T  = 0;
             tcstat->Th = 0;
         }
-        T    += nd*tcstat->T;
+        T += nd * tcstat->T;
         nrdf += nd;
     }
     if (nrdf > 0)
@@ -287,7 +295,7 @@ real sum_ekin(const t_grpopts *opts, gmx_ekindata_t *ekind, real *dekindlambda,
         }
         else
         {
-            *dekindlambda = 0.5*(ekind->dekindl + ekind->dekindl_old);
+            *dekindlambda = 0.5 * (ekind->dekindl + ekind->dekindl_old);
         }
     }
     return T;