From ed9ce739042088fad1c0a8c67a55b51dd11e9a3c Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 4 Oct 2007 23:59:26 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@954 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/GRANULAR/pair_gran_hertzian.cpp | 2 +- src/GRANULAR/pair_gran_history.cpp | 18 +- src/finish.cpp | 9 +- src/neigh_derive.cpp | 264 +++++++++++++++++++++++++++- src/neigh_request.h | 2 +- src/neighbor.cpp | 153 ++++++++-------- src/neighbor.h | 21 ++- src/pair_hybrid.cpp | 47 +++-- src/pair_hybrid_overlay.cpp | 24 +-- src/style_user_ackland.h | 20 --- 10 files changed, 404 insertions(+), 156 deletions(-) diff --git a/src/GRANULAR/pair_gran_hertzian.cpp b/src/GRANULAR/pair_gran_hertzian.cpp index 84f87414b4..07db4dd930 100644 --- a/src/GRANULAR/pair_gran_hertzian.cpp +++ b/src/GRANULAR/pair_gran_hertzian.cpp @@ -95,7 +95,7 @@ void PairGranHertzian::compute(int eflag, int vflag) if (rsq >= radsum*radsum) { - // unset touching neighbors + // unset non-touching neighbors touch[jj] = 0; shear = &allshear[3*jj]; diff --git a/src/GRANULAR/pair_gran_history.cpp b/src/GRANULAR/pair_gran_history.cpp index 1e7ef4e06c..a653d19df0 100644 --- a/src/GRANULAR/pair_gran_history.cpp +++ b/src/GRANULAR/pair_gran_history.cpp @@ -123,7 +123,7 @@ void PairGranHistory::compute(int eflag, int vflag) if (rsq >= radsum*radsum) { - // unset touching neighbors + // unset non-touching neighbors touch[jj] = 0; shear = &allshear[3*jj]; @@ -421,11 +421,19 @@ double PairGranHistory::init_one(int i, int j) { if (!allocated) allocate(); - // return dummy value used in neighbor setup, - // but not in actual neighbor calculation - // since particles have variable radius + // return max diameter of any particle + // not used in granular neighbor calculation since particles have radius + // but will insure cutoff is big enough for any other neighbor lists built - return 1.0; + double *radius = atom->radius; + int nlocal = atom->nlocal; + + double maxrad = 0.0; + for (int m = 0; m < nlocal; m++) maxrad = MAX(maxrad,radius[m]); + double mine = maxrad; + MPI_Allreduce(&mine,&maxrad,1,MPI_DOUBLE,MPI_MAX,world); + + return 2.0*maxrad; } /* ---------------------------------------------------------------------- diff --git a/src/finish.cpp b/src/finish.cpp index 09441d4ff4..dd0dcf971e 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -293,11 +293,12 @@ void Finish::end(int flag) } } - // find a half non-skip neighbor list + // find a non-skip neighbor list containing half the pairwise interactions for (m = 0; m < neighbor->old_nrequest; m++) - if ((neighbor->old_requests[m]->half || - neighbor->old_requests[m]->half_from_full) && + if ((neighbor->old_requests[m]->half || neighbor->old_requests[m]->gran || + neighbor->old_requests[m]->respaouter || + neighbor->old_requests[m]->half_from_full) && neighbor->old_requests[m]->skip == 0) break; int nneigh = 0; @@ -322,7 +323,7 @@ void Finish::end(int flag) } } - // find a full non-skip neighbor list + // find a non-skip neighbor list containing full pairwise interactions for (m = 0; m < neighbor->old_nrequest; m++) if (neighbor->old_requests[m]->full && diff --git a/src/neigh_derive.cpp b/src/neigh_derive.cpp index d07176e35a..50a1732a6c 100644 --- a/src/neigh_derive.cpp +++ b/src/neigh_derive.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; works if full list is a skip list ------------------------------------------------------------------------- */ -void Neighbor::half_full_no_newton(NeighList *list) +void Neighbor::half_from_full_no_newton(NeighList *list) { int i,j,ii,jj,n,jnum; int *neighptr,*jlist; @@ -56,7 +56,7 @@ void Neighbor::half_full_no_newton(NeighList *list) neighptr = &pages[npage][npnt]; n = 0; - // loop over full neighbor list + // loop over parent full list i = ilist_full[ii]; jlist = firstneigh_full[i]; @@ -86,7 +86,7 @@ void Neighbor::half_full_no_newton(NeighList *list) works if full list is a skip list ------------------------------------------------------------------------- */ -void Neighbor::half_full_newton(NeighList *list) +void Neighbor::half_from_full_newton(NeighList *list) { int i,j,ii,jj,n,jnum; int *neighptr,*jlist; @@ -108,7 +108,7 @@ void Neighbor::half_full_newton(NeighList *list) int npage = 0; int npnt = 0; - // loop over atoms in full list + // loop over parent full list for (ii = 0; ii < inum_full; ii++) { @@ -158,6 +158,7 @@ void Neighbor::half_full_newton(NeighList *list) /* ---------------------------------------------------------------------- build skip list for subset of types from parent list iskip and ijskip flag which atom types and type pairs to skip + this is for half and full lists ------------------------------------------------------------------------- */ void Neighbor::skip_from(NeighList *list) @@ -202,7 +203,7 @@ void Neighbor::skip_from(NeighList *list) neighptr = &pages[npage][npnt]; n = 0; - // loop over full neighbor list + // loop over parent non-skip list jlist = firstneigh_skip[i]; jnum = numneigh_skip[i]; @@ -227,7 +228,258 @@ void Neighbor::skip_from(NeighList *list) } /* ---------------------------------------------------------------------- - create list which is simply a copy of another list + build skip list for subset of types from parent list + iskip and ijskip flag which atom types and type pairs to skip + this is for granular lists with history, copy the history values from parent +------------------------------------------------------------------------- */ + +void Neighbor::skip_from_granular(NeighList *list) +{ + int i,j,ii,jj,n,nn,itype,jnum,joriginal; + int *neighptr,*jlist,*touchptr,*touchptr_skip; + double *shearptr,*shearptr_skip; + + int *type = atom->type; + int nall = atom->nlocal + atom->nghost; + + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + int **pages = list->pages; + int *ilist_skip = list->listskip->ilist; + int *numneigh_skip = list->listskip->numneigh; + int **firstneigh_skip = list->listskip->firstneigh; + int **firsttouch_skip = list->listskip->listgranhistory->firstneigh; + double **firstshear_skip = list->listskip->listgranhistory->firstdouble; + int inum_skip = list->listskip->inum; + + int *iskip = list->iskip; + int **ijskip = list->ijskip; + + NeighList *listgranhistory = list->listgranhistory; + int **firsttouch = listgranhistory->firstneigh; + double **firstshear = listgranhistory->firstdouble; + int **pages_touch = listgranhistory->pages; + double **pages_shear = listgranhistory->dpages; + + int inum = 0; + int npage = 0; + int npnt = 0; + + // loop over atoms in other list + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + for (ii = 0; ii < inum_skip; ii++) { + i = ilist_skip[ii]; + itype = type[i]; + if (iskip[type[i]]) continue; + + if (pgsize - npnt < oneatom) { + npnt = 0; + npage++; + if (npage == list->maxpage) { + pages = list->add_pages(); + pages_touch = listgranhistory->add_pages(); + pages_shear = listgranhistory->dpages; + } + } + + n = 0; + neighptr = &pages[npage][npnt]; + nn = 0; + touchptr = &pages_touch[npage][npnt]; + shearptr = &pages_shear[npage][3*npnt]; + + // loop over parent non-skip granular list and its history info + + touchptr_skip = firsttouch_skip[i]; + shearptr_skip = firstshear_skip[i]; + jlist = firstneigh_skip[i]; + jnum = numneigh_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + j = joriginal = jlist[jj]; + if (j >= nall) j %= nall; + if (ijskip[itype][type[j]]) continue; + neighptr[n] = joriginal; + touchptr[n++] = touchptr_skip[jj]; + shearptr[nn++] = shearptr_skip[3*jj]; + shearptr[nn++] = shearptr_skip[3*jj+1]; + shearptr[nn++] = shearptr_skip[3*jj+2]; + } + + ilist[inum] = i; + firstneigh[i] = neighptr; + numneigh[i] = n; + firsttouch[i] = touchptr; + firstshear[i] = shearptr; + inum++; + npnt += n; + if (npnt >= pgsize) + error->one("Neighbor list overflow, boost neigh_modify one or page"); + } + + list->inum = inum; +} + +/* ---------------------------------------------------------------------- + build skip list for subset of types from parent list + iskip and ijskip flag which atom types and type pairs to skip + this is for respa lists, copy the inner/middle values from parent +------------------------------------------------------------------------- */ + +void Neighbor::skip_from_respa(NeighList *list) +{ + int i,j,ii,jj,n,itype,jnum,joriginal,n_inner,n_middle; + int *neighptr,*jlist,*neighptr_inner,*neighptr_middle; + + int *type = atom->type; + int nall = atom->nlocal + atom->nghost; + + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + int **pages = list->pages; + int *ilist_skip = list->listskip->ilist; + int *numneigh_skip = list->listskip->numneigh; + int **firstneigh_skip = list->listskip->firstneigh; + int inum_skip = list->listskip->inum; + + int *iskip = list->iskip; + int **ijskip = list->ijskip; + + NeighList *listinner = list->listinner; + int *numneigh_inner = listinner->numneigh; + int **firstneigh_inner = listinner->firstneigh; + int **pages_inner = listinner->pages; + int *numneigh_inner_skip = list->listskip->listinner->numneigh; + int **firstneigh_inner_skip = list->listskip->listinner->firstneigh; + + NeighList *listmiddle; + int *numneigh_middle,**firstneigh_middle,**pages_middle; + int *numneigh_middle_skip,**firstneigh_middle_skip; + int respamiddle = list->respamiddle; + if (respamiddle) { + listmiddle = list->listmiddle; + numneigh_middle = listmiddle->numneigh; + firstneigh_middle = listmiddle->firstneigh; + pages_middle = listmiddle->pages; + numneigh_middle_skip = list->listskip->listmiddle->numneigh; + firstneigh_middle_skip = list->listskip->listmiddle->firstneigh; + } + + int inum = 0; + int npage = 0; + int npnt = 0; + int npage_inner = 0; + int npnt_inner = 0; + int npage_middle = 0; + int npnt_middle = 0; + + // loop over atoms in other list + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + for (ii = 0; ii < inum_skip; ii++) { + i = ilist_skip[ii]; + itype = type[i]; + if (iskip[type[i]]) continue; + + if (pgsize - npnt < oneatom) { + npnt = 0; + npage++; + if (npage == list->maxpage) pages = list->add_pages(); + } + neighptr = &pages[npage][npnt]; + n = 0; + + if (pgsize - npnt_inner < oneatom) { + npnt_inner = 0; + npage_inner++; + if (npage_inner == listinner->maxpage) + pages_inner = listinner->add_pages(); + } + neighptr_inner = &pages_inner[npage_inner][npnt_inner]; + n_inner = 0; + + if (respamiddle) { + if (pgsize - npnt_middle < oneatom) { + npnt_middle = 0; + npage_middle++; + if (npage_middle == listmiddle->maxpage) + pages_middle = listmiddle->add_pages(); + } + neighptr_middle = &pages_middle[npage_middle][npnt_middle]; + n_middle = 0; + } + + // loop over parent outer rRESPA list + + jlist = firstneigh_skip[i]; + jnum = numneigh_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + j = joriginal = jlist[jj]; + if (j >= nall) j %= nall; + if (ijskip[itype][type[j]]) continue; + neighptr[n++] = joriginal; + } + + // loop over parent inner rRESPA list + + jlist = firstneigh_inner_skip[i]; + jnum = numneigh_inner_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + j = joriginal = jlist[jj]; + if (j >= nall) j %= nall; + if (ijskip[itype][type[j]]) continue; + neighptr_inner[n_inner++] = joriginal; + } + + // loop over parent middle rRESPA list + + if (respamiddle) { + jlist = firstneigh_middle_skip[i]; + jnum = numneigh_middle_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + j = joriginal = jlist[jj]; + if (j >= nall) j %= nall; + if (ijskip[itype][type[j]]) continue; + neighptr_middle[n_middle++] = joriginal; + } + } + + ilist[inum] = i; + firstneigh[i] = neighptr; + numneigh[i] = n; + inum++; + npnt += n; + if (npnt >= pgsize) + error->one("Neighbor list overflow, boost neigh_modify one or page"); + + firstneigh_inner[i] = neighptr_inner; + numneigh_inner[i] = n_inner; + npnt_inner += n_inner; + if (npnt_inner >= pgsize) + error->one("Neighbor list overflow, boost neigh_modify one or page"); + + if (respamiddle) { + firstneigh_middle[i] = neighptr_middle; + numneigh_middle[i] = n_middle; + npnt_middle += n_middle; + if (npnt_middle >= pgsize) + error->one("Neighbor list overflow, boost neigh_modify one or page"); + } + } + + list->inum = inum; +} + +/* ---------------------------------------------------------------------- + create list which is simply a copy of parent list ------------------------------------------------------------------------- */ void Neighbor::copy_from(NeighList *list) diff --git a/src/neigh_request.h b/src/neigh_request.h index 9c0a43af60..8b244bf0cd 100644 --- a/src/neigh_request.h +++ b/src/neigh_request.h @@ -32,7 +32,7 @@ class NeighRequest : protected Pointers { int command; // kind of list requested, one flag is 1, others are 0 - // set by reqeusting class + // set by requesting class int half; // 1 if half neigh list int full; // 1 if full neigh list diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 6b906ed992..0bd613c000 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -54,6 +54,8 @@ using namespace LAMMPS_NS; enum{NSQ,BIN,MULTI}; // also in neigh_list.cpp +// #define NEIGH_LIST_DEBUG 1 + /* ---------------------------------------------------------------------- */ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp) @@ -196,7 +198,11 @@ void Neighbor::init() // set to 0 if cutforce = 0 // cutneighmin/max used for neighbor bin sizes // cutghost determines comm distance = max of cutneigh & skin - // may need ghosts for bonds even if all cutneigh = 0 (pair = NULL) + // skin is only > cutneighmax when cutneighmax = 0.0 due to pair = NULL + // in this case, are running a bond-only simulation + // still need ghost atom communication for bonds and atom exchange + // triggered by atoms moving 1/2 skin distance, but no neigh lists formed + // user should set skin big enough to find all bonds triggersq = 0.25*skin*skin; @@ -382,7 +388,9 @@ void Neighbor::init() for (i = 0; i < nrequest; i++) if (requests[i]->identical(old_requests[i]) == 0) same = 0; - printf("SAME %d\n",same); +#ifdef NEIGH_LIST_DEBUG + if (comm->me == 0) printf("SAME flag %d\n",same); +#endif // if old and new are not the same, create new pairwise lists @@ -422,42 +430,47 @@ void Neighbor::init() } // detect lists that are connected to other lists + // if-the-else sequence is important + // since don't want to re-process skip or copy lists further down // skip: point this list at request->otherlist, copy skip ptrs from request // copy: point this list at request->otherlist // half_from_full: point this list at preceeding full list // granhistory: set preceeding list's listgranhistory to this list // also set precedding list's ptr to FixShearHistory // respaouter: point this list at preceeding 1/2 inner/middle lists - // pair and half and non-skip: if there is a pair full non-skip list, + // pair and half: if there is a full non-occasional non-skip list // change this list to half_from_full and point at the full list + // parent could be copy list or pair or fix // fix/compute requests: - // kind of request = half or full - // occasional or not doesn't matter - // if non-skip pair list of same kind exists, become copy of that list - // else if request is half and non-skip pair full exists, + // kind of request = half or full, occasional or not doesn't matter + // if request = half and non-skip pair half/respaouter exists, + // become copy of that list + // if request = full and non-skip pair full exists, + // become copy of that list + // if request = half and non-skip pair full exists, // become half_from_full of that list - // else do nothing and the fix/compute list will be built directly + // if no matches, do nothing, fix/compute list will be built directly + // ok if parent is copy list for (i = 0; i < nlist; i++) { if (requests[i]->skip) { lists[i]->listskip = lists[requests[i]->otherlist]; lists[i]->iskip = requests[i]->iskip; lists[i]->ijskip = requests[i]->ijskip; - } - if (requests[i]->copy) + } else if (requests[i]->copy) lists[i]->listcopy = lists[requests[i]->otherlist]; - if (requests[i]->half_from_full) lists[i]->listfull = lists[i-1]; + else if (requests[i]->half_from_full) + lists[i]->listfull = lists[i-1]; - if (requests[i]->granhistory) { + else if (requests[i]->granhistory) { lists[i-1]->listgranhistory = lists[i]; for (int ifix = 0; ifix < modify->nfix; ifix++) if (strcmp(modify->fix[ifix]->style,"SHEAR_HISTORY") == 0) lists[i-1]->fix_history = (FixShearHistory *) modify->fix[ifix]; - } - - if (requests[i]->respaouter) { + + } else if (requests[i]->respaouter) { if (requests[i-1]->respainner) { lists[i]->respamiddle = 0; lists[i]->listinner = lists[i-1]; @@ -466,33 +479,33 @@ void Neighbor::init() lists[i]->listmiddle = lists[i-1]; lists[i]->listinner = lists[i-2]; } - } - if (requests[i]->pair && requests[i]->half && requests[i]->skip == 0) { + } else if (requests[i]->pair && requests[i]->half) { for (j = 0; j < nlist; j++) - if (requests[j]->pair && requests[j]->full && + if (requests[j]->full && requests[j]->occasional == 0 && requests[j]->skip == 0) break; if (j < nlist) { requests[i]->half = 0; requests[i]->half_from_full = 1; lists[i]->listfull = lists[j]; } - } - if (requests[i]->fix || requests[i]->compute) { + } else if (requests[i]->fix || requests[i]->compute) { for (j = 0; j < nlist; j++) { - if (requests[j]->pair && requests[j]->skip == 0 && - requests[j]->half && requests[i]->half) break; - if (requests[j]->pair && requests[j]->skip == 0 && - requests[j]->full && requests[i]->full) break; + if (requests[i]->half && requests[j]->pair && + requests[j]->skip == 0 && requests[j]->half) break; + if (requests[i]->full && requests[j]->pair && + requests[j]->skip == 0 && requests[j]->full) break; + if (requests[i]->half && requests[j]->pair && + requests[j]->skip == 0 && requests[j]->respaouter) break; } if (j < nlist) { requests[i]->copy = 1; lists[i]->listcopy = lists[j]; } else { for (j = 0; j < nlist; j++) { - if (requests[j]->pair && requests[j]->skip == 0 && - requests[j]->full && requests[i]->half) break; + if (requests[i]->half && requests[j]->pair && + requests[j]->skip == 0 && requests[j]->full) break; } if (j < nlist) { requests[i]->half = 0; @@ -530,10 +543,10 @@ void Neighbor::init() if (stencil_create[i] == NULL) lists[i]->stencilflag = 0; } - // DEBUG: print list attributes - +#ifdef NEIGH_LIST_DEBUG for (i = 0; i < nlist; i++) lists[i]->print_attributes(); - +#endif + // allocate atom arrays and 1st pages of lists that store them for (i = 0; i < nlist; i++) @@ -565,23 +578,13 @@ void Neighbor::init() slist[nslist++] = i; } - // DEBUG: print lists of lists - - if (comm->me == 0) { - printf("Build lists = %d: ",nblist); - for (i = 0; i < nblist; i++) printf("%d ",blist[i]); - printf("\n"); - printf("Grow lists = %d: ",nglist); - for (i = 0; i < nglist; i++) printf("%d ",glist[i]); - printf("\n"); - printf("Stencil lists = %d: ",nslist); - for (i = 0; i < nslist; i++) printf("%d ",slist[i]); - printf("\n"); - } +#ifdef NEIGH_LIST_DEBUG + print_lists_of_lists(); +#endif // reorder build vector if necessary // relevant for lists that copy/skip/half-full from parent - // the derived lst must appear in blist after the parent list + // the derived list must appear in blist after the parent list // no occasional lists are in build vector // swap two lists within blist when dependency is mis-ordered // done when entire pass thru blist results in no swaps @@ -608,19 +611,9 @@ void Neighbor::init() } } - // DEBUG: print lists of lists - - if (comm->me == 0) { - printf("Build lists = %d: ",nblist); - for (i = 0; i < nblist; i++) printf("%d ",blist[i]); - printf("\n"); - printf("Grow lists = %d: ",nglist); - for (i = 0; i < nglist; i++) printf("%d ",glist[i]); - printf("\n"); - printf("Stencil lists = %d: ",nslist); - for (i = 0; i < nslist; i++) printf("%d ",slist[i]); - printf("\n"); - } +#ifdef NEIGH_LIST_DEBUG + print_lists_of_lists(); +#endif } // delete old requests @@ -750,11 +743,13 @@ int Neighbor::request(void *requestor) return nrequest-1; } - /* ---------------------------------------------------------------------- determine which pair_build function each neigh list needs based on settings of neigh request - skip or copy -> single function + copy -> copy_from function + skip -> granular function if gran with granhistory + respa function if respaouter + skip_from function for everything else half_from_full, half, full, gran, respaouter -> choose by newton and tri style NSQ options = newton off, newton on style BIN options = newton off, newton on and not tri, newton on and tri @@ -767,13 +762,17 @@ void Neighbor::choose_build(int index, NeighRequest *rq) { PairPtr pb = NULL; - if (rq->skip) pb = &Neighbor::skip_from; + if (rq->copy) pb = &Neighbor::copy_from; - else if (rq->copy) pb = &Neighbor::copy_from; + else if (rq->skip) { + if (rq->gran && lists[index]->listgranhistory) + pb = &Neighbor::skip_from_granular; + else if (rq->respaouter) pb = &Neighbor::skip_from_respa; + else pb = &Neighbor::skip_from; - else if (rq->half_from_full) { - if (newton_pair == 0) pb = &Neighbor::half_full_no_newton; - else if (newton_pair == 1) pb = &Neighbor::half_full_newton; + } else if (rq->half_from_full) { + if (newton_pair == 0) pb = &Neighbor::half_from_full_no_newton; + else if (newton_pair == 1) pb = &Neighbor::half_from_full_newton; } else if (rq->half) { if (style == NSQ) { @@ -878,6 +877,23 @@ void Neighbor::choose_stencil(int index, NeighRequest *rq) /* ---------------------------------------------------------------------- */ +void Neighbor::print_lists_of_lists() +{ + if (comm->me == 0) { + printf("Build lists = %d: ",nblist); + for (int i = 0; i < nblist; i++) printf("%d ",blist[i]); + printf("\n"); + printf("Grow lists = %d: ",nglist); + for (int i = 0; i < nglist; i++) printf("%d ",glist[i]); + printf("\n"); + printf("Stencil lists = %d: ",nslist); + for (int i = 0; i < nslist; i++) printf("%d ",slist[i]); + printf("\n"); + } +} + +/* ---------------------------------------------------------------------- */ + int Neighbor::decide() { if (must_check) { @@ -968,17 +984,6 @@ void Neighbor::build() for (i = 0; i < nblist; i++) (this->*pair_build[blist[i]])(lists[blist[i]]); - /* - if (comm->me == 0) { - for (int m = 0; m < nlist; m++) { - int num = 0; - for (i = 0; i < lists[m]->inum; i++) - num += lists[m]->numneigh[lists[m]->ilist[i]]; - printf("List %d length = %d\n",m,num); - } - } - */ - if (atom->molecular) { if (atom->nbonds) (this->*bond_build)(); if (atom->nangles) (this->*angle_build)(); diff --git a/src/neighbor.h b/src/neighbor.h index 36efc3f3e5..6a3ff2f6fa 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -58,13 +58,14 @@ class Neighbor : protected Pointers { Neighbor(class LAMMPS *); ~Neighbor(); void init(); - int request(void *); // another class requests a neighbor list - int decide(); // decide whether to build or not - int check_distance(); // check max distance moved since last build - void setup_bins(); // setup bins based on box and cutoff - void build(); // create all neighbor lists (pair,bond) - void build_one(int); // create a single neighbor list - void set(int, char **); // set neighbor style and skin distance + int request(void *); // another class requests a neighbor list + void print_lists_of_lists(); // debug print out + int decide(); // decide whether to build or not + int check_distance(); // check max distance moved since last build + void setup_bins(); // setup bins based on box and cutoff + void build(); // create all neighbor lists (pair,bond) + void build_one(int); // create a single neighbor list + void set(int, char **); // set neighbor style and skin distance void modify_params(int, char**); // modify parameters that control builds double memory_usage(); @@ -169,9 +170,11 @@ class Neighbor : protected Pointers { void full_bin(class NeighList *); void full_multi(class NeighList *); - void half_full_no_newton(class NeighList *); - void half_full_newton(class NeighList *); + void half_from_full_no_newton(class NeighList *); + void half_from_full_newton(class NeighList *); void skip_from(class NeighList *); + void skip_from_granular(class NeighList *); + void skip_from_respa(class NeighList *); void copy_from(class NeighList *); void granular_nsq_no_newton(class NeighList *); diff --git a/src/pair_hybrid.cpp b/src/pair_hybrid.cpp index 9162b4ea36..ab4c362bae 100644 --- a/src/pair_hybrid.cpp +++ b/src/pair_hybrid.cpp @@ -316,16 +316,10 @@ void PairHybrid::init_style() for (istyle = 0; istyle < nstyles; istyle++) styles[istyle]->init_style(); // create skip lists for each neigh request + // any kind of list can have its skip flag set at this stage for (i = 0; i < neighbor->nrequest; i++) { - // only relevant for half, full, gran, respaouter lists - - if (neighbor->requests[i]->granhistory) continue; - if (neighbor->requests[i]->respamiddle) continue; - if (neighbor->requests[i]->respainner) continue; - if (neighbor->requests[i]->half_from_full) continue; - // find associated sub-style for (istyle = 0; istyle < nstyles; istyle++) @@ -435,23 +429,44 @@ double PairHybrid::init_one(int i, int j) void PairHybrid::modify_requests() { int i,j; + NeighRequest *irq,*jrq; - // if list is skip list, look for non-skip list of same kind + // if list is skip list and not copy, look for non-skip list of same kind // if one exists, point at that one // else make new non-skip request of same kind and point at that one + // don't bother to set ID for new request, since pair hybrid ignores list + // only exception is half_from_full: + // ignore it, turn off skip, since it will derive from its skip parent + // after possible new request creation, unset skip flag and otherlist + // for these derived lists: granhistory, rRESPA inner/middle + // this prevents neighbor from treating them as skip lists + // copy list check is for pair style = hybrid/overlay + // which invokes this routine for (i = 0; i < neighbor->nrequest; i++) { - if (neighbor->requests[i]->skip == 0) continue; + irq = neighbor->requests[i]; + if (irq->skip == 0 || irq->copy) continue; + if (irq->half_from_full) { + irq->skip = 0; + continue; + } - for (j = 0; j < neighbor->nrequest; j++) - if (neighbor->requests[i]->same_kind(neighbor->requests[j]) && - neighbor->requests[j]->skip == 0) break; + for (j = 0; j < neighbor->nrequest; j++) { + jrq = neighbor->requests[j]; + if (irq->same_kind(jrq) && jrq->skip == 0) break; + } - if (j < neighbor->nrequest) neighbor->requests[i]->otherlist = j; + if (j < neighbor->nrequest) irq->otherlist = j; else { - int irequest = neighbor->request(this); - neighbor->requests[irequest]->copy_kind(neighbor->requests[i]); - neighbor->requests[i]->otherlist = irequest; + int newrequest = neighbor->request(this); + neighbor->requests[newrequest]->copy_kind(irq); + neighbor->requests[newrequest]->dnum = irq->dnum; + irq->otherlist = newrequest; + } + + if (irq->granhistory || irq->respainner || irq->respamiddle) { + irq->skip = 0; + irq->otherlist = -1; } } } diff --git a/src/pair_hybrid_overlay.cpp b/src/pair_hybrid_overlay.cpp index 501018aa2f..30464f3336 100644 --- a/src/pair_hybrid_overlay.cpp +++ b/src/pair_hybrid_overlay.cpp @@ -103,7 +103,8 @@ void PairHybridOverlay::modify_requests() // loop over pair requests // if a previous list is same kind with same skip attributes // then make this one a copy list of that one - // NOTE: SHOULD I SKIP granhistory, respamiddle, halffromfull ?? + // works whether both lists are no-skip or yes-skip + // will not point a list at a copy list, but at copy list's parent for (i = 0; i < neighbor->nrequest; i++) { irq = neighbor->requests[i]; @@ -117,24 +118,7 @@ void PairHybridOverlay::modify_requests() } } - // if list is skip list and not copy, look for non-skip list of same kind - // if one exists, point at that one - // else make new non-skip request of same kind and point at that one + // perform same operations on skip lists as pair style = hybrid - for (i = 0; i < neighbor->nrequest; i++) { - irq = neighbor->requests[i]; - if (irq->skip == 0 || irq->copy) continue; - - for (j = 0; j < neighbor->nrequest; j++) { - jrq = neighbor->requests[j]; - if (irq->same_kind(jrq) && jrq->skip == 0) break; - } - - if (j < neighbor->nrequest) irq->otherlist = j; - else { - int newrequest = neighbor->request(this); - neighbor->requests[newrequest]->copy_kind(irq); - irq->otherlist = newrequest; - } - } + PairHybrid::modify_requests(); } diff --git a/src/style_user_ackland.h b/src/style_user_ackland.h index 6e7483a9f7..e69de29bb2 100644 --- a/src/style_user_ackland.h +++ b/src/style_user_ackland.h @@ -1,20 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - http://lammps.sandia.gov, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifdef ComputeInclude -#include "compute_ackland_atom.h" -#endif - -#ifdef ComputeClass -ComputeStyle(ackland/atom,ComputeAcklandAtom) -#endif