fixed bug with pair hybrid/overaly and manybody potentials finding the right skip neighbor method

This commit is contained in:
Steve Plimpton
2016-12-21 09:50:29 -07:00
parent 81a2db8a0c
commit 9161bd98bf
5 changed files with 52 additions and 18 deletions

View File

@ -847,6 +847,7 @@ void AtomVecBody::unpack_border(int n, int first, double *buf)
inertia[2] = buf[m++]; inertia[2] = buf[m++];
bonus[j].ninteger = (int) ubuf(buf[m++]).i; bonus[j].ninteger = (int) ubuf(buf[m++]).i;
bonus[j].ndouble = (int) ubuf(buf[m++]).i; bonus[j].ndouble = (int) ubuf(buf[m++]).i;
// corresponding put() calls are in clear_bonus()
bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex); bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex); bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex);
m += bptr->unpack_border_body(&bonus[j],&buf[m]); m += bptr->unpack_border_body(&bonus[j],&buf[m]);
@ -897,6 +898,7 @@ void AtomVecBody::unpack_border_vel(int n, int first, double *buf)
inertia[2] = buf[m++]; inertia[2] = buf[m++];
bonus[j].ninteger = (int) ubuf(buf[m++]).i; bonus[j].ninteger = (int) ubuf(buf[m++]).i;
bonus[j].ndouble = (int) ubuf(buf[m++]).i; bonus[j].ndouble = (int) ubuf(buf[m++]).i;
// corresponding put() calls are in clear_bonus()
bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex); bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex); bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex);
m += bptr->unpack_border_body(&bonus[j],&buf[m]); m += bptr->unpack_border_body(&bonus[j],&buf[m]);
@ -946,6 +948,7 @@ int AtomVecBody::unpack_border_hybrid(int n, int first, double *buf)
inertia[2] = buf[m++]; inertia[2] = buf[m++];
bonus[j].ninteger = (int) ubuf(buf[m++]).i; bonus[j].ninteger = (int) ubuf(buf[m++]).i;
bonus[j].ndouble = (int) ubuf(buf[m++]).i; bonus[j].ndouble = (int) ubuf(buf[m++]).i;
// corresponding put() calls are in clear_bonus()
bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex); bonus[j].ivalue = icp->get(bonus[j].ninteger,bonus[j].iindex);
bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex); bonus[j].dvalue = dcp->get(bonus[j].ndouble,bonus[j].dindex);
m += bptr->unpack_border_body(&bonus[j],&buf[m]); m += bptr->unpack_border_body(&bonus[j],&buf[m]);
@ -1050,6 +1053,7 @@ int AtomVecBody::unpack_exchange(double *buf)
inertia[2] = buf[m++]; inertia[2] = buf[m++];
bonus[nlocal_bonus].ninteger = (int) ubuf(buf[m++]).i; bonus[nlocal_bonus].ninteger = (int) ubuf(buf[m++]).i;
bonus[nlocal_bonus].ndouble = (int) ubuf(buf[m++]).i; bonus[nlocal_bonus].ndouble = (int) ubuf(buf[m++]).i;
// corresponding put() calls are in copy()
bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger, bonus[nlocal_bonus].ivalue = icp->get(bonus[nlocal_bonus].ninteger,
bonus[nlocal_bonus].iindex); bonus[nlocal_bonus].iindex);
bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble, bonus[nlocal_bonus].dvalue = dcp->get(bonus[nlocal_bonus].ndouble,

View File

@ -57,10 +57,10 @@ namespace LAMMPS_NS {
template<class T> template<class T>
class MyPage { class MyPage {
public:
int ndatum; // total # of stored datums int ndatum; // total # of stored datums
int nchunk; // total # of stored chunks int nchunk; // total # of stored chunks
public:
MyPage() { MyPage() {
ndatum = nchunk = 0; ndatum = nchunk = 0;
pages = NULL; pages = NULL;

View File

@ -192,6 +192,7 @@ void NeighList::setup_pages(int pgsize_caller, int oneatom_caller)
gran calls grow() in granhistory gran calls grow() in granhistory
respaouter calls grow() in respainner, respamiddle respaouter calls grow() in respainner, respamiddle
triggered by neighbor list build triggered by neighbor list build
not called if a copy list
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void NeighList::grow(int nlocal, int nall) void NeighList::grow(int nlocal, int nall)

View File

@ -1369,6 +1369,8 @@ int Neighbor::choose_pair(NeighRequest *rq)
"with ghost neighbors"); "with ghost neighbors");
// flags for settings the request + system requires of NPair class // flags for settings the request + system requires of NPair class
// some are set to 0/1, others are set to mask bit
// comparisons below in loop over classes reflect that
// copyflag = no/yes copy request // copyflag = no/yes copy request
// skipflag = no/yes skip request // skipflag = no/yes skip request
// halfflag = half request (gran and respa are also half lists) // halfflag = half request (gran and respa are also half lists)
@ -1402,7 +1404,7 @@ int Neighbor::choose_pair(NeighRequest *rq)
// NOTE: exactly one of these request flags is set (see neigh_request.h) // NOTE: exactly one of these request flags is set (see neigh_request.h)
// this requires gran/respaouter also set halfflag // this requires gran/respaouter also set halfflag
// can simplify this logic, if follow NOTE in neigh_request.h // can simplify this logic, if follow NOTE in neigh_request.h
// all why do size/off2on and size/off2on/oneside set NP_HALF // why do size/off2on and size/off2on/oneside set NP_HALF
// either should set both half & full, or half should be in file name // either should set both half & full, or half should be in file name
// to be consistent with how other NP classes use "half" // to be consistent with how other NP classes use "half"
@ -1433,9 +1435,8 @@ int Neighbor::choose_pair(NeighRequest *rq)
else if (rq->newton == 1) newtflag = 1; else if (rq->newton == 1) newtflag = 1;
else if (rq->newton == 2) newtflag = 0; else if (rq->newton == 2) newtflag = 0;
// use flags to match exactly one of NPair class masks, bit by bit // use flags to match exactly one of NPair class masks
// copyflag match returns with no further checks // sequence of checks is bit by bit in NeighConst
// exactly one of halfflag,fullflag,halffullflag is set and thus must match
int mask; int mask;
@ -1447,13 +1448,21 @@ int Neighbor::choose_pair(NeighRequest *rq)
for (int i = 0; i < npclass; i++) { for (int i = 0; i < npclass; i++) {
mask = pairmasks[i]; mask = pairmasks[i];
if (copyflag && (mask & NP_COPY)) { // if copyflag set, return or continue with no further checks
if (copyflag) {
if (!(mask & NP_COPY)) continue;
if (kokkos_device_flag != (mask & NP_KOKKOS_DEVICE)) continue; if (kokkos_device_flag != (mask & NP_KOKKOS_DEVICE)) continue;
if (kokkos_host_flag != (mask & NP_KOKKOS_HOST)) continue; if (kokkos_host_flag != (mask & NP_KOKKOS_HOST)) continue;
return i+1; return i+1;
} }
// skipflag must match along with other flags, so do not return
if (skipflag != (mask & NP_SKIP)) continue; if (skipflag != (mask & NP_SKIP)) continue;
// exactly one of halfflag,fullflag,halffullflag is set and must match
if (halfflag) { if (halfflag) {
if (!(mask & NP_HALF)) continue; if (!(mask & NP_HALF)) continue;
} else if (fullflag) { } else if (fullflag) {
@ -1470,19 +1479,38 @@ int Neighbor::choose_pair(NeighRequest *rq)
if (ssaflag != (mask & NP_SSA)) continue; if (ssaflag != (mask & NP_SSA)) continue;
if (ompflag != (mask & NP_OMP)) continue; if (ompflag != (mask & NP_OMP)) continue;
if (intelflag != (mask & NP_INTEL)) continue; if (intelflag != (mask & NP_INTEL)) continue;
// style is one of NSQ,BIN,MULTI and must match
if (style == NSQ) {
if (!(mask & NP_NSQ)) continue;
} else if (style == BIN) {
if (!(mask & NP_BIN)) continue;
} else if (style == MULTI) {
if (!(mask & NP_MULTI)) continue;
}
// newtflag is on or off and must match
if (newtflag) {
if (!(mask & NP_NEWTON)) continue;
} else if (!newtflag) {
if (!(mask & NP_NEWTOFF)) continue;
}
// triclinic flag is on or off and must match
if (triclinic) {
if (!(mask & NP_TRI)) continue;
} else if (!triclinic) {
if (!(mask & NP_ORTHO)) continue;
}
// Kokkos flags
if (kokkos_device_flag != (mask & NP_KOKKOS_DEVICE)) continue; if (kokkos_device_flag != (mask & NP_KOKKOS_DEVICE)) continue;
if (kokkos_host_flag != (mask & NP_KOKKOS_HOST)) continue; if (kokkos_host_flag != (mask & NP_KOKKOS_HOST)) continue;
if (style == NSQ && !(mask & NP_NSQ)) continue;
if (style == BIN && !(mask & NP_BIN)) continue;
if (style == MULTI && !(mask & NP_MULTI)) continue;
if (newtflag && !(mask & NP_NEWTON)) continue;
if (!newtflag && !(mask & NP_NEWTOFF)) continue;
if (!triclinic && !(mask & NP_ORTHO)) continue;
if (triclinic && !(mask & NP_TRI)) continue;
return i+1; return i+1;
} }
@ -1727,7 +1755,7 @@ void Neighbor::build(int topoflag)
for (i = 0; i < npair_perpetual; i++) { for (i = 0; i < npair_perpetual; i++) {
m = plist[i]; m = plist[i];
lists[m]->grow(nlocal,nall); if (!lists[m]->copy) lists[m]->grow(nlocal,nall);
neigh_pair[m]->build_setup(); neigh_pair[m]->build_setup();
neigh_pair[m]->build(lists[m]); neigh_pair[m]->build(lists[m]);
} }

View File

@ -15,7 +15,8 @@
NPairStyle(skip, NPairStyle(skip,
NPairSkip, NPairSkip,
NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_SKIP | NP_HALF | NP_FULL | NP_HALFFULL |
NP_NSQ | NP_BIN | NP_MULTI |
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI) NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI)
#else #else