/* In domdec_top.c */
/*! \brief Print error output when interactions are missing */
-[[noreturn]] void dd_print_missing_interactions(const gmx::MDLogger& mdlog,
- t_commrec* cr,
- int local_count,
- const gmx_mtop_t* top_global,
- const gmx_localtop_t* top_local,
- const rvec* x,
- const matrix box);
+[[noreturn]] void dd_print_missing_interactions(const gmx::MDLogger& mdlog,
+ t_commrec* cr,
+ int local_count,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t* top_local,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const matrix box);
/*! \brief Generate and store the reverse topology */
void dd_make_reverse_top(FILE* fplog,
}
}
-void dd_print_missing_interactions(const gmx::MDLogger& mdlog,
- t_commrec* cr,
- int local_count,
- const gmx_mtop_t* top_global,
- const gmx_localtop_t* top_local,
- const rvec* x,
- const matrix box)
+void dd_print_missing_interactions(const gmx::MDLogger& mdlog,
+ t_commrec* cr,
+ int local_count,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t* top_local,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const matrix box)
{
int ndiff_tot, cl[F_NRE], n, ndiff, rest_global, rest_local;
int ftype, nral;
}
print_missing_interactions_atoms(mdlog, cr, top_global, &top_local->idef);
- write_dd_pdb("dd_dump_err", 0, "dump", top_global, cr, -1, x, box);
+ write_dd_pdb("dd_dump_err", 0, "dump", top_global, cr, -1, as_rvec_array(x.data()), box);
std::string errorMessage;
}
/*! \brief Check whether bonded interactions are missing, if appropriate */
-void checkNumberOfBondedInteractions(const gmx::MDLogger& mdlog,
- t_commrec* cr,
- int totalNumberOfBondedInteractions,
- const gmx_mtop_t* top_global,
- const gmx_localtop_t* top_local,
- const rvec* x,
- const matrix box,
- bool* shouldCheckNumberOfBondedInteractions)
+void checkNumberOfBondedInteractions(const gmx::MDLogger& mdlog,
+ t_commrec* cr,
+ int totalNumberOfBondedInteractions,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t* top_local,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const matrix box,
+ bool* shouldCheckNumberOfBondedInteractions)
{
if (*shouldCheckNumberOfBondedInteractions)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* \param[in] box Box matrix for the error message
* \param[in,out] shouldCheckNumberOfBondedInteractions Whether we should do the check. Always set to false.
*/
-void checkNumberOfBondedInteractions(const gmx::MDLogger& mdlog,
- t_commrec* cr,
- int totalNumberOfBondedInteractions,
- const gmx_mtop_t* top_global,
- const gmx_localtop_t* top_local,
- const rvec* x,
- const matrix box,
- bool* shouldCheckNumberOfBondedInteractions);
+void checkNumberOfBondedInteractions(const gmx::MDLogger& mdlog,
+ t_commrec* cr,
+ int totalNumberOfBondedInteractions,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t* top_local,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const matrix box,
+ bool* shouldCheckNumberOfBondedInteractions);
#endif
/* TODO Specialize this routine into init-time and loop-time versions?
e.g. bReadEkin is only true when restoring from checkpoint */
-void compute_globals(gmx_global_stat* gstat,
- t_commrec* cr,
- const t_inputrec* ir,
- t_forcerec* fr,
- gmx_ekindata_t* ekind,
- const rvec* x,
- const rvec* v,
- const matrix box,
- real vdwLambda,
- const t_mdatoms* mdatoms,
- t_nrnb* nrnb,
- t_vcm* vcm,
- gmx_wallcycle_t wcycle,
- gmx_enerdata_t* enerd,
- tensor force_vir,
- tensor shake_vir,
- tensor total_vir,
- tensor pres,
- gmx::Constraints* constr,
- gmx::SimulationSignaller* signalCoordinator,
- const matrix lastbox,
- int* totalNumberOfBondedInteractions,
- gmx_bool* bSumEkinhOld,
- const int flags)
+void compute_globals(gmx_global_stat* gstat,
+ t_commrec* cr,
+ const t_inputrec* ir,
+ t_forcerec* fr,
+ gmx_ekindata_t* ekind,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ const matrix box,
+ real vdwLambda,
+ const t_mdatoms* mdatoms,
+ t_nrnb* nrnb,
+ t_vcm* vcm,
+ gmx_wallcycle_t wcycle,
+ gmx_enerdata_t* enerd,
+ tensor force_vir,
+ tensor shake_vir,
+ tensor total_vir,
+ tensor pres,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* signalCoordinator,
+ const matrix lastbox,
+ int* totalNumberOfBondedInteractions,
+ gmx_bool* bSumEkinhOld,
+ const int flags)
{
gmx_bool bEner, bPres, bTemp;
gmx_bool bStopCM, bGStat, bReadEkin, bEkinAveVel, bScaleEkin, bConstrain;
* and for COM removal with rotational and acceleration correction modes.
* Velocities v are needed for kinetic energy calculation and for COM removal.
*/
-void compute_globals(gmx_global_stat* gstat,
- t_commrec* cr,
- const t_inputrec* ir,
- t_forcerec* fr,
- gmx_ekindata_t* ekind,
- const rvec* x,
- const rvec* v,
- const matrix box,
- real vdwLambda,
- const t_mdatoms* mdatoms,
- t_nrnb* nrnb,
- t_vcm* vcm,
- gmx_wallcycle_t wcycle,
- gmx_enerdata_t* enerd,
- tensor force_vir,
- tensor shake_vir,
- tensor total_vir,
- tensor pres,
- gmx::Constraints* constr,
- gmx::SimulationSignaller* signalCoordinator,
- const matrix lastbox,
- int* totalNumberOfBondedInteractions,
- gmx_bool* bSumEkinhOld,
- int flags);
+void compute_globals(gmx_global_stat* gstat,
+ t_commrec* cr,
+ const t_inputrec* ir,
+ t_forcerec* fr,
+ gmx_ekindata_t* ekind,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ const matrix box,
+ real vdwLambda,
+ const t_mdatoms* mdatoms,
+ t_nrnb* nrnb,
+ t_vcm* vcm,
+ gmx_wallcycle_t wcycle,
+ gmx_enerdata_t* enerd,
+ tensor force_vir,
+ tensor shake_vir,
+ tensor total_vir,
+ tensor pres,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* signalCoordinator,
+ const matrix lastbox,
+ int* totalNumberOfBondedInteractions,
+ gmx_bool* bSumEkinhOld,
+ int flags);
#endif
}
}
-static void calc_ke_part_normal(const rvec v[],
- const t_grpopts* opts,
- const t_mdatoms* md,
- gmx_ekindata_t* ekind,
- t_nrnb* nrnb,
- gmx_bool bEkinAveVel)
+static void calc_ke_part_normal(ArrayRef<const RVec> v,
+ const t_grpopts* opts,
+ const t_mdatoms* md,
+ gmx_ekindata_t* ekind,
+ t_nrnb* nrnb,
+ gmx_bool bEkinAveVel)
{
int g;
gmx::ArrayRef<t_grp_tcstat> tcstat = ekind->tcstat;
inc_nrnb(nrnb, eNR_EKIN, md->homenr);
}
-static void calc_ke_part_visc(const matrix box,
- const rvec x[],
- const rvec v[],
- const t_grpopts* opts,
- const t_mdatoms* md,
- gmx_ekindata_t* ekind,
- t_nrnb* nrnb,
- gmx_bool bEkinAveVel)
+static void calc_ke_part_visc(const matrix box,
+ ArrayRef<const RVec> x,
+ ArrayRef<const RVec> v,
+ const t_grpopts* opts,
+ const t_mdatoms* md,
+ gmx_ekindata_t* ekind,
+ t_nrnb* nrnb,
+ gmx_bool bEkinAveVel)
{
int start = 0, homenr = md->homenr;
int g, d, n, m, gt = 0;
inc_nrnb(nrnb, eNR_EKIN, homenr);
}
-void calc_ke_part(const rvec* x,
- const rvec* v,
- const matrix box,
- const t_grpopts* opts,
- const t_mdatoms* md,
- gmx_ekindata_t* ekind,
- t_nrnb* nrnb,
- gmx_bool bEkinAveVel)
+void calc_ke_part(ArrayRef<const RVec> x,
+ ArrayRef<const RVec> v,
+ const matrix box,
+ const t_grpopts* opts,
+ const t_mdatoms* md,
+ gmx_ekindata_t* ekind,
+ t_nrnb* nrnb,
+ gmx_bool bEkinAveVel)
{
if (ekind->cosacc.cos_accel == 0)
{
/* Return TRUE if OK, FALSE in case of Shake Error */
-void calc_ke_part(const rvec* x,
- const rvec* v,
- const matrix box,
- const t_grpopts* opts,
- const t_mdatoms* md,
- gmx_ekindata_t* ekind,
- t_nrnb* nrnb,
- gmx_bool bEkinAveVel);
+void calc_ke_part(gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ const matrix box,
+ const t_grpopts* opts,
+ const t_mdatoms* md,
+ gmx_ekindata_t* ekind,
+ t_nrnb* nrnb,
+ gmx_bool bEkinAveVel);
/*
* Compute the partial kinetic energy for home particles;
* will be accumulated in the calling routine.
}
/* Center of mass code for groups */
-void calc_vcm_grp(const t_mdatoms& md, const rvec x[], const rvec v[], t_vcm* vcm)
+void calc_vcm_grp(const t_mdatoms& md,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ t_vcm* vcm)
{
if (vcm->mode == ecmNO)
{
* \param[in] vcm VCM data
*/
template<int numDimensions>
-static void doStopComMotionLinear(const t_mdatoms& mdatoms, rvec* v, const t_vcm& vcm)
+static void doStopComMotionLinear(const t_mdatoms& mdatoms, gmx::ArrayRef<gmx::RVec> v, const t_vcm& vcm)
{
const int homenr = mdatoms.homenr;
const unsigned short* group_id = mdatoms.cVCM;
* \param[in] vcm VCM data
*/
template<int numDimensions>
-static void doStopComMotionAccelerationCorrection(int homenr,
- const unsigned short* group_id,
- rvec* gmx_restrict x,
- rvec* gmx_restrict v,
- const t_vcm& vcm)
+static void doStopComMotionAccelerationCorrection(int homenr,
+ const unsigned short* group_id,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<gmx::RVec> v,
+ const t_vcm& vcm)
{
const real xCorrectionFactor = 0.5 * vcm.timeStep;
}
}
-static void do_stopcm_grp(const t_mdatoms& mdatoms, rvec x[], rvec v[], const t_vcm& vcm)
+static void do_stopcm_grp(const t_mdatoms& mdatoms,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<gmx::RVec> v,
+ const t_vcm& vcm)
{
if (vcm.mode == ecmNO)
{
firstprivate(homenr)
{
if (vcm.mode == ecmLINEAR || vcm.mode == ecmANGULAR
- || (vcm.mode == ecmLINEAR_ACCELERATION_CORRECTION && x == nullptr))
+ || (vcm.mode == ecmLINEAR_ACCELERATION_CORRECTION && x.empty()))
{
/* Subtract linear momentum for v */
switch (vcm.ndim)
if (vcm.mode == ecmANGULAR)
{
/* Subtract angular momentum */
- GMX_ASSERT(x, "Need x to compute angular momentum correction");
+ GMX_ASSERT(!x.empty(), "Need x to compute angular momentum correction");
int g = 0;
#pragma omp for schedule(static)
}
}
-void process_and_stopcm_grp(FILE* fplog, t_vcm* vcm, const t_mdatoms& mdatoms, rvec x[], rvec v[])
+void process_and_stopcm_grp(FILE* fplog,
+ t_vcm* vcm,
+ const t_mdatoms& mdatoms,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<gmx::RVec> v)
{
if (vcm->mode != ecmNO)
{
struct t_inputrec;
struct t_mdatoms;
+namespace gmx
+{
+template<typename T>
+class ArrayRef;
+}
+
struct t_vcm_thread
{
//! Linear momentum
/* Do a per group center of mass things */
-void calc_vcm_grp(const t_mdatoms& md, const rvec x[], const rvec v[], t_vcm* vcm);
+void calc_vcm_grp(const t_mdatoms& md,
+ gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ArrayRef<const gmx::RVec> v,
+ t_vcm* vcm);
/* Set the COM velocity to zero and potentially correct the COM position.
*
* and a pointer to the coordinates at normal MD steps.
* When fplog != nullptr, a warning is printed to fplog with high COM velocity.
*/
-void process_and_stopcm_grp(FILE* fplog, t_vcm* vcm, const t_mdatoms& mdatoms, rvec x[], rvec v[]);
+void process_and_stopcm_grp(FILE* fplog,
+ t_vcm* vcm,
+ const t_mdatoms& mdatoms,
+ gmx::ArrayRef<gmx::RVec> x,
+ gmx::ArrayRef<gmx::RVec> v);
#endif
cglo_flags_iteration |= CGLO_STOPCM;
cglo_flags_iteration &= ~CGLO_TEMPERATURE;
}
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, nullptr, enerd,
- force_vir, shake_vir, total_vir, pres, constr, &nullSignaller, state->box,
- &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, nullptr, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &nullSignaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
cglo_flags_iteration
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
: 0));
/* At initialization, do not pass x with acceleration-correction mode
* to avoid (incorrect) correction of the initial coordinates.
*/
- rvec* xPtr = nullptr;
- if (vcm.mode != ecmLINEAR_ACCELERATION_CORRECTION)
- {
- xPtr = state->x.rvec_array();
- }
- process_and_stopcm_grp(fplog, &vcm, *mdatoms, xPtr, state->v.rvec_array());
+ auto x = (vcm.mode == ecmLINEAR_ACCELERATION_CORRECTION) ? ArrayRef<RVec>()
+ : makeArrayRef(state->x);
+ process_and_stopcm_grp(fplog, &vcm, *mdatoms, x, makeArrayRef(state->v));
inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
}
}
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global, &top,
- state->x.rvec_array(), state->box,
+ makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
if (ir->eI == eiVVAK)
{
kinetic energy calculation. This minimized excess variables, but
perhaps loses some logic?*/
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, nullptr, enerd,
- force_vir, shake_vir, total_vir, pres, constr, &nullSignaller, state->box,
- nullptr, &bSumEkinhOld, cglo_flags & ~CGLO_PRESSURE);
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, nullptr, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &nullSignaller, state->box, nullptr, &bSumEkinhOld, cglo_flags & ~CGLO_PRESSURE);
}
/* Calculate the initial half step temperature, and save the ekinh_old */
/* We need the kinetic energy at minus the half step for determining
* the full step kinetic energy and possibly for T-coupling.*/
/* This may not be quite working correctly yet . . . . */
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, wcycle, enerd,
- nullptr, nullptr, nullptr, nullptr, constr, &nullSignaller, state->box,
- &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, wcycle, enerd, nullptr, nullptr, nullptr, nullptr, constr,
+ &nullSignaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
CGLO_GSTAT | CGLO_TEMPERATURE | CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS);
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global,
- &top, state->x.rvec_array(), state->box,
+ &top, makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
}
clear_mat(force_vir);
if (bGStat || do_per_step(step - 1, nstglobalcomm))
{
wallcycle_stop(wcycle, ewcUPDATE);
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, wcycle,
- enerd, force_vir, shake_vir, total_vir, pres, constr, &nullSignaller,
- state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
- (bGStat ? CGLO_GSTAT : 0) | (bCalcEner ? CGLO_ENERGY : 0)
- | (bTemp ? CGLO_TEMPERATURE : 0) | (bPres ? CGLO_PRESSURE : 0)
- | (bPres ? CGLO_CONSTRAINT : 0) | (bStopCM ? CGLO_STOPCM : 0)
- | (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
- : 0)
- | CGLO_SCALEEKIN);
+ compute_globals(
+ gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, wcycle, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &nullSignaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ (bGStat ? CGLO_GSTAT : 0) | (bCalcEner ? CGLO_ENERGY : 0)
+ | (bTemp ? CGLO_TEMPERATURE : 0) | (bPres ? CGLO_PRESSURE : 0)
+ | (bPres ? CGLO_CONSTRAINT : 0) | (bStopCM ? CGLO_STOPCM : 0)
+ | (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
+ : 0)
+ | CGLO_SCALEEKIN);
/* explanation of above:
a) We compute Ekin at the full time step
if 1) we are using the AveVel Ekin, and it's not the
b) If we are using EkinAveEkin for the kinetic energy for the temperature control, we still feed in
EkinAveVel because it's needed for the pressure */
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions,
- top_global, &top, state->x.rvec_array(), state->box,
- &shouldCheckNumberOfBondedInteractions);
+ top_global, &top, makeConstArrayRef(state->x),
+ state->box, &shouldCheckNumberOfBondedInteractions);
if (bStopCM)
{
- process_and_stopcm_grp(fplog, &vcm, *mdatoms, state->x.rvec_array(),
- state->v.rvec_array());
+ process_and_stopcm_grp(fplog, &vcm, *mdatoms, makeArrayRef(state->x),
+ makeArrayRef(state->v));
inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
}
wallcycle_start(wcycle, ewcUPDATE);
/* We need the kinetic energy at minus the half step for determining
* the full step kinetic energy and possibly for T-coupling.*/
/* This may not be quite working correctly yet . . . . */
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(),
- state->v.rvec_array(), state->box, state->lambda[efptVDW],
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW],
mdatoms, nrnb, &vcm, wcycle, enerd, nullptr, nullptr, nullptr,
nullptr, constr, &nullSignaller, state->box, nullptr,
&bSumEkinhOld, CGLO_GSTAT | CGLO_TEMPERATURE);
{
/* erase F_EKIN and F_TEMP here? */
/* just compute the kinetic energy at the half step to perform a trotter step */
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, wcycle, enerd,
- force_vir, shake_vir, total_vir, pres, constr, &nullSignaller, lastbox,
- nullptr, &bSumEkinhOld, (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE);
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW],
+ mdatoms, nrnb, &vcm, wcycle, enerd, force_vir, shake_vir, total_vir,
+ pres, constr, &nullSignaller, lastbox, nullptr, &bSumEkinhOld,
+ (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE);
wallcycle_start(wcycle, ewcUPDATE);
trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ, trotter_seq, ettTSEQ4);
/* now we know the scaling, we can compute the positions again */
SimulationSignaller signaller(&signals, cr, ms, doInterSimSignal, doIntraSimSignal);
compute_globals(
- gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, &vcm, wcycle, enerd,
- force_vir, shake_vir, total_vir, pres, constr, &signaller, lastbox,
- &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, &vcm, wcycle, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &signaller, lastbox, &totalNumberOfBondedInteractions, &bSumEkinhOld,
(bGStat ? CGLO_GSTAT : 0) | (!EI_VV(ir->eI) && bCalcEner ? CGLO_ENERGY : 0)
| (!EI_VV(ir->eI) && bStopCM ? CGLO_STOPCM : 0)
| (!EI_VV(ir->eI) ? CGLO_TEMPERATURE : 0)
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
: 0));
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions,
- top_global, &top, state->x.rvec_array(), state->box,
- &shouldCheckNumberOfBondedInteractions);
+ top_global, &top, makeConstArrayRef(state->x),
+ state->box, &shouldCheckNumberOfBondedInteractions);
if (!EI_VV(ir->eI) && bStopCM)
{
- process_and_stopcm_grp(fplog, &vcm, *mdatoms, state->x.rvec_array(),
- state->v.rvec_array());
+ process_and_stopcm_grp(fplog, &vcm, *mdatoms, makeArrayRef(state->x),
+ makeArrayRef(state->v));
inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
// TODO: The special case of removing CM motion should be dealt more gracefully
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0));
bool bSumEkinhOld = false;
t_vcm* vcm = nullptr;
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, vcm, nullptr, enerd,
- force_vir, shake_vir, total_vir, pres, constr, &nullSignaller, state->box,
- &totalNumberOfBondedInteractions, &bSumEkinhOld, cglo_flags);
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms, nrnb,
+ vcm, nullptr, enerd, force_vir, shake_vir, total_vir, pres, constr, &nullSignaller,
+ state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld, cglo_flags);
}
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global, &top,
- state->x.rvec_array(), state->box,
+ makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
if (MASTER(cr))
t_vcm* vcm = nullptr;
SimulationSignaller signaller(&signals, cr, ms, doInterSimSignal, doIntraSimSignal);
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, vcm, wcycle, enerd,
- nullptr, nullptr, nullptr, nullptr, constr, &signaller, state->box,
- &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, vcm, wcycle, enerd, nullptr, nullptr, nullptr, nullptr, constr,
+ &signaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
CGLO_GSTAT | CGLO_ENERGY
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
: 0));
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global,
- &top, state->x.rvec_array(), state->box,
+ &top, makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
}
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0));
bool bSumEkinhOld = false;
t_vcm* vcm = nullptr;
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, vcm, nullptr, enerd,
- force_vir, shake_vir, total_vir, pres, constr, &nullSignaller, state->box,
- &totalNumberOfBondedInteractions, &bSumEkinhOld, cglo_flags);
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms, nrnb,
+ vcm, nullptr, enerd, force_vir, shake_vir, total_vir, pres, constr, &nullSignaller,
+ state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld, cglo_flags);
}
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global, &top,
- state->x.rvec_array(), state->box,
+ makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
if (MASTER(cr))
t_vcm* vcm = nullptr;
SimulationSignaller signaller(&signals, cr, ms, doInterSimSignal, doIntraSimSignal);
- compute_globals(gstat, cr, ir, fr, ekind, state->x.rvec_array(), state->v.rvec_array(),
- state->box, state->lambda[efptVDW], mdatoms, nrnb, vcm, wcycle, enerd,
- force_vir, shake_vir, total_vir, pres, constr, &signaller, state->box,
- &totalNumberOfBondedInteractions, &bSumEkinhOld,
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, state->lambda[efptVDW], mdatoms,
+ nrnb, vcm, wcycle, enerd, force_vir, shake_vir, total_vir, pres, constr,
+ &signaller, state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
CGLO_GSTAT | CGLO_ENERGY
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
: 0));
checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global,
- &top, state->x.rvec_array(), state->box,
+ &top, makeConstArrayRef(state->x), state->box,
&shouldCheckNumberOfBondedInteractions);
}
compute(-1, CGLO_GSTAT | CGLO_STOPCM, nullSignaller_.get(), false, true);
- auto v = as_rvec_array(statePropagatorData_->velocitiesView().paddedArrayRef().data());
+ auto v = statePropagatorData_->velocitiesView();
// At initialization, do not pass x with acceleration-correction mode
// to avoid (incorrect) correction of the initial coordinates.
- rvec* xPtr = nullptr;
- if (vcm_.mode != ecmLINEAR_ACCELERATION_CORRECTION)
- {
- xPtr = as_rvec_array(statePropagatorData_->positionsView().paddedArrayRef().data());
- }
- process_and_stopcm_grp(fplog_, &vcm_, *mdAtoms_->mdatoms(), xPtr, v);
+ auto x = vcm_.mode == ecmLINEAR_ACCELERATION_CORRECTION ? ArrayRefWithPadding<RVec>()
+ : statePropagatorData_->positionsView();
+ process_and_stopcm_grp(fplog_, &vcm_, *mdAtoms_->mdatoms(), x.unpaddedArrayRef(),
+ v.unpaddedArrayRef());
inc_nrnb(nrnb_, eNR_STOPCM, mdAtoms_->mdatoms()->homenr);
}
bool useLastBox,
bool isInit)
{
- auto x = as_rvec_array(statePropagatorData_->positionsView().paddedArrayRef().data());
- auto v = as_rvec_array(statePropagatorData_->velocitiesView().paddedArrayRef().data());
+ auto x = statePropagatorData_->positionsView().unpaddedArrayRef();
+ auto v = statePropagatorData_->velocitiesView().unpaddedArrayRef();
auto box = statePropagatorData_->constBox();
auto lastbox = useLastBox ? statePropagatorData_->constPreviousBox()
: statePropagatorData_->constBox();