Gromacs
2020.5
|
#include <vector>
#include "gromacs/math/vectypes.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
This file declares functions for mdrun to call to manage the details of its domain decomposition.
Classes | |
struct | NumPmeDomains |
Struct for passing around the number of PME domains. More... | |
Enumerations | |
enum | { ddCyclStep, ddCyclPPduringPME, ddCyclF, ddCyclWaitGPU, ddCyclPME, ddCyclNr } |
Cycle counter indices used internally in the domain decomposition. | |
Functions | |
int | ddglatnr (const gmx_domdec_t *dd, int i) |
Returns the global topology atom number belonging to local atom index i. More... | |
gmx::ArrayRef< const gmx::RangePartitioning > | getUpdateGroupingPerMoleculetype (const gmx_domdec_t &dd) |
Returns a list of update group partitioning for each molecule type or empty when update groups are not used. | |
void | dd_store_state (struct gmx_domdec_t *dd, t_state *state) |
Store the global cg indices of the home cgs in state,. More... | |
struct gmx_domdec_zones_t * | domdec_zones (struct gmx_domdec_t *dd) |
Returns a pointer to the gmx_domdec_zones_t struct. | |
int | dd_numAtomsZones (const gmx_domdec_t &dd) |
Returns the range for atoms in zones. | |
int | dd_numHomeAtoms (const gmx_domdec_t &dd) |
Returns the number of home atoms. | |
int | dd_natoms_mdatoms (const gmx_domdec_t *dd) |
Returns the atom range in the local state for atoms that need to be present in mdatoms. | |
int | dd_natoms_vsite (const gmx_domdec_t *dd) |
Returns the atom range in the local state for atoms involved in virtual sites. | |
void | dd_get_constraint_range (const gmx_domdec_t *dd, int *at_start, int *at_end) |
Sets the atom range for atom in the local state for atoms received in constraints communication. | |
NumPmeDomains | getNumPmeDomains (const gmx_domdec_t *dd) |
Returns the number of PME domains, can be called with dd=NULL. | |
std::vector< int > | get_pme_ddranks (const t_commrec *cr, int pmenodeid) |
Returns the set of DD ranks that communicate with pme node cr->nodeid. | |
int | dd_pme_maxshift_x (const gmx_domdec_t *dd) |
Returns the maximum shift for coordinate communication in PME, dim x. | |
int | dd_pme_maxshift_y (const gmx_domdec_t *dd) |
Returns the maximum shift for coordinate communication in PME, dim y. | |
bool | ddHaveSplitConstraints (const gmx_domdec_t &dd) |
Return whether constraints, not including settles, cross domain boundaries. | |
bool | ddUsesUpdateGroups (const gmx_domdec_t &dd) |
Return whether update groups are used. | |
bool | is1DAnd1PulseDD (const gmx_domdec_t &dd) |
Return whether the DD has a single dimension with a single pulse. More... | |
void | dd_init_bondeds (FILE *fplog, gmx_domdec_t *dd, const gmx_mtop_t *mtop, const gmx_vsite_t *vsite, const t_inputrec *ir, gmx_bool bBCheck, cginfo_mb_t *cginfo_mb) |
Initialize data structures for bonded interactions. | |
bool | dd_moleculesAreAlwaysWhole (const gmx_domdec_t &dd) |
Returns whether molecules are always whole, i.e. not broken by PBC. | |
gmx_bool | dd_bonded_molpbc (const gmx_domdec_t *dd, int ePBC) |
Returns if we need to do pbc for calculating bonded interactions. | |
gmx_bool | change_dd_cutoff (t_commrec *cr, const matrix box, gmx::ArrayRef< const gmx::RVec > x, real cutoffRequested) |
Change the DD non-bonded communication cut-off. More... | |
void | dd_setup_dlb_resource_sharing (const t_commrec *cr, int gpu_id) |
Set up communication for averaging GPU wait times over domains. More... | |
void | dd_cycles_add (const gmx_domdec_t *dd, float cycles, int ddCycl) |
Add the wallcycle count to the DD counter. | |
void | dd_move_x (struct gmx_domdec_t *dd, const matrix box, gmx::ArrayRef< gmx::RVec > x, gmx_wallcycle *wcycle) |
Communicate the coordinates to the neighboring cells and do pbc. | |
void | dd_move_f (struct gmx_domdec_t *dd, gmx::ForceWithShiftForces *forceWithShiftForces, gmx_wallcycle *wcycle) |
Sum the forces over the neighboring cells. More... | |
void | dd_atom_spread_real (struct gmx_domdec_t *dd, real v[]) |
Communicate a real for each atom to the neighboring cells. | |
void | dd_atom_sum_real (struct gmx_domdec_t *dd, real v[]) |
Sum the contributions to a real for each atom over the neighboring cells. | |
void | reset_dd_statistics_counters (struct gmx_domdec_t *dd) |
Reset all the statistics and counters for total run counting. | |
void | dd_move_f_vsites (struct gmx_domdec_t *dd, rvec *f, rvec *fshift) |
Communicates the virtual site forces, reduces the shift forces when fshift != NULL. | |
void | dd_clear_f_vsites (struct gmx_domdec_t *dd, rvec *f) |
Clears the forces for virtual sites. | |
void | dd_move_x_constraints (struct gmx_domdec_t *dd, const matrix box, rvec *x0, rvec *x1, gmx_bool bX1IsCoord) |
Move x0 and also x1 if x1!=NULL. bX1IsCoord tells if to do PBC on x1. | |
void | dd_move_x_vsites (struct gmx_domdec_t *dd, const matrix box, rvec *x) |
Communicates the coordinates involved in virtual sites. | |
gmx::ArrayRef< const int > | dd_constraints_nlocalatoms (const gmx_domdec_t *dd) |
Returns the local atom count array for all constraints. More... | |
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) |
Print error output when interactions are missing. | |
void | dd_make_reverse_top (FILE *fplog, gmx_domdec_t *dd, const gmx_mtop_t *mtop, const gmx_vsite_t *vsite, const t_inputrec *ir, gmx_bool bBCheck) |
Generate and store the reverse topology. | |
void | dd_make_local_top (struct gmx_domdec_t *dd, struct gmx_domdec_zones_t *zones, int npbcdim, matrix box, rvec cellsize_min, const ivec npulse, t_forcerec *fr, rvec *cgcm_or_x, const gmx_mtop_t &top, gmx_localtop_t *ltop) |
Generate the local topology and virtual site data. | |
void | dd_sort_local_top (gmx_domdec_t *dd, const t_mdatoms *mdatoms, gmx_localtop_t *ltop) |
Sort ltop->ilist when we are doing free energy. | |
void | dd_init_local_top (const gmx_mtop_t &top_global, gmx_localtop_t *top) |
Initialize local topology. More... | |
void | dd_init_local_state (struct gmx_domdec_t *dd, const t_state *state_global, t_state *local_state) |
Construct local state. | |
t_blocka * | makeBondedLinks (const gmx_mtop_t *mtop, cginfo_mb_t *cginfo_mb) |
Generate a list of links between atoms that are linked by bonded interactions. More... | |
void | dd_bonded_cg_distance (const gmx::MDLogger &mdlog, const gmx_mtop_t *mtop, const t_inputrec *ir, const rvec *x, const matrix box, gmx_bool bBCheck, real *r_2b, real *r_mb) |
Calculate the maximum distance involved in 2-body and multi-body bonded interactions. | |
gmx_bool change_dd_cutoff | ( | t_commrec * | cr, |
const matrix | box, | ||
gmx::ArrayRef< const gmx::RVec > | x, | ||
real | cutoffRequested | ||
) |
Change the DD non-bonded communication cut-off.
This could fail when trying to increase the cut-off, then FALSE will be returned and the cut-off is not modified.
[in] | cr | Communication recrod |
[in] | box | Box matrix, used for computing the dimensions of the system |
[in] | x | Position vector, used for computing the dimensions of the system |
[in] | cutoffRequested | The requested atom to atom cut-off distance, usually the pair-list cutoff distance |
gmx::ArrayRef<const int> dd_constraints_nlocalatoms | ( | const gmx_domdec_t * | dd | ) |
Returns the local atom count array for all constraints.
The local atom count for a constraint, possible values 2/1/0, is needed to avoid not/double-counting contributions linked to the Lagrange multiplier, such as the virial and free-energy derivatives.
dd
= nullptr, an empty reference is returned. void dd_init_local_top | ( | const gmx_mtop_t & | top_global, |
gmx_localtop_t * | top | ||
) |
Initialize local topology.
[in] | top_global | Reference to global topology. |
[in,out] | top | Pointer to new local topology |
void dd_move_f | ( | struct gmx_domdec_t * | dd, |
gmx::ForceWithShiftForces * | forceWithShiftForces, | ||
gmx_wallcycle * | wcycle | ||
) |
Sum the forces over the neighboring cells.
When fshift!=NULL the shift forces are updated to obtain the correct virial from the single sum including f.
void dd_setup_dlb_resource_sharing | ( | const t_commrec * | cr, |
int | gpu_id | ||
) |
Set up communication for averaging GPU wait times over domains.
When domains (PP MPI ranks) share a GPU, the individual GPU wait times are meaningless, as it depends on the order in which tasks on the same GPU finish. Therefore there wait times need to be averaged over the ranks sharing the same GPU. This function sets up the communication for that.
void dd_store_state | ( | struct gmx_domdec_t * | dd, |
t_state * | state | ||
) |
Store the global cg indices of the home cgs in state,.
This means it can be reset, even after a new DD partitioning.
int ddglatnr | ( | const gmx_domdec_t * | dd, |
int | i | ||
) |
Returns the global topology atom number belonging to local atom index i.
This function is intended for writing ASCII output and returns atom numbers starting at 1. When dd=NULL returns i+1.
bool is1DAnd1PulseDD | ( | const gmx_domdec_t & | dd | ) |
Return whether the DD has a single dimension with a single pulse.
The GPU halo exchange code requires a 1D single-pulse DD, and its setup code can use the returned value to understand what it should do.
t_blocka* makeBondedLinks | ( | const gmx_mtop_t * | mtop, |
cginfo_mb_t * | cginfo_mb | ||
) |
Generate a list of links between atoms that are linked by bonded interactions.
Also stores whether atoms are linked in cginfo_mb
.