real dt,
const matrix pres,
const matrix box,
- real scalar_pressure,
- real xy_pressure,
+ real scalar_pressure,
+ real xy_pressure,
int64_t gmx_unused step)
{
real p_corr_z = 0;
gmx::ArrayRef<const real> invMass,
const t_extmass* MassQ,
gmx::ArrayRef<std::vector<int>> trotter_seqlist,
- int trotter_seqno)
+ TrotterSequence trotter_seqno)
{
int n, i, d, ngtc, gc = 0, t;
rvec sumv = { 0, 0, 0 };
bool bCouple;
- if (trotter_seqno <= ettTSEQ2)
+ if (trotter_seqno <= TrotterSequence::Two)
{
step_eff = step - 1; /* the velocity verlet calls are actually out of order -- the first
half step is actually the last half step from the previous step.
bCouple = (ir->nsttcouple == 1 || do_per_step(step_eff + ir->nsttcouple, ir->nsttcouple));
- const gmx::ArrayRef<const int> trotter_seq = trotter_seqlist[trotter_seqno];
+ const gmx::ArrayRef<const int> trotter_seq = trotter_seqlist[static_cast<int>(trotter_seqno)];
if ((trotter_seq[0] == etrtSKIPALL) || (!bCouple))
{
}
}
-std::array<std::vector<int>, ettTSEQMAX>
+gmx::EnumerationArray<TrotterSequence, std::vector<int>>
init_npt_vars(const t_inputrec* ir, t_state* state, t_extmass* MassQ, bool bTrotter)
{
int i, j, nnhpres, nh;
init_npt_masses(ir, state, MassQ, TRUE);
/* first, initialize clear all the trotter calls */
- std::array<std::vector<int>, ettTSEQMAX> trotter_seq;
- for (i = 0; i < ettTSEQMAX; i++)
+ gmx::EnumerationArray<TrotterSequence, std::vector<int>> trotter_seq;
+ for (i = 0; i < static_cast<int>(TrotterSequence::Count); i++)
{
trotter_seq[i].resize(NTROTTERPARTS, etrtNONE);
trotter_seq[i][0] = etrtSKIPALL;
#include "gromacs/math/vectypes.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/real.h"
class gmx_ekindata_t;
gmx::ArrayRef<const real> invMass,
const t_extmass* MassQ,
gmx::ArrayRef<std::vector<int>> trotter_seqlist,
- int trotter_seqno);
+ TrotterSequence trotter_seqno);
-std::array<std::vector<int>, ettTSEQMAX>
+gmx::EnumerationArray<TrotterSequence, std::vector<int>>
init_npt_vars(const t_inputrec* ir, t_state* state, t_extmass* Mass, bool bTrotter);
real NPT_energy(const t_inputrec* ir, const t_state* state, const t_extmass* MassQ);
#include "gromacs/timing/wallcycle.h"
#include "gromacs/topology/topology.h"
-void integrateVVFirstStep(int64_t step,
- bool bFirstStep,
- bool bInitStep,
- gmx::StartingBehavior startingBehavior,
- int nstglobalcomm,
- const t_inputrec* ir,
- t_forcerec* fr,
- t_commrec* cr,
- t_state* state,
- t_mdatoms* mdatoms,
- const t_fcdata& fcdata,
- t_extmass* MassQ,
- t_vcm* vcm,
- const gmx_mtop_t& top_global,
- const gmx_localtop_t& top,
- gmx_enerdata_t* enerd,
- gmx_ekindata_t* ekind,
- gmx_global_stat* gstat,
- real* last_ekin,
- bool bCalcVir,
- tensor total_vir,
- tensor shake_vir,
- tensor force_vir,
- tensor pres,
- matrix M,
- bool do_log,
- bool do_ene,
- bool bCalcEner,
- bool bGStat,
- bool bStopCM,
- bool bTrotter,
- bool bExchanged,
- bool* bSumEkinhOld,
- real* saved_conserved_quantity,
- gmx::ForceBuffers* f,
- gmx::Update* upd,
- gmx::Constraints* constr,
- gmx::SimulationSignaller* nullSignaller,
- std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
- t_nrnb* nrnb,
- const gmx::MDLogger& mdlog,
- FILE* fplog,
- gmx_wallcycle* wcycle)
+void integrateVVFirstStep(int64_t step,
+ bool bFirstStep,
+ bool bInitStep,
+ gmx::StartingBehavior startingBehavior,
+ int nstglobalcomm,
+ const t_inputrec* ir,
+ t_forcerec* fr,
+ t_commrec* cr,
+ t_state* state,
+ t_mdatoms* mdatoms,
+ const t_fcdata& fcdata,
+ t_extmass* MassQ,
+ t_vcm* vcm,
+ const gmx_mtop_t& top_global,
+ const gmx_localtop_t& top,
+ gmx_enerdata_t* enerd,
+ gmx_ekindata_t* ekind,
+ gmx_global_stat* gstat,
+ real* last_ekin,
+ bool bCalcVir,
+ tensor total_vir,
+ tensor shake_vir,
+ tensor force_vir,
+ tensor pres,
+ matrix M,
+ bool do_log,
+ bool do_ene,
+ bool bCalcEner,
+ bool bGStat,
+ bool bStopCM,
+ bool bTrotter,
+ bool bExchanged,
+ bool* bSumEkinhOld,
+ real* saved_conserved_quantity,
+ gmx::ForceBuffers* f,
+ gmx::Update* upd,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* nullSignaller,
+ gmx::EnumerationArray<TrotterSequence, std::vector<int>> trotter_seq,
+ t_nrnb* nrnb,
+ const gmx::MDLogger& mdlog,
+ FILE* fplog,
+ gmx_wallcycle* wcycle)
{
if (!bFirstStep || startingBehavior == gmx::StartingBehavior::NewSimulation)
{
gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
MassQ,
trotter_seq,
- ettTSEQ1);
+ TrotterSequence::One);
}
upd->update_coords(*ir,
gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
MassQ,
trotter_seq,
- ettTSEQ2);
+ TrotterSequence::Two);
/* TODO This is only needed when we're about to write
* a checkpoint, because we use it after the restart
}
}
-void integrateVVSecondStep(int64_t step,
- const t_inputrec* ir,
- t_forcerec* fr,
- t_commrec* cr,
- t_state* state,
- t_mdatoms* mdatoms,
- const t_fcdata& fcdata,
- t_extmass* MassQ,
- t_vcm* vcm,
- pull_t* pull_work,
- gmx_enerdata_t* enerd,
- gmx_ekindata_t* ekind,
- gmx_global_stat* gstat,
- real* dvdl_constr,
- bool bCalcVir,
- tensor total_vir,
- tensor shake_vir,
- tensor force_vir,
- tensor pres,
- matrix M,
- matrix lastbox,
- bool do_log,
- bool do_ene,
- bool bGStat,
- bool* bSumEkinhOld,
- gmx::ForceBuffers* f,
- std::vector<gmx::RVec>* cbuf,
- gmx::Update* upd,
- gmx::Constraints* constr,
- gmx::SimulationSignaller* nullSignaller,
- std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
- t_nrnb* nrnb,
- gmx_wallcycle* wcycle)
+void integrateVVSecondStep(int64_t step,
+ const t_inputrec* ir,
+ t_forcerec* fr,
+ t_commrec* cr,
+ t_state* state,
+ t_mdatoms* mdatoms,
+ const t_fcdata& fcdata,
+ t_extmass* MassQ,
+ t_vcm* vcm,
+ pull_t* pull_work,
+ gmx_enerdata_t* enerd,
+ gmx_ekindata_t* ekind,
+ gmx_global_stat* gstat,
+ real* dvdl_constr,
+ bool bCalcVir,
+ tensor total_vir,
+ tensor shake_vir,
+ tensor force_vir,
+ tensor pres,
+ matrix M,
+ matrix lastbox,
+ bool do_log,
+ bool do_ene,
+ bool bGStat,
+ bool* bSumEkinhOld,
+ gmx::ForceBuffers* f,
+ std::vector<gmx::RVec>* cbuf,
+ gmx::Update* upd,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* nullSignaller,
+ gmx::EnumerationArray<TrotterSequence, std::vector<int>> trotter_seq,
+ t_nrnb* nrnb,
+ gmx_wallcycle* wcycle)
{
/* velocity half-step update */
upd->update_coords(*ir,
gmx::arrayRefFromArray(mdatoms->invmass, mdatoms->nr),
MassQ,
trotter_seq,
- ettTSEQ4);
+ TrotterSequence::Four);
/* now we know the scaling, we can compute the positions again */
std::copy(cbuf->begin(), cbuf->end(), state->x.begin());
#include "gromacs/math/vectypes.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/utility/enumerationhelpers.h"
class gmx_ekindata_t;
struct gmx_enerdata_t;
* \param[in] fplog Another logger.
* \param[in] wcycle Wall-clock cycle counter.
*/
-void integrateVVFirstStep(int64_t step,
- bool bFirstStep,
- bool bInitStep,
- gmx::StartingBehavior startingBehavior,
- int nstglobalcomm,
- const t_inputrec* ir,
- t_forcerec* fr,
- t_commrec* cr,
- t_state* state,
- t_mdatoms* mdatoms,
- const t_fcdata& fcdata,
- t_extmass* MassQ,
- t_vcm* vcm,
- const gmx_mtop_t& top_global,
- const gmx_localtop_t& top,
- gmx_enerdata_t* enerd,
- gmx_ekindata_t* ekind,
- gmx_global_stat* gstat,
- real* last_ekin,
- bool bCalcVir,
- tensor total_vir,
- tensor shake_vir,
- tensor force_vir,
- tensor pres,
- matrix M,
- bool do_log,
- bool do_ene,
- bool bCalcEner,
- bool bGStat,
- bool bStopCM,
- bool bTrotter,
- bool bExchanged,
- bool* bSumEkinhOld,
- real* saved_conserved_quantity,
- gmx::ForceBuffers* f,
- gmx::Update* upd,
- gmx::Constraints* constr,
- gmx::SimulationSignaller* nullSignaller,
- std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
- t_nrnb* nrnb,
- const gmx::MDLogger& mdlog,
- FILE* fplog,
- gmx_wallcycle* wcycle);
+void integrateVVFirstStep(int64_t step,
+ bool bFirstStep,
+ bool bInitStep,
+ gmx::StartingBehavior startingBehavior,
+ int nstglobalcomm,
+ const t_inputrec* ir,
+ t_forcerec* fr,
+ t_commrec* cr,
+ t_state* state,
+ t_mdatoms* mdatoms,
+ const t_fcdata& fcdata,
+ t_extmass* MassQ,
+ t_vcm* vcm,
+ const gmx_mtop_t& top_global,
+ const gmx_localtop_t& top,
+ gmx_enerdata_t* enerd,
+ gmx_ekindata_t* ekind,
+ gmx_global_stat* gstat,
+ real* last_ekin,
+ bool bCalcVir,
+ tensor total_vir,
+ tensor shake_vir,
+ tensor force_vir,
+ tensor pres,
+ matrix M,
+ bool do_log,
+ bool do_ene,
+ bool bCalcEner,
+ bool bGStat,
+ bool bStopCM,
+ bool bTrotter,
+ bool bExchanged,
+ bool* bSumEkinhOld,
+ real* saved_conserved_quantity,
+ gmx::ForceBuffers* f,
+ gmx::Update* upd,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* nullSignaller,
+ gmx::EnumerationArray<TrotterSequence, std::vector<int>> trotter_seq,
+ t_nrnb* nrnb,
+ const gmx::MDLogger& mdlog,
+ FILE* fplog,
+ gmx_wallcycle* wcycle);
/*! \brief Make the second step of Velocity Verlet integration
* \param[in] nrnb Cycle counters.
* \param[in] wcycle Wall-clock cycle counter.
*/
-void integrateVVSecondStep(int64_t step,
- const t_inputrec* ir,
- t_forcerec* fr,
- t_commrec* cr,
- t_state* state,
- t_mdatoms* mdatoms,
- const t_fcdata& fcdata,
- t_extmass* MassQ,
- t_vcm* vcm,
- pull_t* pull_work,
- gmx_enerdata_t* enerd,
- gmx_ekindata_t* ekind,
- gmx_global_stat* gstat,
- real* dvdl_constr,
- bool bCalcVir,
- tensor total_vir,
- tensor shake_vir,
- tensor force_vir,
- tensor pres,
- matrix M,
- matrix lastbox,
- bool do_log,
- bool do_ene,
- bool bGStat,
- bool* bSumEkinhOld,
- gmx::ForceBuffers* f,
- std::vector<gmx::RVec>* cbuf,
- gmx::Update* upd,
- gmx::Constraints* constr,
- gmx::SimulationSignaller* nullSignaller,
- std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
- t_nrnb* nrnb,
- gmx_wallcycle* wcycle);
+void integrateVVSecondStep(int64_t step,
+ const t_inputrec* ir,
+ t_forcerec* fr,
+ t_commrec* cr,
+ t_state* state,
+ t_mdatoms* mdatoms,
+ const t_fcdata& fcdata,
+ t_extmass* MassQ,
+ t_vcm* vcm,
+ pull_t* pull_work,
+ gmx_enerdata_t* enerd,
+ gmx_ekindata_t* ekind,
+ gmx_global_stat* gstat,
+ real* dvdl_constr,
+ bool bCalcVir,
+ tensor total_vir,
+ tensor shake_vir,
+ tensor force_vir,
+ tensor pres,
+ matrix M,
+ matrix lastbox,
+ bool do_log,
+ bool do_ene,
+ bool bGStat,
+ bool* bSumEkinhOld,
+ gmx::ForceBuffers* f,
+ std::vector<gmx::RVec>* cbuf,
+ gmx::Update* upd,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* nullSignaller,
+ gmx::EnumerationArray<TrotterSequence, std::vector<int>> trotter_seq,
+ t_nrnb* nrnb,
+ gmx_wallcycle* wcycle);
#endif // GMX_MDLIB_UPDATE_VV_H
ForceBuffers f(fr->useMts,
((useGpuForNonbonded && useGpuForBufferOps) || useGpuForUpdate)
- ? PinningPolicy::PinnedIfSupported
- : PinningPolicy::CannotBePinned);
+ ? PinningPolicy::PinnedIfSupported
+ : PinningPolicy::CannotBePinned);
const t_mdatoms* md = mdAtoms->mdatoms();
if (DOMAINDECOMP(cr))
{
state->v.rvec_array(),
md->homenr,
md->cTC ? gmx::arrayRefFromArray(md->cTC, md->nr)
- : gmx::ArrayRef<const unsigned short>());
+ : gmx::ArrayRef<const unsigned short>());
/* history is maintained in state->dfhist, but state_global is what is sent to trajectory and log output */
if (MASTER(cr))
{
gmx::arrayRefFromArray(md->invmass, md->nr),
&MassQ,
trotter_seq,
- ettTSEQ3);
+ TrotterSequence::Three);
/* We can only do Berendsen coupling after we have summed
* the kinetic energy or virial. Since the happens
* in global_state after update, we should only do it at
};
//! Sequenced parts of the trotter decomposition.
-enum
+enum class TrotterSequence : int
{
- ettTSEQ0,
- ettTSEQ1,
- ettTSEQ2,
- ettTSEQ3,
- ettTSEQ4,
- ettTSEQMAX
+ Zero,
+ One,
+ Two,
+ Three,
+ Four,
+ Count
};
//! Pressure coupling type