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

This commit is contained in:
sjplimp 2008-08-21 13:53:19 +00:00
parent 9897ee73bf
commit 4fbc6f42c0
5 changed files with 41 additions and 35 deletions

View File

@ -62,6 +62,7 @@ Comm::Comm(LAMMPS *lmp) : Pointers(lmp)
style = SINGLE;
multilo = multihi = NULL;
cutghostmulti = NULL;
cutghostuser = 0.0;
// initialize comm buffers & exchange memory
@ -215,14 +216,14 @@ void Comm::init()
/* ----------------------------------------------------------------------
setup spatial-decomposition communication patterns
function of neighbor cutoff(s) and current box size
function of neighbor cutoff(s) & cutghostuser & current box size
single style sets slab boundaries (slablo,slabhi) based on max cutoff
multi style sets type-dependent slab boundaries (multilo,multihi)
------------------------------------------------------------------------- */
void Comm::setup()
{
// cutghost = max distance at which ghost atoms need to be acquired
// cutghost[] = max distance at which ghost atoms need to be acquired
// for orthogonal:
// cutghost is in box coords = neigh->cutghost in all 3 dims
// for triclinic:
@ -235,17 +236,21 @@ void Comm::setup()
int ntypes = atom->ntypes;
double *prd,*sublo,*subhi;
double cut = MAX(neighbor->cutneighmax,cutghostuser);
if (triclinic == 0) {
prd = domain->prd;
sublo = domain->sublo;
subhi = domain->subhi;
cutghost[0] = cutghost[1] = cutghost[2] = neighbor->cutghost;
cutghost[0] = cutghost[1] = cutghost[2] = cut;
if (style == MULTI) {
double *cuttype = neighbor->cuttype;
for (i = 1; i <= ntypes; i++)
cutghostmulti[i][0] = cutghostmulti[i][1] = cutghostmulti[i][2] =
cuttype[i];
}
} else {
prd = domain->prd_lamda;
sublo = domain->sublo_lamda;
@ -253,11 +258,12 @@ void Comm::setup()
double *h_inv = domain->h_inv;
double length0,length1,length2;
length0 = sqrt(h_inv[0]*h_inv[0] + h_inv[5]*h_inv[5] + h_inv[4]*h_inv[4]);
cutghost[0] = neighbor->cutghost * length0;
cutghost[0] = cut * length0;
length1 = sqrt(h_inv[1]*h_inv[1] + h_inv[3]*h_inv[3]);
cutghost[1] = neighbor->cutghost * length1;
cutghost[1] = cut * length1;
length2 = h_inv[2];
cutghost[2] = neighbor->cutghost * length2;
cutghost[2] = cut * length2;
if (style == MULTI) {
double *cuttype = neighbor->cuttype;
for (i = 1; i <= ntypes; i++) {
@ -1524,11 +1530,17 @@ void Comm::set(int narg, char **arg)
if (iarg+2 > narg) error->all("Illegal communicate command");
bordergroup = group->find(arg[iarg+1]);
if (bordergroup < 0)
error->all("Invalid group ID in communicate command");
error->all("Invalid group in communicate command");
if (bordergroup && (atom->firstgroupname == NULL ||
strcmp(arg[iarg+1],atom->firstgroupname) != 0))
error->all("Communicate group != atom_modify first group");
iarg += 2;
} else if (strcmp(arg[iarg],"cutoff") == 0) {
if (iarg+2 > narg) error->all("Illegal communicate command");
cutghostuser = atof(arg[iarg+1]);
if (cutghostuser < 0.0)
error->all("Invalid cutoff in communicate command");
iarg += 2;
} else error->all("Illegal communicate command");
}
}

View File

@ -72,6 +72,7 @@ class Comm : protected Pointers {
int map_style; // non-0 if global->local mapping is done
int ***grid2proc; // which proc owns i,j,k loc in 3d grid
int bordergroup; // only communicate this group in borders
double cutghostuser; // user-specified ghost cutoff
int *firstrecv; // where to put 1st recv atom in each swap
int **sendlist; // list of atoms to send in each swap

View File

@ -200,8 +200,8 @@ void DeleteAtoms::delete_overlap(int narg, char **arg)
// error check on cutoff
if (cut > neighbor->cutghost)
error->all("Delete_atoms cutoff > ghost cutoff");
if (cut > neighbor->cutneighmax)
error->all("Delete_atoms cutoff > neighbor cutoff");
// setup domain, communication and neighboring
// acquire ghosts

View File

@ -201,15 +201,9 @@ void Neighbor::init()
// set neighbor cutoffs (force cutoff + skin)
// trigger determines when atoms migrate and neighbor lists are rebuilt
// cutneigh and cutneighsq determine what pairs go into neighbor list
// set to 0 if cutforce = 0
// cutneighmin/max used for neighbor bin sizes
// cutghost determines comm distance = max of cutneigh & skin
// 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
// needs to be non-zero for migration distance check
// even if pair = NULL and no neighbor lists are used
// cutneigh = force cutoff + skin if cutforce > 0, else cutneigh = 0
triggersq = 0.25*skin*skin;
@ -240,7 +234,6 @@ void Neighbor::init()
cutneighmax = MAX(cutneighmax,cut);
}
}
cutghost = MAX(cutneighmax,skin);
cutneighmaxsq = cutneighmax * cutneighmax;
// check other classes that can induce reneighboring in decide()
@ -1053,7 +1046,7 @@ void Neighbor::setup_bins()
{
// bbox lo/hi = bounding box of entire domain
// bbox = size of bbox of entire domain
// bsubbox lo/hi = bounding box of my subdomain extended by ghost atoms
// bsubbox lo/hi = bounding box of my subdomain extended by comm->cutghost
// for triclinic:
// bbox bounds all 8 corners of tilted box
// subdomain is in lamda coords
@ -1061,26 +1054,27 @@ void Neighbor::setup_bins()
// domain->bbox() converts lamda extent to box coords and computes bbox
double bbox[3],bsubboxlo[3],bsubboxhi[3];
double *cutghost = comm->cutghost;
if (triclinic == 0) {
bboxlo = domain->boxlo;
bboxhi = domain->boxhi;
bsubboxlo[0] = domain->sublo[0] - cutghost;
bsubboxlo[1] = domain->sublo[1] - cutghost;
bsubboxlo[2] = domain->sublo[2] - cutghost;
bsubboxhi[0] = domain->subhi[0] + cutghost;
bsubboxhi[1] = domain->subhi[1] + cutghost;
bsubboxhi[2] = domain->subhi[2] + cutghost;
bsubboxlo[0] = domain->sublo[0] - cutghost[0];
bsubboxlo[1] = domain->sublo[1] - cutghost[1];
bsubboxlo[2] = domain->sublo[2] - cutghost[2];
bsubboxhi[0] = domain->subhi[0] + cutghost[0];
bsubboxhi[1] = domain->subhi[1] + cutghost[1];
bsubboxhi[2] = domain->subhi[2] + cutghost[2];
} else {
bboxlo = domain->boxlo_bound;
bboxhi = domain->boxhi_bound;
double lo[3],hi[3];
lo[0] = domain->sublo_lamda[0] - comm->cutghost[0];
lo[1] = domain->sublo_lamda[1] - comm->cutghost[1];
lo[2] = domain->sublo_lamda[2] - comm->cutghost[2];
hi[0] = domain->subhi_lamda[0] + comm->cutghost[0];
hi[1] = domain->subhi_lamda[1] + comm->cutghost[1];
hi[2] = domain->subhi_lamda[2] + comm->cutghost[2];
lo[0] = domain->sublo_lamda[0] - cutghost[0];
lo[1] = domain->sublo_lamda[1] - cutghost[1];
lo[2] = domain->sublo_lamda[2] - cutghost[2];
hi[0] = domain->subhi_lamda[0] + cutghost[0];
hi[1] = domain->subhi_lamda[1] + cutghost[1];
hi[2] = domain->subhi_lamda[2] + cutghost[2];
domain->bbox(lo,hi,bsubboxlo,bsubboxhi);
}

View File

@ -29,7 +29,8 @@ class Neighbor : protected Pointers {
int oneatom; // max # of neighbors for one atom
double skin; // skin distance
double cutghost; // distance for acquiring ghost atoms
double cutneighmin; // min neighbor cutoff for all type pairs
double cutneighmax; // max neighbor cutoff for all type pairs
double *cuttype; // for each type, max neigh cut w/ others
int ncalls; // # of times build has been called
@ -81,8 +82,6 @@ class Neighbor : protected Pointers {
int *fixchecklist; // which fixes to check
double **cutneighsq; // neighbor cutneigh sq for each type pair
double cutneighmin; // min neighbor cutoff (for cutforce > 0)
double cutneighmax; // max neighbor cutoff for all type pairs
double cutneighmaxsq; // cutneighmax squared
double *cuttypesq; // cuttype squared