return dd.comm->systemInfo.updateGroupingPerMoleculetype;
}
-void dd_store_state(gmx_domdec_t* dd, t_state* state)
+void dd_store_state(gmx_domdec_t& dd, t_state* state)
{
- if (state->ddp_count != dd->ddp_count)
+ if (state->ddp_count != dd.ddp_count)
{
gmx_incons("The MD state does not match the domain decomposition state");
}
- state->cg_gl.resize(dd->ncg_home);
- for (int i = 0; i < dd->ncg_home; i++)
+ state->cg_gl.resize(dd.ncg_home);
+ for (int i = 0; i < dd.ncg_home; i++)
{
- state->cg_gl[i] = dd->globalAtomGroupIndices[i];
+ state->cg_gl[i] = dd.globalAtomGroupIndices[i];
}
- state->ddp_count_cg_gl = dd->ddp_count;
+ state->ddp_count_cg_gl = dd.ddp_count;
}
gmx_domdec_zones_t* domdec_zones(gmx_domdec_t* dd)
return dd.comm->atomRanges.numHomeAtoms();
}
-int dd_natoms_mdatoms(const gmx_domdec_t* dd)
+int dd_natoms_mdatoms(const gmx_domdec_t& dd)
{
/* We currently set mdatoms entries for all atoms:
* local + non-local + communicated for vsite + constraints
*/
- return dd->comm->atomRanges.numAtomsTotal();
+ return dd.comm->atomRanges.numAtomsTotal();
}
-int dd_natoms_vsite(const gmx_domdec_t* dd)
+int dd_natoms_vsite(const gmx_domdec_t& dd)
{
- return dd->comm->atomRanges.end(DDAtomRanges::Type::Vsites);
+ return dd.comm->atomRanges.end(DDAtomRanges::Type::Vsites);
}
-void dd_get_constraint_range(const gmx_domdec_t* dd, int* at_start, int* at_end)
+void dd_get_constraint_range(const gmx_domdec_t& dd, int* at_start, int* at_end)
{
- *at_start = dd->comm->atomRanges.start(DDAtomRanges::Type::Constraints);
- *at_end = dd->comm->atomRanges.end(DDAtomRanges::Type::Constraints);
+ *at_start = dd.comm->atomRanges.start(DDAtomRanges::Type::Constraints);
+ *at_end = dd.comm->atomRanges.end(DDAtomRanges::Type::Constraints);
}
void dd_move_x(gmx_domdec_t* dd, const matrix box, gmx::ArrayRef<gmx::RVec> x, gmx_wallcycle* wcycle)
return pmeRanks;
}
-static int gmx_ddcoord2pmeindex(const t_commrec* cr, int x, int y, int z)
+static int gmx_ddcoord2pmeindex(const gmx_domdec_t& dd, int x, int y, int z)
{
ivec coords;
- gmx_domdec_t* dd = cr->dd;
- coords[XX] = x;
- coords[YY] = y;
- coords[ZZ] = z;
- const int slab = ddindex2pmeindex(dd->comm->ddRankSetup, dd_index(dd->numCells, coords));
+ coords[XX] = x;
+ coords[YY] = y;
+ coords[ZZ] = z;
+ const int slab = ddindex2pmeindex(dd.comm->ddRankSetup, dd_index(dd.numCells, coords));
return slab;
}
{
if (cr->dd->comm->ddRankSetup.usePmeOnlyRanks)
{
- nodeid = ddindex + gmx_ddcoord2pmeindex(cr, x, y, z);
+ nodeid = ddindex + gmx_ddcoord2pmeindex(*cr->dd, x, y, z);
}
else
{
else
{
/* The slab corresponds to the nodeid in the PME group */
- if (gmx_ddcoord2pmeindex(cr, x, y, z) == pmenodeid)
+ if (gmx_ddcoord2pmeindex(*cr->dd, x, y, z) == pmenodeid)
{
ddranks.push_back(ddcoord2simnodeid(cr, x, y, z));
}
set_slb_pme_dim_f(dd, ddpme->dim, &ddpme->slb_dim_f);
}
-int dd_pme_maxshift_x(const gmx_domdec_t* dd)
+int dd_pme_maxshift_x(const gmx_domdec_t& dd)
{
- const DDRankSetup& ddRankSetup = dd->comm->ddRankSetup;
+ const DDRankSetup& ddRankSetup = dd.comm->ddRankSetup;
if (ddRankSetup.ddpme[0].dim == XX)
{
}
}
-int dd_pme_maxshift_y(const gmx_domdec_t* dd)
+int dd_pme_maxshift_y(const gmx_domdec_t& dd)
{
- const DDRankSetup& ddRankSetup = dd->comm->ddRankSetup;
+ const DDRankSetup& ddRankSetup = dd.comm->ddRankSetup;
if (ddRankSetup.ddpme[0].dim == YY)
{
return dd.comm->systemInfo.moleculesAreAlwaysWhole;
}
-gmx_bool dd_bonded_molpbc(const gmx_domdec_t* dd, PbcType pbcType)
+bool dd_bonded_molpbc(const gmx_domdec_t& dd, PbcType pbcType)
{
/* If each molecule is a single charge group
* or we use domain decomposition for each periodic dimension,
* we do not need to take pbc into account for the bonded interactions.
*/
- return (pbcType != PbcType::No && dd->comm->systemInfo.haveInterDomainBondeds
- && !(dd->numCells[XX] > 1 && dd->numCells[YY] > 1
- && (dd->numCells[ZZ] > 1 || pbcType == PbcType::XY)));
+ return (pbcType != PbcType::No && dd.comm->systemInfo.haveInterDomainBondeds
+ && !(dd.numCells[XX] > 1 && dd.numCells[YY] > 1
+ && (dd.numCells[ZZ] > 1 || pbcType == PbcType::XY)));
}
/*! \brief Sets grid size limits and PP-PME setup, prints settings to log */
return TRUE;
}
-gmx_bool change_dd_cutoff(t_commrec* cr, const matrix box, gmx::ArrayRef<const gmx::RVec> x, real cutoffRequested)
+bool change_dd_cutoff(t_commrec* cr, const matrix box, gmx::ArrayRef<const gmx::RVec> x, real cutoffRequested)
{
bool bCutoffAllowed = test_dd_cutoff(cr, box, x, cutoffRequested);
*
* This means it can be reset, even after a new DD partitioning.
*/
-void dd_store_state(struct gmx_domdec_t* dd, t_state* state);
+void dd_store_state(struct gmx_domdec_t& dd, t_state* state);
/*! \brief Returns a pointer to the gmx_domdec_zones_t struct */
struct gmx_domdec_zones_t* domdec_zones(struct gmx_domdec_t* dd);
int dd_numHomeAtoms(const gmx_domdec_t& dd);
/*! \brief Returns the atom range in the local state for atoms that need to be present in mdatoms */
-int dd_natoms_mdatoms(const gmx_domdec_t* dd);
+int dd_natoms_mdatoms(const gmx_domdec_t& dd);
/*! \brief Returns the atom range in the local state for atoms involved in virtual sites */
-int dd_natoms_vsite(const gmx_domdec_t* dd);
+int dd_natoms_vsite(const gmx_domdec_t& dd);
/*! \brief Sets the atom range for atom in the local state for atoms received in constraints communication */
-void dd_get_constraint_range(const gmx_domdec_t* dd, int* at_start, int* at_end);
+void dd_get_constraint_range(const gmx_domdec_t& dd, int* at_start, int* at_end);
/*! \libinternal \brief Struct for passing around the number of PME domains */
struct NumPmeDomains
std::vector<int> get_pme_ddranks(const t_commrec* cr, int pmenodeid);
/*! \brief Returns the maximum shift for coordinate communication in PME, dim x */
-int dd_pme_maxshift_x(const gmx_domdec_t* dd);
+int dd_pme_maxshift_x(const gmx_domdec_t& dd);
/*! \brief Returns the maximum shift for coordinate communication in PME, dim y */
-int dd_pme_maxshift_y(const gmx_domdec_t* dd);
+int dd_pme_maxshift_y(const gmx_domdec_t& dd);
/*! \brief Return whether constraints, not including settles, cross domain boundaries */
bool ddHaveSplitConstraints(const gmx_domdec_t& dd);
bool dd_moleculesAreAlwaysWhole(const gmx_domdec_t& dd);
/*! \brief Returns if we need to do pbc for calculating bonded interactions */
-gmx_bool dd_bonded_molpbc(const gmx_domdec_t* dd, PbcType pbcType);
+bool dd_bonded_molpbc(const gmx_domdec_t& dd, PbcType pbcType);
/*! \brief Change the DD non-bonded communication cut-off.
*
* \param[in] x Position vector, used for computing the dimensions of the system
* \param[in] cutoffRequested The requested atom to atom cut-off distance, usually the pair-list cutoff distance
*/
-gmx_bool change_dd_cutoff(t_commrec* cr, const matrix box, gmx::ArrayRef<const gmx::RVec> x, real cutoffRequested);
+bool change_dd_cutoff(t_commrec* cr, const matrix box, gmx::ArrayRef<const gmx::RVec> x, real cutoffRequested);
/*! \brief Set up communication for averaging GPU wait times over domains
*
const matrix box,
gmx::ArrayRef<gmx::RVec> x0,
gmx::ArrayRef<gmx::RVec> x1,
- gmx_bool bX1IsCoord);
+ bool bX1IsCoord);
/*! \brief Communicates the coordinates involved in virtual sites */
void dd_move_x_vsites(const gmx_domdec_t& dd, const matrix box, rvec* x);
gmx_localtop_t* ltop);
/*! \brief Sort ltop->ilist when we are doing free energy. */
-void dd_sort_local_top(gmx_domdec_t* dd, const t_mdatoms* mdatoms, gmx_localtop_t* ltop);
+void dd_sort_local_top(gmx_domdec_t& dd, const t_mdatoms* mdatoms, gmx_localtop_t* ltop);
/*! \brief Construct local state */
-void dd_init_local_state(struct gmx_domdec_t* dd, const t_state* state_global, t_state* local_state);
+void dd_init_local_state(gmx_domdec_t& dd, const t_state* state_global, t_state* local_state);
/*! \brief Generate a list of links between atoms that are linked by bonded interactions
*
const matrix box,
gmx::ArrayRef<gmx::RVec> x0,
gmx::ArrayRef<gmx::RVec> x1,
- gmx_bool bX1IsCoord)
+ bool bX1IsCoord)
{
if (dd->constraint_comm)
{
ltop->idef.ilsort = ilsortUNKNOWN;
}
-void dd_sort_local_top(gmx_domdec_t* dd, const t_mdatoms* mdatoms, gmx_localtop_t* ltop)
+void dd_sort_local_top(gmx_domdec_t& dd, const t_mdatoms* mdatoms, gmx_localtop_t* ltop)
{
- if (dd->reverse_top->impl_->ilsort == ilsortNO_FE)
+ if (dd.reverse_top->impl_->ilsort == ilsortNO_FE)
{
ltop->idef.ilsort = ilsortNO_FE;
}
}
}
-void dd_init_local_state(gmx_domdec_t* dd, const t_state* state_global, t_state* state_local)
+void dd_init_local_state(gmx_domdec_t& dd, const t_state* state_global, t_state* state_local)
{
int buf[NITEM_DD_INIT_LOCAL_STATE];
buf[3] = state_global->nhchainlength;
buf[4] = state_global->dfhist ? state_global->dfhist->nlambda : 0;
}
- dd_bcast(dd, NITEM_DD_INIT_LOCAL_STATE * sizeof(int), buf);
+ dd_bcast(&dd, NITEM_DD_INIT_LOCAL_STATE * sizeof(int), buf);
init_gtc_state(state_local, buf[1], buf[2], buf[3]);
init_dfhist_state(state_local, buf[4]);
if (usingDomDec)
{
- numAtomIndex = dd_natoms_mdatoms(cr->dd);
+ numAtomIndex = dd_natoms_mdatoms(*cr->dd);
numHomeAtoms = dd_numHomeAtoms(*cr->dd);
- numTotalAtoms = dd_natoms_mdatoms(cr->dd);
+ numTotalAtoms = dd_natoms_mdatoms(*cr->dd);
}
else
{
auto mdatoms = mdAtoms->mdatoms();
if (usingDomDec)
{
- dd_sort_local_top(cr->dd, mdatoms, top);
+ dd_sort_local_top(*cr->dd, mdatoms, top);
}
else
{
mdatoms->sqrt_c6B,
mdatoms->sigmaA,
mdatoms->sigmaB,
- dd_pme_maxshift_x(dd),
- dd_pme_maxshift_y(dd));
+ dd_pme_maxshift_x(*dd),
+ dd_pme_maxshift_y(*dd));
}
if (dd->atomSets != nullptr)
}
//! Clears constraint quantities for atoms in nonlocal region.
-static void clear_constraint_quantity_nonlocal(gmx_domdec_t* dd, ArrayRef<RVec> q)
+static void clear_constraint_quantity_nonlocal(gmx_domdec_t& dd, ArrayRef<RVec> q)
{
int nonlocal_at_start, nonlocal_at_end, at;
if (DOMAINDECOMP(cr))
{
dd = cr->dd;
- dd_get_constraint_range(dd, &dd_ac0, &dd_ac1);
+ dd_get_constraint_range(*dd, &dd_ac0, &dd_ac1);
start = 0;
homenr = dd_ac1;
}
* We never actually use these values, but we do increment them,
* so we should avoid uninitialized variables and overflows.
*/
- clear_constraint_quantity_nonlocal(cr->dd, v.unpaddedArrayRef());
+ clear_constraint_quantity_nonlocal(*cr->dd, v.unpaddedArrayRef());
}
}
md->sigmaB,
box,
cr,
- DOMAINDECOMP(cr) ? dd_pme_maxshift_x(cr->dd) : 0,
- DOMAINDECOMP(cr) ? dd_pme_maxshift_y(cr->dd) : 0,
+ DOMAINDECOMP(cr) ? dd_pme_maxshift_x(*cr->dd) : 0,
+ DOMAINDECOMP(cr) ? dd_pme_maxshift_y(*cr->dd) : 0,
nrnb,
wcycle,
ewaldOutput.vir_q,
}
else
{
- forcerec->bMolPBC = dd_bonded_molpbc(commrec->dd, forcerec->pbcType);
+ forcerec->bMolPBC = dd_bonded_molpbc(*commrec->dd, forcerec->pbcType);
/* With Ewald surface correction it is useful to support e.g. running water
* in parallel with update groups.
{
int start;
- dd_get_constraint_range(cr->dd, &start, &natoms);
+ dd_get_constraint_range(*cr->dd, &start, &natoms);
}
else
{
{
stateInstance = std::make_unique<t_state>();
state = stateInstance.get();
- dd_init_local_state(cr->dd, state_global, state);
+ dd_init_local_state(*cr->dd, state_global, state);
/* Distribute the charge groups over the nodes from the master node */
dd_partition_system(fplog,
{
stateInstance = std::make_unique<t_state>();
state = stateInstance.get();
- dd_init_local_state(cr->dd, state_global, state);
+ dd_init_local_state(*cr->dd, state_global, state);
/* Distribute the charge groups over the nodes from the master node */
dd_partition_system(fplog,
if (DOMAINDECOMP(cr))
{
- dd_init_local_state(cr->dd, state_global, &ems->s);
+ dd_init_local_state(*cr->dd, state_global, &ems->s);
/* Distribute the charge groups over the nodes from the master node */
dd_partition_system(fplog,
nrnb,
nullptr,
FALSE);
- dd_store_state(cr->dd, &ems->s);
+ dd_store_state(*cr->dd, &ems->s);
}
else
{
nrnb,
wcycle,
FALSE);
- dd_store_state(cr->dd, &ems->s);
+ dd_store_state(*cr->dd, &ems->s);
}
namespace
{
stateInstance = std::make_unique<t_state>();
state = stateInstance.get();
- dd_init_local_state(cr->dd, state_global, state);
+ dd_init_local_state(*cr->dd, state_global, state);
/* Distribute the charge groups over the nodes from the master node */
dd_partition_system(fplog,
if (DOMAINDECOMP(cr))
{
- nat = dd_natoms_vsite(cr->dd);
+ nat = dd_natoms_vsite(*cr->dd);
if (nflexcon > 0)
{
- dd_get_constraint_range(cr->dd, &dd_ac0, &dd_ac1);
+ dd_get_constraint_range(*cr->dd, &dd_ac0, &dd_ac1);
nat = std::max(nat, dd_ac1);
}
}
if (DOMAINDECOMP(cr))
{
auto localState = std::make_unique<t_state>();
- dd_init_local_state(cr->dd, globalState, localState.get());
+ dd_init_local_state(*cr->dd, globalState, localState.get());
stateHasVelocities = ((localState->flags & enumValueToBitMask(StateEntry::V)) != 0);
setLocalState(std::move(localState));
}