simplify checking for intel neighbor list requests

This commit is contained in:
Axel Kohlmeyer
2022-03-05 20:31:56 -05:00
parent 8fe78e5fc4
commit f1d695299e
3 changed files with 11 additions and 10 deletions

View File

@ -38,10 +38,6 @@
#include <algorithm>
#include <cstring>
#ifdef LMP_INTEL
#include "neigh_request.h"
#endif
#ifdef LMP_GPU
#include "fix_gpu.h"
#include <cmath>
@ -2177,12 +2173,7 @@ void Atom::setup_sort_bins()
bininvz = nbinz / (bboxhi[2]-bboxlo[2]);
#ifdef LMP_INTEL
int intel_neigh = 0;
if (neighbor->nrequest) {
if (neighbor->requests[0]->intel) intel_neigh = 1;
} else if (neighbor->old_nrequest)
if (neighbor->old_requests[0]->intel) intel_neigh = 1;
if (intel_neigh && userbinsize == 0.0) {
if (neighbor->has_intel_request() && userbinsize == 0.0) {
if (neighbor->binsizeflag) bininv = 1.0/neighbor->binsize_user;
double nx_low = neighbor->bboxlo[0];

View File

@ -2091,6 +2091,13 @@ NeighRequest *Neighbor::add_request(Command *requestor, const char *style, int f
return req;
}
/* report if there is a neighbor list with the intel flag set */
bool Neighbor::has_intel_request() const
{
return (((nrequest > 0) && (requests[0]->intel > 0))
|| ((old_nrequest > 0) && (old_requests[0]->intel > 0)));
}
/* ----------------------------------------------------------------------
setup neighbor binning and neighbor stencils
called before run and every reneighbor if box size/shape changes

View File

@ -133,6 +133,9 @@ class Neighbor : protected Pointers {
NeighRequest *add_request(class Compute *, int);
NeighRequest *add_request(class Command *, const char *, int);
// report if we have INTEL package neighbor lists
bool has_intel_request() const;
int decide(); // decide whether to build or not
virtual int check_distance(); // check max distance moved since last build
void setup_bins(); // setup bins based on box and cutoff