git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5847 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp 2011-03-26 20:36:43 +00:00
parent 161a6cb788
commit 1ea4501637
3 changed files with 24 additions and 19 deletions

View File

@ -20,6 +20,12 @@
#include "memory.h"
#include "error.h"
#include "update.h"
using namespace LAMMPS_NS;
#define PGDELTA 1
@ -105,18 +111,14 @@ NeighList::~NeighList()
/* ----------------------------------------------------------------------
grow atom arrays to allow for nmax atoms
triggered by more atoms on a processor
caller knows if this list stores neighs of local atoms or local+ghost
------------------------------------------------------------------------- */
void NeighList::grow(int nmax)
{
// skip if grow not needed by this list
// each list stores own maxatoms, b/c list->grow() called at different times
// if list does not store neighbors of ghosts, compare nmax to maxatoms
// else compare nlocal+nghost to maxatoms
// if reset list size, set it to nmax
// skip if this list is already long enough to store nmax atoms
if (!ghostflag && atom->nlocal <= maxatoms) return;
if (ghostflag && atom->nlocal+atom->nghost <= maxatoms) return;
if (nmax <= maxatoms) return;
maxatoms = nmax;
memory->destroy(ilist);

View File

@ -106,7 +106,7 @@ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp)
// pair lists
maxlocal = 0;
maxatom = 0;
nblist = nglist = nslist = 0;
nlist = 0;
@ -590,10 +590,10 @@ void Neighbor::init()
// allocate atom arrays and 1st pages of lists that store them
maxlocal = atom->nmax;
maxatom = atom->nmax;
for (i = 0; i < nlist; i++)
if (lists[i]->growflag) {
lists[i]->grow(maxlocal);
lists[i]->grow(maxatom);
lists[i]->add_pages();
}
@ -1151,13 +1151,16 @@ void Neighbor::build()
}
// if any lists store neighbors of ghosts:
// invoke grow() on all in case nlocal+nghost is now too big
// else only invoke grow() if nlocal has exceeded previous list size
// only for lists with growflag set and which are perpetual
// invoke grow() if nlocal+nghost exceeds previous list size
// else only invoke grow() if nlocal exceeds previous list size
// only done for lists with growflag set and which are perpetual
if (anyghostlist || atom->nlocal > maxlocal) {
maxlocal = atom->nmax;
for (i = 0; i < nglist; i++) lists[glist[i]]->grow(maxlocal);
if (anyghostlist && atom->nlocal+atom->nghost > maxatom) {
maxatom = atom->nmax;
for (i = 0; i < nglist; i++) lists[glist[i]]->grow(maxatom);
} else if (atom->nlocal > maxatom) {
maxatom = atom->nmax;
for (i = 0; i < nglist; i++) lists[glist[i]]->grow(maxatom);
}
// extend atom bin list if necessary
@ -1199,14 +1202,14 @@ void Neighbor::build_one(int i)
{
// update stencils and grow atom arrays and bins as needed
// only for relevant settings of stencilflag and growflag
// do not reset maxlocal to atom->nmax, since not all lists are being grown
// grow atom array for this list to current size of perpetual lists
if (lists[i]->stencilflag) {
lists[i]->stencil_allocate(smax,style);
(this->*stencil_create[i])(lists[i],sx,sy,sz);
}
if (lists[i]->growflag) lists[i]->grow(maxlocal);
if (lists[i]->growflag) lists[i]->grow(maxatom);
if (style != NSQ && atom->nmax > maxbin) {
maxbin = atom->nmax;

View File

@ -76,7 +76,7 @@ class Neighbor : protected Pointers {
private:
int me,nprocs;
int maxlocal; // size of atom-based NeighList arrays
int maxatom; // size of atom-based NeighList arrays
int maxbond,maxangle,maxdihedral,maximproper; // size of bond lists
int maxwt; // max weighting factor applied + 1