for (int step = 0; step < numSteps; step++)
{
- testData->update_->update_coords(testData->inputRecord_,
- step,
- &testData->mdAtoms_,
- &testData->state_,
- testData->f_,
- testData->forceCalculationData_,
- &testData->kineticEnergyData_,
- testData->velocityScalingMatrix_,
- etrtNONE,
- nullptr,
- false);
+ testData->update_->update_coords(
+ testData->inputRecord_,
+ step,
+ testData->mdAtoms_.homenr,
+ testData->mdAtoms_.havePartiallyFrozenAtoms,
+ gmx::arrayRefFromArray(testData->mdAtoms_.ptype, testData->mdAtoms_.nr),
+ gmx::arrayRefFromArray(testData->mdAtoms_.invmass, testData->mdAtoms_.nr),
+ gmx::arrayRefFromArray(testData->mdAtoms_.invMassPerDim, testData->mdAtoms_.nr),
+ &testData->state_,
+ testData->f_,
+ testData->forceCalculationData_,
+ &testData->kineticEnergyData_,
+ testData->velocityScalingMatrix_,
+ etrtNONE,
+ nullptr,
+ false);
testData->update_->finish_update(
testData->inputRecord_, &testData->mdAtoms_, &testData->state_, nullptr, false);
}
bool havePartiallyFrozenAtoms,
gmx::ArrayRef<const ParticleType> ptype,
gmx::ArrayRef<const real> invMass,
- gmx::ArrayRef<rvec> invMassPerDim,
+ gmx::ArrayRef<const rvec> invMassPerDim,
t_state* state,
const gmx::ArrayRefWithPadding<const gmx::RVec>& f,
const t_fcdata& fcdata,
bool do_log,
bool do_ene);
- void update_for_constraint_virial(const t_inputrec& inputRecord,
- int homenr,
- bool havePartiallyFrozenAtoms,
- gmx::ArrayRef<real> invmass,
- gmx::ArrayRef<rvec> invMassPerDim,
- const t_state& state,
+ void update_for_constraint_virial(const t_inputrec& inputRecord,
+ int homenr,
+ bool havePartiallyFrozenAtoms,
+ gmx::ArrayRef<const real> invmass,
+ gmx::ArrayRef<const rvec> invMassPerDim,
+ const t_state& state,
const gmx::ArrayRefWithPadding<const gmx::RVec>& f,
const gmx_ekindata_t& ekind);
return impl_->deform();
}
-void Update::update_coords(const t_inputrec& inputRecord,
- int64_t step,
- const t_mdatoms* md,
- t_state* state,
+void Update::update_coords(const t_inputrec& inputRecord,
+ int64_t step,
+ const int homenr,
+ const bool havePartiallyFrozenAtoms,
+ gmx::ArrayRef<const ParticleType> ptype,
+ gmx::ArrayRef<const real> invMass,
+ gmx::ArrayRef<const rvec> invMassPerDim,
+ t_state* state,
const gmx::ArrayRefWithPadding<const gmx::RVec>& f,
const t_fcdata& fcdata,
const gmx_ekindata_t* ekind,
{
return impl_->update_coords(inputRecord,
step,
- md->homenr,
- md->havePartiallyFrozenAtoms,
- gmx::arrayRefFromArray(md->ptype, md->nr),
- gmx::arrayRefFromArray(md->invmass, md->nr),
- gmx::arrayRefFromArray(md->invMassPerDim, md->nr),
+ homenr,
+ havePartiallyFrozenAtoms,
+ ptype,
+ invMass,
+ invMassPerDim,
state,
f,
fcdata,
return impl_->finish_update(inputRecord, md, state, wcycle, haveConstraints);
}
-void Update::update_sd_second_half(const t_inputrec& inputRecord,
- int64_t step,
- real* dvdlambda,
- const t_mdatoms* md,
- t_state* state,
- const t_commrec* cr,
- t_nrnb* nrnb,
- gmx_wallcycle* wcycle,
- gmx::Constraints* constr,
- bool do_log,
- bool do_ene)
+void Update::update_sd_second_half(const t_inputrec& inputRecord,
+ int64_t step,
+ real* dvdlambda,
+ const int homenr,
+ gmx::ArrayRef<const ParticleType> ptype,
+ gmx::ArrayRef<const real> invMass,
+ t_state* state,
+ const t_commrec* cr,
+ t_nrnb* nrnb,
+ gmx_wallcycle* wcycle,
+ gmx::Constraints* constr,
+ bool do_log,
+ bool do_ene)
{
- return impl_->update_sd_second_half(inputRecord,
- step,
- dvdlambda,
- md->homenr,
- gmx::arrayRefFromArray(md->ptype, md->nr),
- gmx::arrayRefFromArray(md->invmass, md->nr),
- state,
- cr,
- nrnb,
- wcycle,
- constr,
- do_log,
- do_ene);
+ return impl_->update_sd_second_half(
+ inputRecord, step, dvdlambda, homenr, ptype, invMass, state, cr, nrnb, wcycle, constr, do_log, do_ene);
}
-void Update::update_for_constraint_virial(const t_inputrec& inputRecord,
- const t_mdatoms& md,
- const t_state& state,
+void Update::update_for_constraint_virial(const t_inputrec& inputRecord,
+ const int homenr,
+ const bool havePartiallyFrozenAtoms,
+ gmx::ArrayRef<const real> invmass,
+ gmx::ArrayRef<const rvec> invMassPerDim,
+ const t_state& state,
const gmx::ArrayRefWithPadding<const gmx::RVec>& f,
const gmx_ekindata_t& ekind)
{
- return impl_->update_for_constraint_virial(inputRecord,
- md.homenr,
- md.havePartiallyFrozenAtoms,
- gmx::arrayRefFromArray(md.invmass, md.nr),
- gmx::arrayRefFromArray(md.invMassPerDim, md.nr),
- state,
- f,
- ekind);
+ return impl_->update_for_constraint_virial(
+ inputRecord, homenr, havePartiallyFrozenAtoms, invmass, invMassPerDim, state, f, ekind);
}
void Update::update_temperature_constants(const t_inputrec& inputRecord)
rvec* gmx_restrict xprime,
const rvec* gmx_restrict v,
const rvec* gmx_restrict f,
- bool gmx_unused havePartiallyFrozenAtoms,
- gmx::ArrayRef<real> gmx_unused invmass,
- gmx::ArrayRef<rvec> invMassPerDim,
- const gmx_ekindata_t& ekind)
+ bool gmx_unused havePartiallyFrozenAtoms,
+ gmx::ArrayRef<const real> gmx_unused invmass,
+ gmx::ArrayRef<const rvec> invMassPerDim,
+ const gmx_ekindata_t& ekind)
{
GMX_ASSERT(nrend == start || xprime != x,
"For SIMD optimization certain compilers need to have xprime != x");
bool havePartiallyFrozenAtoms,
gmx::ArrayRef<const ParticleType> ptype,
gmx::ArrayRef<const real> invMass,
- gmx::ArrayRef<rvec> invMassPerDim,
+ gmx::ArrayRef<const rvec> invMassPerDim,
t_state* state,
const gmx::ArrayRefWithPadding<const gmx::RVec>& f,
const t_fcdata& fcdata,
}
}
-void Update::Impl::update_for_constraint_virial(const t_inputrec& inputRecord,
- int homenr,
- bool havePartiallyFrozenAtoms,
- gmx::ArrayRef<real> invmass,
- gmx::ArrayRef<rvec> invMassPerDim,
- const t_state& state,
+void Update::Impl::update_for_constraint_virial(const t_inputrec& inputRecord,
+ int homenr,
+ bool havePartiallyFrozenAtoms,
+ gmx::ArrayRef<const real> invmass,
+ gmx::ArrayRef<const rvec> invMassPerDim,
+ const t_state& state,
const gmx::ArrayRefWithPadding<const gmx::RVec>& f,
const gmx_ekindata_t& ekind)
{
struct t_mdatoms;
struct t_nrnb;
class t_state;
+enum class ParticleType;
namespace gmx
{
*
* Selects the appropriate integrator, based on the input record and performs a numerical integration step.
*
- * \param[in] inputRecord Input record.
- * \param[in] step Current timestep.
- * \param[in] md MD atoms data.
- * \param[in] state System state object.
- * \param[in] f Buffer with atomic forces for home particles.
- * \param[in] fcdata Force calculation data to update distance and orientation restraints.
- * \param[in] ekind Kinetic energy data (for temperature coupling, energy groups, etc.).
- * \param[in] M Parrinello-Rahman velocity scaling matrix.
- * \param[in] updatePart What should be updated, coordinates or velocities. This enum only used in VV integrator.
- * \param[in] cr Comunication record (Old comment: these shouldn't be here -- need to think about it).
- * \param[in] haveConstraints If the system has constraints.
+ * \param[in] inputRecord Input record.
+ * \param[in] step Current timestep.
+ * \param[in] homenr The number of atoms on this processor.
+ * \param[in] havePartiallyFrozenAtoms Whether atoms are frozen along 1 or 2 (not 3) dimensions?
+ * \param[in] ptype The list of particle types.
+ * \param[in] invMass Inverse atomic mass per atom, 0 for vsites and shells.
+ * \param[in] invMassPerDim Inverse atomic mass per atom and dimension, 0 for vsites, shells and frozen dimensions
+ * \param[in] state System state object.
+ * \param[in] f Buffer with atomic forces for home particles.
+ * \param[in] fcdata Force calculation data to update distance and orientation restraints.
+ * \param[in] ekind Kinetic energy data (for temperature coupling, energy groups, etc.).
+ * \param[in] M Parrinello-Rahman velocity scaling matrix.
+ * \param[in] updatePart What should be updated, coordinates or velocities. This enum only used in VV integrator.
+ * \param[in] cr Comunication record (Old comment: these shouldn't be here -- need to think about it).
+ * \param[in] haveConstraints If the system has constraints.
*/
void update_coords(const t_inputrec& inputRecord,
int64_t step,
- const t_mdatoms* md,
+ int homenr,
+ bool havePartiallyFrozenAtoms,
+ gmx::ArrayRef<const ParticleType> ptype,
+ gmx::ArrayRef<const real> invMass,
+ gmx::ArrayRef<const rvec> invMassPerDim,
t_state* state,
const gmx::ArrayRefWithPadding<const gmx::RVec>& f,
const t_fcdata& fcdata,
* \param[in] step Current timestep.
* \param[in] dvdlambda Free energy derivative. Contribution to be added to
* the bonded interactions.
- * \param[in] md MD atoms data.
+ * \param[in] homenr The number of atoms on this processor.
+ * \param[in] ptype The list of particle types.
+ * \param[in] invMass Inverse atomic mass per atom, 0 for vsites and shells.
* \param[in] state System state object.
* \param[in] cr Comunication record.
* \param[in] nrnb Cycle counters.
* \param[in] do_log If this is logging step.
* \param[in] do_ene If this is an energy evaluation step.
*/
- void update_sd_second_half(const t_inputrec& inputRecord,
- int64_t step,
- real* dvdlambda,
- const t_mdatoms* md,
- t_state* state,
- const t_commrec* cr,
- t_nrnb* nrnb,
- gmx_wallcycle* wcycle,
- gmx::Constraints* constr,
- bool do_log,
- bool do_ene);
+ void update_sd_second_half(const t_inputrec& inputRecord,
+ int64_t step,
+ real* dvdlambda,
+ int homenr,
+ gmx::ArrayRef<const ParticleType> ptype,
+ gmx::ArrayRef<const real> invMass,
+ t_state* state,
+ const t_commrec* cr,
+ t_nrnb* nrnb,
+ gmx_wallcycle* wcycle,
+ gmx::Constraints* constr,
+ bool do_log,
+ bool do_ene);
/*! \brief Performs a leap-frog update without updating \p state so the constrain virial
* can be computed.
*/
- void update_for_constraint_virial(const t_inputrec& inputRecord,
- const t_mdatoms& md,
- const t_state& state,
+ void update_for_constraint_virial(const t_inputrec& inputRecord,
+ int homenr,
+ bool havePartiallyFrozenAtoms,
+ gmx::ArrayRef<const real> invmass,
+ gmx::ArrayRef<const rvec> invMassPerDim,
+ const t_state& state,
const gmx::ArrayRefWithPadding<const gmx::RVec>& f,
const gmx_ekindata_t& ekind);
trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, MassQ, trotter_seq, ettTSEQ1);
}
- upd->update_coords(
- *ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind, M, etrtVELOCITY1, cr, constr != nullptr);
+ upd->update_coords(*ir,
+ step,
+ mdatoms->homenr,
+ mdatoms->havePartiallyFrozenAtoms,
+ gmx::arrayRefFromArray(mdatoms->ptype, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invMassPerDim, mdatoms->nr),
+ state,
+ f->view().forceWithPadding(),
+ fcdata,
+ ekind,
+ M,
+ etrtVELOCITY1,
+ cr,
+ constr != nullptr);
wallcycle_stop(wcycle, WallCycleCounter::Update);
constrain_velocities(constr, do_log, do_ene, step, state, nullptr, bCalcVir, shake_vir);
gmx_wallcycle* wcycle)
{
/* velocity half-step update */
- upd->update_coords(
- *ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind, M, etrtVELOCITY2, cr, constr != nullptr);
+ upd->update_coords(*ir,
+ step,
+ mdatoms->homenr,
+ mdatoms->havePartiallyFrozenAtoms,
+ gmx::arrayRefFromArray(mdatoms->ptype, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invMassPerDim, mdatoms->nr),
+ state,
+ f->view().forceWithPadding(),
+ fcdata,
+ ekind,
+ M,
+ etrtVELOCITY2,
+ cr,
+ constr != nullptr);
/* Above, initialize just copies ekinh into ekin,
updatePrevStepPullCom(pull_work, state);
}
- upd->update_coords(
- *ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind, M, etrtPOSITION, cr, constr != nullptr);
+ upd->update_coords(*ir,
+ step,
+ mdatoms->homenr,
+ mdatoms->havePartiallyFrozenAtoms,
+ gmx::arrayRefFromArray(mdatoms->ptype, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invMassPerDim, mdatoms->nr),
+ state,
+ f->view().forceWithPadding(),
+ fcdata,
+ ekind,
+ M,
+ etrtPOSITION,
+ cr,
+ constr != nullptr);
wallcycle_stop(wcycle, WallCycleCounter::Update);
constrain_coordinates(
constr, do_log, do_ene, step, state, upd->xp()->arrayRefWithPadding(), dvdl_constr, bCalcVir, shake_vir);
- upd->update_sd_second_half(
- *ir, step, dvdl_constr, mdatoms, state, cr, nrnb, wcycle, constr, do_log, do_ene);
+ upd->update_sd_second_half(*ir,
+ step,
+ dvdl_constr,
+ mdatoms->homenr,
+ gmx::arrayRefFromArray(mdatoms->ptype, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
+ state,
+ cr,
+ nrnb,
+ wcycle,
+ constr,
+ do_log,
+ do_ene);
upd->finish_update(*ir, mdatoms, state, wcycle, constr != nullptr);
if (ir->eI == IntegrationAlgorithm::VVAK)
/* now we know the scaling, we can compute the positions again */
std::copy(cbuf->begin(), cbuf->end(), state->x.begin());
- upd->update_coords(
- *ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind, M, etrtPOSITION, cr, constr != nullptr);
+ upd->update_coords(*ir,
+ step,
+ mdatoms->homenr,
+ mdatoms->havePartiallyFrozenAtoms,
+ gmx::arrayRefFromArray(mdatoms->ptype, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invMassPerDim, mdatoms->nr),
+ state,
+ f->view().forceWithPadding(),
+ fcdata,
+ ekind,
+ M,
+ etrtPOSITION,
+ cr,
+ constr != nullptr);
wallcycle_stop(wcycle, WallCycleCounter::Update);
/* do we need an extra constraint here? just need to copy out of as_rvec_array(state->v.data()) to upd->xp? */
if (fr->useMts && bCalcVir && constr != nullptr)
{
upd.update_for_constraint_virial(
- *ir, *mdatoms, *state, f.view().forceWithPadding(), *ekind);
+ *ir,
+ mdatoms->homenr,
+ mdatoms->havePartiallyFrozenAtoms,
+ gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
+ gmx::arrayRefFromArray(mdatoms->invMassPerDim, mdatoms->nr),
+ *state,
+ f.view().forceWithPadding(),
+ *ekind);
constrain_coordinates(constr,
do_log,
(fr->useMts && step % ir->mtsLevels[1].stepFactor == 0)
? f.view().forceMtsCombinedWithPadding()
: f.view().forceWithPadding();
- upd.update_coords(
- *ir, step, mdatoms, state, forceCombined, fcdata, ekind, M, etrtPOSITION, cr, constr != nullptr);
+ upd.update_coords(*ir,
+ step,
+ mdatoms->homenr,
+ mdatoms->havePartiallyFrozenAtoms,
+ gmx::arrayRefFromArray(md->ptype, md->nr),
+ gmx::arrayRefFromArray(md->invmass, md->nr),
+ gmx::arrayRefFromArray(md->invMassPerDim, md->nr),
+ state,
+ forceCombined,
+ fcdata,
+ ekind,
+ M,
+ etrtPOSITION,
+ cr,
+ constr != nullptr);
wallcycle_stop(wcycle, WallCycleCounter::Update);
bCalcVir && !fr->useMts,
shake_vir);
- upd.update_sd_second_half(
- *ir, step, &dvdl_constr, mdatoms, state, cr, nrnb, wcycle, constr, do_log, do_ene);
+ upd.update_sd_second_half(*ir,
+ step,
+ &dvdl_constr,
+ mdatoms->homenr,
+ gmx::arrayRefFromArray(md->ptype, md->nr),
+ gmx::arrayRefFromArray(md->invmass, md->nr),
+ state,
+ cr,
+ nrnb,
+ wcycle,
+ constr,
+ do_log,
+ do_ene);
upd.finish_update(*ir, mdatoms, state, wcycle, constr != nullptr);
}