#include "gromacs/mdlib/force.h"
#include "gromacs/mdlib/force_flags.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
-#include "gromacs/mdlib/mdatoms.h"
#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/enerdata.h"
return shfc;
}
-void gmx::make_local_shells(const t_commrec* cr, const t_mdatoms* md, gmx_shellfc_t* shfc)
+void gmx::make_local_shells(const t_commrec* cr, const t_mdatoms& md, gmx_shellfc_t* shfc)
{
int a0, a1;
gmx_domdec_t* dd = nullptr;
std::vector<t_shell>& shells = shfc->shells;
shells.clear();
+ auto ptype = md.ptype;
for (int i = a0; i < a1; i++)
{
- if (md->ptype[i] == ParticleType::Shell)
+ if (ptype[i] == ParticleType::Shell)
{
if (dd)
{
const t_commrec* cr,
int dd_ac1,
int64_t step,
- const t_mdatoms* md,
+ const t_mdatoms& md,
int end,
ArrayRefWithPadding<RVec> xOld,
ArrayRef<RVec> x_init,
rvec* x_old = as_rvec_array(xOld.paddedArrayRef().data());
rvec* x = as_rvec_array(xCurrent.paddedArrayRef().data());
- const ParticleType* ptype = md->ptype;
-
- dt = ir->delta_t;
+ auto ptype = md.ptype;
+ auto invmass = gmx::arrayRefFromArray(md.invmass, md.nr);
+ dt = ir->delta_t;
/* Does NOT work with freeze groups (yet) */
for (n = 0; n < end; n++)
{
- w_dt = md->invmass[n] * dt;
+ w_dt = invmass[n] * dt;
for (d = 0; d < DIM; d++)
{
for (d = 0; d < DIM; d++)
{
xnew[n][d] = -(2 * x[n][d] - xnold[n][d] - xnew[n][d]) / gmx::square(dt)
- - f[n][d] * md->invmass[n];
+ - f[n][d] * invmass[n];
}
clear_rvec(acc_dir[n]);
}
const history_t* hist,
gmx::ForceBuffersView* f,
tensor force_vir,
- const t_mdatoms* md,
+ const t_mdatoms& md,
t_nrnb* nrnb,
gmx_wallcycle_t wcycle,
gmx_shellfc_t* shfc,
real dum = 0;
char sbuf[22];
int nat, dd_ac0, dd_ac1 = 0, i;
- int homenr = md->homenr, end = homenr;
+ int homenr = md.homenr, end = homenr;
int d, Min = 0, count = 0;
#define Try (1 - Min) /* At start Try = 1 */
* before do_force is called, which normally puts all
* charge groups in the box.
*/
- put_atoms_in_box_omp(
- fr->pbcType, box, x.subArray(0, md->homenr), gmx_omp_nthreads_get(emntDefault));
+ put_atoms_in_box_omp(fr->pbcType, box, x.subArray(0, md.homenr), gmx_omp_nthreads_get(emntDefault));
}
if (nflexcon)
}
}
+ auto massT = gmx::arrayRefFromArray(md.massT, md.nr);
/* Do a prediction of the shell positions, when appropriate.
* Without velocities (EM, NM, BD) we only do initial prediction.
*/
if (shfc->predictShells && !bCont && (EI_STATE_VELOCITY(inputrec->eI) || bInit))
{
- predict_shells(
- fplog, x, v, inputrec->delta_t, shells, gmx::arrayRefFromArray(md->massT, md->homenr), bInit);
+ predict_shells(fplog, x, v, inputrec->delta_t, shells, massT, bInit);
}
/* Calculate the forces first time around */
hist,
&forceViewInit,
force_vir,
- md,
+ &md,
enerd,
lambda,
fr,
for (i = 0; i < end; i++)
{
- sf_dir += md->massT[i] * norm2(shfc->acc_dir[i]);
+ sf_dir += massT[i] * norm2(shfc->acc_dir[i]);
}
}
accumulatePotentialEnergies(enerd, lambda, inputrec->fepvals.get());
if (gmx_debug_at)
{
- pr_rvecs(debug, 0, "force0", as_rvec_array(force[Min].data()), md->nr);
+ pr_rvecs(debug, 0, "force0", as_rvec_array(force[Min].data()), md.nr);
}
if (!shells.empty() || nflexcon > 0)
hist,
&forceViewTry,
force_vir,
- md,
+ &md,
enerd,
lambda,
fr,
ArrayRef<const RVec> acc_dir = shfc->acc_dir;
for (i = 0; i < end; i++)
{
- sf_dir += md->massT[i] * norm2(acc_dir[i]);
+ sf_dir += massT[i] * norm2(acc_dir[i]);
}
}