diff --git a/src/force.cpp b/src/force.cpp index f70d67413e2e184016a085f7d427c1df0a06f692..7b890302e3e13a5477eae6cea49983e1a86bc2c7 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -105,7 +105,6 @@ void Force::init() if (kspace) kspace->init(); // kspace must come before pair if (pair) pair->init(); // so g_ewald is defined - if (bond) bond->init(); if (angle) angle->init(); if (dihedral) dihedral->init(); if (improper) improper->init(); diff --git a/src/neighbor.cpp b/src/neighbor.cpp index eed5a92203fa343ba3b7cd466d8a7ff1e3098962..1b6cbccad5a2f6b4eac2a63ed01864f958b46bf2 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -208,7 +208,11 @@ void Neighbor::init() // cutneigh = force cutoff + skin if cutforce > 0, else cutneigh = 0 triggersq = 0.25*skin*skin; - + shrinkcheck = 0; + if (domain->box_change && (domain->xperiodic || domain->yperiodic || + (dimension == 3 && domain->zperiodic))) + shrinkcheck = 1; + n = atom->ntypes; if (cutneighsq == NULL) { cutneighsq = memory->create_2d_double_array(n+1,n+1,"neigh:cutneighsq"); @@ -996,11 +1000,23 @@ int Neighbor::decide() } else return 0; } -/* ---------------------------------------------------------------------- */ +/* ---------------------------------------------------------------------- + if any atom moved trigger distance (half of neighbor skin) return 1 + shrink trigger distance if periodic box dimension has decreased +------------------------------------------------------------------------- */ int Neighbor::check_distance() { - double delx,dely,delz,rsq; + double delx,dely,delz,rsq,deltasq; + + if (shrinkcheck) { + double delta = 0.0; + if (domain->xperiodic) delta = MIN(delta,domain->xprd-xprdhold); + if (domain->yperiodic) delta = MIN(delta,domain->yprd-yprdhold); + if (domain->zperiodic) delta = MIN(delta,domain->zprd-zprdhold); + delta = 0.5*skin - delta; + deltasq = delta*delta; + } else deltasq = triggersq; double **x = atom->x; int nlocal = atom->nlocal; @@ -1012,7 +1028,7 @@ int Neighbor::check_distance() dely = x[i][1] - xhold[i][1]; delz = x[i][2] - xhold[i][2]; rsq = delx*delx + dely*dely + delz*delz; - if (rsq > triggersq) flag = 1; + if (rsq > deltasq) flag = 1; } int flagall; @@ -1033,7 +1049,7 @@ void Neighbor::build() ago = 0; ncalls++; - // store current atom positions if needed + // store current atom positions and box size if needed if (dist_check) { double **x = atom->x; @@ -1049,6 +1065,9 @@ void Neighbor::build() xhold[i][1] = x[i][1]; xhold[i][2] = x[i][2]; } + xprdhold = domain->xprd; + yprdhold = domain->yprd; + zprdhold = domain->zprd; } // if necessary, extend atom arrays in pairwise lists diff --git a/src/neighbor.h b/src/neighbor.h index fcf7600a05a429e4e7d3a82572adbe26ecbe22f9..3185e6563ccbbd4ace7fe5ff4a61ad3815389312 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -91,8 +91,10 @@ class Neighbor : protected Pointers { double triggersq; // trigger = build when atom moves this dist - double **xhold; // atom coords at last neighbor build - int maxhold; // size of xhold array + double **xhold; // atom coords at last neighbor build + int maxhold; // size of xhold array + double xprdhold,yprdhold,zprdhold; // box size at last neighbor build + int shrinkcheck; int nbinx,nbiny,nbinz; // # of global bins int *bins; // ptr to next atom in each bin