#include "gromacs/domdec/ga2la.h"
#include "gromacs/domdec/localatomsetmanager.h"
#include "gromacs/domdec/mdsetup.h"
-#include "gromacs/ewald/pme.h"
+#include "gromacs/ewald/pme_pp.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/imd/imd.h"
#include "gromacs/mdtypes/forcerec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/md_enums.h"
+#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/mdtypes/nblist.h"
#include "gromacs/mdtypes/state.h"
#include "gromacs/nbnxm/nbnxm.h"
if (applyPbc)
{
/* Take the minimum to avoid double communication */
- numPulsesMin = std::min(numPulses, dd->nc[dim] - 1 - numPulses);
+ numPulsesMin = std::min(numPulses, dd->numCells[dim] - 1 - numPulses);
}
else
{
for (int pulse = 0; pulse < numPulses; pulse++)
{
/* Communicate all the zone information backward */
- bool receiveValidData = (applyPbc || dd->ci[dim] < dd->nc[dim] - 1);
+ bool receiveValidData = (applyPbc || dd->ci[dim] < dd->numCells[dim] - 1);
static_assert(
sizeof(gmx_ddzone_t) == c_ddzoneNumReals * sizeof(real),
*/
buf_s[i] = buf_r[i];
}
- if (((applyPbc || dd->ci[dim] + numPulses < dd->nc[dim]) && pulse == numPulses - 1)
- || (!applyPbc && dd->ci[dim] + 1 + pulse == dd->nc[dim] - 1))
+ if (((applyPbc || dd->ci[dim] + numPulses < dd->numCells[dim]) && pulse == numPulses - 1)
+ || (!applyPbc && dd->ci[dim] + 1 + pulse == dd->numCells[dim] - 1))
{
/* Store the extremes */
int pos = 0;
{
if (fr != nullptr)
{
- const cginfo_mb_t* cginfo_mb = fr->cginfo_mb;
- gmx::ArrayRef<int> cginfo = fr->cginfo;
+ gmx::ArrayRef<cginfo_mb_t> cginfo_mb = fr->cginfo_mb;
+ gmx::ArrayRef<int> cginfo = fr->cginfo;
for (int cg = cg0; cg < cg1; cg++)
{
dim = dd->dim[dim_ind];
/* Without PBC we don't have restrictions on the outer cells */
- if (!(dim >= ddbox->npbcdim && (dd->ci[dim] == 0 || dd->ci[dim] == dd->nc[dim] - 1))
+ if (!(dim >= ddbox->npbcdim && (dd->ci[dim] == 0 || dd->ci[dim] == dd->numCells[dim] - 1))
&& isDlbOn(comm)
&& (comm->cell_x1[dim] - comm->cell_x0[dim]) * ddbox->skew_fac[dim] < comm->cellsize_min[dim])
{
load->mdf = 0;
load->pme = 0;
int pos = 0;
- for (int i = 0; i < dd->nc[dim]; i++)
+ for (int i = 0; i < dd->numCells[dim]; i++)
{
load->sum += load->load[pos++];
load->max = std::max(load->max, load->load[pos]);
}
if (isDlbOn(comm) && rowMaster->dlbIsLimited)
{
- load->sum_m *= dd->nc[dim];
+ load->sum_m *= dd->numCells[dim];
load->flags |= (1 << d);
}
}
{
comm->load[d].sum_m = comm->load[d].sum;
- int nc = dd->nc[dd->dim[d]];
+ int nc = dd->numCells[dd->dim[d]];
for (int i = 0; i < nc; i++)
{
rowMaster->cellFrac[i] = i / static_cast<real>(nc);
const int* recv_i,
gmx::ArrayRef<gmx::RVec> x,
gmx::ArrayRef<const gmx::RVec> recv_vr,
- cginfo_mb_t* cginfo_mb,
+ gmx::ArrayRef<cginfo_mb_t> cginfo_mb,
gmx::ArrayRef<int> cginfo)
{
gmx_domdec_ind_t *ind, *ind_p;
}
//! Prepare DD communication.
-static void setup_dd_communication(gmx_domdec_t* dd,
- matrix box,
- gmx_ddbox_t* ddbox,
- t_forcerec* fr,
- t_state* state,
- PaddedHostVector<gmx::RVec>* f)
+static void setup_dd_communication(gmx_domdec_t* dd, matrix box, gmx_ddbox_t* ddbox, t_forcerec* fr, t_state* state)
{
int dim_ind, dim, dim0, dim1, dim2, dimd, nat_tot;
int nzone, nzone_send, zone, zonei, cg0, cg1;
gmx_domdec_comm_t* comm;
gmx_domdec_zones_t* zones;
gmx_domdec_comm_dim_t* cd;
- cginfo_mb_t* cginfo_mb;
gmx_bool bBondComm, bDist2B, bDistMB, bDistBonded;
dd_corners_t corners;
rvec * normal, *v_d, *v_0 = nullptr, *v_1 = nullptr;
v_1 = ddbox->v[dim1];
}
- zone_cg_range = zones->cg_range;
- cginfo_mb = fr->cginfo_mb;
+ zone_cg_range = zones->cg_range;
+ gmx::ArrayRef<cginfo_mb_t> cginfo_mb = fr->cginfo_mb;
zone_cg_range[0] = 0;
zone_cg_range[1] = dd->ncg_home;
ddSendrecv<int>(dd, dim_ind, dddirBackward, work.atomGroupBuffer, integerBufferRef);
/* Make space for cg_cm */
- dd_check_alloc_ncg(fr, state, f, pos_cg + ind->nrecv[nzone]);
+ dd_resize_atominfo_and_state(fr, state, pos_cg + ind->nrecv[nzone]);
/* Communicate the coordinates */
gmx::ArrayRef<gmx::RVec> rvecBufferRef;
}
//!\brief TODO Remove fplog when group scheme and charge groups are gone
-void dd_partition_system(FILE* fplog,
- const gmx::MDLogger& mdlog,
- int64_t step,
- const t_commrec* cr,
- gmx_bool bMasterState,
- int nstglobalcomm,
- t_state* state_global,
- const gmx_mtop_t& top_global,
- const t_inputrec* ir,
- gmx::ImdSession* imdSession,
- pull_t* pull_work,
- t_state* state_local,
- PaddedHostVector<gmx::RVec>* f,
- gmx::MDAtoms* mdAtoms,
- gmx_localtop_t* top_local,
- t_forcerec* fr,
- gmx_vsite_t* vsite,
- gmx::Constraints* constr,
- t_nrnb* nrnb,
- gmx_wallcycle* wcycle,
- gmx_bool bVerbose)
+void dd_partition_system(FILE* fplog,
+ const gmx::MDLogger& mdlog,
+ int64_t step,
+ const t_commrec* cr,
+ gmx_bool bMasterState,
+ int nstglobalcomm,
+ t_state* state_global,
+ const gmx_mtop_t& top_global,
+ const t_inputrec* ir,
+ gmx::ImdSession* imdSession,
+ pull_t* pull_work,
+ t_state* state_local,
+ gmx::ForceBuffers* f,
+ gmx::MDAtoms* mdAtoms,
+ gmx_localtop_t* top_local,
+ t_forcerec* fr,
+ gmx::VirtualSitesHandler* vsite,
+ gmx::Constraints* constr,
+ t_nrnb* nrnb,
+ gmx_wallcycle* wcycle,
+ gmx_bool bVerbose)
{
gmx_domdec_t* dd;
gmx_domdec_comm_t* comm;
set_ddbox(*dd, true, DDMASTER(dd) ? state_global->box : nullptr, true, xGlobal, &ddbox);
- distributeState(mdlog, dd, top_global, state_global, ddbox, state_local, f);
+ distributeState(mdlog, dd, top_global, state_global, ddbox, state_local);
/* Ensure that we have space for the new distribution */
- dd_check_alloc_ncg(fr, state_local, f, dd->ncg_home);
+ dd_resize_atominfo_and_state(fr, state_local, dd->ncg_home);
inc_nrnb(nrnb, eNR_CGCM, comm->atomRanges.numHomeAtoms());
wallcycle_sub_start(wcycle, ewcsDD_REDIST);
ncgindex_set = dd->ncg_home;
- dd_redistribute_cg(fplog, step, dd, ddbox.tric_dir, state_local, f, fr, nrnb, &ncg_moved);
+ dd_redistribute_cg(fplog, step, dd, ddbox.tric_dir, state_local, fr, nrnb, &ncg_moved);
GMX_RELEASE_ASSERT(bSortCG, "Sorting is required after redistribution");
dd_sort_state(dd, fr, state_local);
/* After sorting and compacting we set the correct size */
- dd_resize_state(state_local, f, comm->atomRanges.numHomeAtoms());
+ state_change_natoms(state_local, comm->atomRanges.numHomeAtoms());
/* Rebuild all the indices */
dd->ga2la->clear();
make_dd_indices(dd, ncgindex_set);
/* Setup up the communication and communicate the coordinates */
- setup_dd_communication(dd, state_local->box, &ddbox, fr, state_local, f);
+ setup_dd_communication(dd, state_local->box, &ddbox, fr, state_local);
/* Set the indices for the halo atoms */
make_dd_indices(dd, dd->ncg_home);
/* Set the charge group boundaries for neighbor searching */
set_cg_boundaries(&comm->zones);
- if (fr->cutoff_scheme == ecutsVERLET)
- {
- /* When bSortCG=true, we have already set the size for zone 0 */
- set_zones_size(dd, state_local->box, &ddbox, bSortCG ? 1 : 0, comm->zones.n, 0);
- }
+ /* When bSortCG=true, we have already set the size for zone 0 */
+ set_zones_size(dd, state_local->box, &ddbox, bSortCG ? 1 : 0, comm->zones.n, 0);
wallcycle_sub_stop(wcycle, ewcsDD_SETUPCOMM);
switch (range)
{
case DDAtomRanges::Type::Vsites:
- if (vsite && vsite->numInterUpdategroupVsites)
+ if (vsite && vsite->numInterUpdategroupVirtualSites())
{
n = dd_make_local_vsites(dd, n, top_local->idef.il);
}
*/
state_local->natoms = comm->atomRanges.numAtomsTotal();
- dd_resize_state(state_local, f, state_local->natoms);
+ state_change_natoms(state_local, state_local->natoms);
- if (fr->haveDirectVirialContributions)
+ if (vsite && vsite->numInterUpdategroupVirtualSites())
{
- if (vsite && vsite->numInterUpdategroupVsites)
+ nat_f_novirsum = comm->atomRanges.end(DDAtomRanges::Type::Vsites);
+ }
+ else
+ {
+ if (EEL_FULL(ir->coulombtype) && dd->haveExclusions)
{
- nat_f_novirsum = comm->atomRanges.end(DDAtomRanges::Type::Vsites);
+ nat_f_novirsum = comm->atomRanges.end(DDAtomRanges::Type::Zones);
}
else
{
- if (EEL_FULL(ir->coulombtype) && dd->haveExclusions)
- {
- nat_f_novirsum = comm->atomRanges.end(DDAtomRanges::Type::Zones);
- }
- else
- {
- nat_f_novirsum = comm->atomRanges.numHomeAtoms();
- }
+ nat_f_novirsum = comm->atomRanges.numHomeAtoms();
}
}
- else
- {
- nat_f_novirsum = 0;
- }
/* Set the number of atoms required for the force calculation.
* Forces need to be constrained when doing energy
comm->atomRanges.end(DDAtomRanges::Type::Constraints), nat_f_novirsum);
/* Update atom data for mdatoms and several algorithms */
- mdAlgorithmsSetupAtomData(cr, ir, top_global, top_local, fr, nullptr, mdAtoms, constr, vsite, nullptr);
+ mdAlgorithmsSetupAtomData(cr, ir, top_global, top_local, fr, f, mdAtoms, constr, vsite, nullptr);
auto mdatoms = mdAtoms->mdatoms();
if (!thisRankHasDuty(cr, DUTY_PME))
* the last vsite construction, we need to communicate the constructing
* atom coordinates again (for spreading the forces this MD step).
*/
- dd_move_x_vsites(dd, state_local->box, state_local->x.rvec_array());
+ dd_move_x_vsites(*dd, state_local->box, state_local->x.rvec_array());
wallcycle_sub_stop(wcycle, ewcsDD_TOPOTHER);
}
/*! \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)
{