#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_t* mtop, int ngacc, t_grp_acc gstat[])
{
if (ngacc > 0)
{
- const SimulationGroups &groups = mtop->groups;
+ const SimulationGroups& groups = mtop->groups;
for (const AtomProxy atomP : AtomRange(*mtop))
{
- const t_atom &local = atomP.atom();
+ const t_atom& local = atomP.atom();
int i = atomP.globalAtomNumber();
int grp = getGroupType(groups, SimulationAtomGroupType::Acceleration, i);
if ((grp < 0) && (grp >= ngacc))
}
}
-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;
* 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
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;
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_bin* rb;
int g;
rb = mk_bin();
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;
}
g = 0;
- for (n = start; (n < start+homenr); n++)
+ for (n = start; (n < start + homenr); n++)
{
if (md->cACC)
{
}
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;
}
}
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_tcstat* tcstat;
real nrdf, nd, *ndf;
ngtc = opts->ngtc;
{
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]);
}
}
}
tcstat->T = 0;
tcstat->Th = 0;
}
- T += nd*tcstat->T;
+ T += nd * tcstat->T;
nrdf += nd;
}
if (nrdf > 0)
}
else
{
- *dekindlambda = 0.5*(ekind->dekindl + ekind->dekindl_old);
+ *dekindlambda = 0.5 * (ekind->dekindl + ekind->dekindl_old);
}
}
return T;