Commit ed9ce739 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@954 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 60da95b7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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];
+13 −5
Original line number Diff line number Diff line
@@ -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;
}

/* ----------------------------------------------------------------------
+5 −4
Original line number Diff line number Diff line
@@ -293,10 +293,11 @@ 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 || 
    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;

@@ -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 &&
+258 −6
Original line number Diff line number Diff line
@@ -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,218 @@ 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];

    for (jj = 0; jj < jnum; jj++) {
      j = joriginal = jlist[jj];
      if (j >= nall) j %= nall;
      if (ijskip[itype][type[j]]) continue;
      neighptr[n++] = 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");
  }

  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 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];
@@ -214,6 +426,32 @@ void Neighbor::skip_from(NeighList *list)
      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;
@@ -221,13 +459,27 @@ void Neighbor::skip_from(NeighList *list)
    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 another list
   create list which is simply a copy of parent list
------------------------------------------------------------------------- */

void Neighbor::copy_from(NeighList *list)
+1 −1
Original line number Diff line number Diff line
@@ -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
Loading