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

This commit is contained in:
sjplimp
2012-06-14 23:20:23 +00:00
parent 9d1a80fecb
commit eed35157e7
2 changed files with 20 additions and 7 deletions

View File

@ -87,7 +87,8 @@ int FixShearHistory::setmask()
void FixShearHistory::init() void FixShearHistory::init()
{ {
if (atom->tag_enable == 0) if (atom->tag_enable == 0)
error->all(FLERR,"Pair style granular with history requires atoms have IDs"); error->all(FLERR,
"Pair style granular with history requires atoms have IDs");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -109,16 +110,24 @@ void FixShearHistory::pre_exchange()
int *touch,**firsttouch; int *touch,**firsttouch;
double *shear,*allshear,**firstshear; double *shear,*allshear,**firstshear;
// zero npartners for all current atoms // zero npartner for all current atoms
// do not do this if inum = 0, since will wipe out npartner counts
// inum is 0 when pre_exchange() is called from integrate->setup()
// before first run when no neighbor lists yet exist
// partner info may have just been read from restart file
// and won't be used until granular neighbor lists are built
// if nothing read from restart file, constructor sets npartner = 0
NeighList *list = pair->list;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
for (i = 0; i < nlocal; i++) npartner[i] = 0;
//if (list->inum)
for (i = 0; i < nlocal; i++)
npartner[i] = 0;
// copy shear info from neighbor list atoms to atom arrays // copy shear info from neighbor list atoms to atom arrays
int *tag = atom->tag; int *tag = atom->tag;
NeighList *list = pair->list;
inum = list->inum; inum = list->inum;
ilist = list->ilist; ilist = list->ilist;
numneigh = list->numneigh; numneigh = list->numneigh;
@ -167,7 +176,8 @@ void FixShearHistory::pre_exchange()
if (npartner[i] >= MAXTOUCH) flag = 1; if (npartner[i] >= MAXTOUCH) flag = 1;
int flag_all; int flag_all;
MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_SUM,world); MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_SUM,world);
if (flag_all) error->all(FLERR,"Too many touching neighbors - boost MAXTOUCH"); if (flag_all)
error->all(FLERR,"Too many touching neighbors - boost MAXTOUCH");
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------

View File

@ -95,9 +95,12 @@ void WriteRestart::command(int narg, char **arg)
lmp->init(); lmp->init();
// move atoms to new processors before writing file // move atoms to new processors before writing file
// enforce PBC before in case atoms are outside box // do pre_exchange so FixShearHistory will store
// current neigh info with atoms
// enforce PBC in case atoms are outside box
// call borders() to rebuild atom map since exchange() destroys map // call borders() to rebuild atom map since exchange() destroys map
if (modify->n_pre_exchange) modify->pre_exchange();
if (domain->triclinic) domain->x2lamda(atom->nlocal); if (domain->triclinic) domain->x2lamda(atom->nlocal);
domain->pbc(); domain->pbc();
domain->reset_box(); domain->reset_box();