diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 1c4116ed22..65c875717f 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -661,11 +661,14 @@ void Neighbor::init() // anyghostlist = 1 if any non-occasional list stores neighbors of ghosts anyghostlist = 0; + int anybuild = 0; + for (i = 0; i < nrequest; i++) { if (lists[i]) { lists[i]->buildflag = 1; if (pair_build[i] == NULL) lists[i]->buildflag = 0; if (requests[i]->occasional) lists[i]->buildflag = 0; + if (lists[i]->buildflag) anybuild = 1; lists[i]->growflag = 1; if (requests[i]->copy) lists[i]->growflag = 0; @@ -680,6 +683,18 @@ void Neighbor::init() } else init_list_flags1_kokkos(i); } + // no request has the buildflag set, so set it for the first request only + // this insure binning is done for any occasional neighbor lists + + if (!anybuild) { + for (i = 0; i < nrequest; i++) { + if (lists[i]) { + lists[i]->buildflag = 1; + break; + } + } + } + #ifdef NEIGH_LIST_DEBUG for (i = 0; i < nrequest; i++) lists[i]->print_attributes(); #endif @@ -718,6 +733,16 @@ void Neighbor::init() } else init_list_flags2_kokkos(i); } + // no request had buildflag set, so we set it for the first request + // we also need to set other occasional neighbor list properties + + if (!anybuild) + for (i = 0; i < nrequest; i++) + if (lists[i] && lists[i]->buildflag) { + if (lists[i]->growflag) glist[nglist++] = i; + if (lists[i]->stencilflag) slist[nslist++] = i; + } + #ifdef NEIGH_LIST_DEBUG print_lists_of_lists(); #endif