+/* Returns the i-zone range for pairlist construction for the give locality */
+static Range<int>
+getIZoneRange(const Nbnxm::GridSet::DomainSetup &domainSetup,
+ const Nbnxm::InteractionLocality locality)
+{
+ if (domainSetup.doTestParticleInsertion)
+ {
+ /* With TPI we do grid 1, the inserted molecule, versus grid 0, the rest */
+ return {
+ 1, 2
+ };
+ }
+ else if (locality == InteractionLocality::Local)
+ {
+ /* Local: only zone (grid) 0 vs 0 */
+ return {
+ 0, 1
+ };
+ }
+ else
+ {
+ /* Non-local: we need all i-zones */
+ return {
+ 0, int(domainSetup.zones->iZones.size())
+ };
+ }
+}
+
+/* Returns the j-zone range for pairlist construction for the give locality and i-zone */
+static Range<int>
+getJZoneRange(const gmx_domdec_zones_t &ddZones,
+ const Nbnxm::InteractionLocality locality,
+ const int iZone)
+{
+ if (locality == InteractionLocality::Local)
+ {
+ /* Local: zone 0 vs 0 or with TPI 1 vs 0 */
+ return {
+ 0, 1
+ };
+ }
+ else if (iZone == 0)
+ {
+ /* Non-local: we need to avoid the local (zone 0 vs 0) interactions */
+ return {
+ 1, *ddZones.iZones[iZone].jZoneRange.end()
+ };
+ }
+ else
+ {
+ /* Non-local with non-local i-zone: use all j-zones */
+ return ddZones.iZones[iZone].jZoneRange;
+ }
+}
+