Commit e69ef56f authored by sjplimp's avatar sjplimp Committed by GitHub
Browse files

Merge pull request #539 from lammps/neighsize

insure compute pair/property local will use a copy of granular neighbor list
parents 87c028ed 7dc380b1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -126,11 +126,15 @@ void ComputePairLocal::init()
                 " requested by compute pair/local");

  // need an occasional half neighbor list
  // set size to same value as request made by force->pair
  // this should enable it to always be a copy list (e.g. for granular pstyle)

  int irequest = neighbor->request(this,instance_me);
  neighbor->requests[irequest]->pair = 0;
  neighbor->requests[irequest]->compute = 1;
  neighbor->requests[irequest]->occasional = 1;
  NeighRequest *pairrequest = neighbor->find_request((void *) force->pair);
  if (pairrequest) neighbor->requests[irequest]->size = pairrequest->size;
}

/* ---------------------------------------------------------------------- */
+4 −0
Original line number Diff line number Diff line
@@ -280,12 +280,16 @@ void ComputePropertyLocal::init()
  }

  // for NEIGH/PAIR need an occasional half neighbor list
  // set size to same value as request made by force->pair
  // this should enable it to always be a copy list  (e.g. for granular pstyle)

  if (kindflag == NEIGH || kindflag == PAIR) {
    int irequest = neighbor->request(this,instance_me);
    neighbor->requests[irequest]->pair = 0;
    neighbor->requests[irequest]->compute = 1;
    neighbor->requests[irequest]->occasional = 1;
    NeighRequest *pairrequest = neighbor->find_request((void *) force->pair);
    if (pairrequest) neighbor->requests[irequest]->size = pairrequest->size;
  }

  // do initial memory allocation so that memory_usage() is correct
+19 −0
Original line number Diff line number Diff line
@@ -1268,6 +1268,10 @@ void Neighbor::morph_copy()

      if (irq->ghost && !jrq->ghost) continue;

      // do not copy from a history list

      if (jrq->history) continue;

      // these flags must be same,
      //   else 2 lists do not store same pairs
      //   or their data structures are different
@@ -1619,6 +1623,21 @@ void Neighbor::requests_new2old()
  old_oneatom = oneatom;
}

/* ----------------------------------------------------------------------
   find and return request made by classptr
   if not found or classpt = NULL, return NULL
------------------------------------------------------------------------- */

NeighRequest *Neighbor::find_request(void *classptr)
{
  if (classptr == NULL) return NULL;

  for (int i = 0; i < nrequest; i++)
    if (requests[i]->requestor == classptr) return requests[i];

  return NULL;
}

/* ----------------------------------------------------------------------
   assign NBin class to a NeighList
   use neigh request settings to build mask
+1 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ class Neighbor : protected Pointers {

  void exclusion_group_group_delete(int, int);  // rm a group-group exclusion
  int exclude_setting();            // return exclude value to accelerator pkg
  class NeighRequest *find_request(void *);  // find a neighbor request

  bigint memory_usage();