diff --git a/src/MISC/fix_efield.cpp b/src/MISC/fix_efield.cpp index c6b74b6857..c3d54098ed 100644 --- a/src/MISC/fix_efield.cpp +++ b/src/MISC/fix_efield.cpp @@ -259,6 +259,14 @@ void FixEfield::post_force(int vflag) memory->create(efield,maxatom,4,"efield:efield"); } + // update region if necessary + + Region *region = NULL; + if (iregion >= 0) { + region = domain->regions[iregion]; + region->prematch(); + } + // fsum[0] = "potential energy" for added force // fsum[123] = extra force added to atoms @@ -279,9 +287,7 @@ void FixEfield::post_force(int vflag) if (qflag) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (iregion >= 0 && - !domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) - continue; + if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; fx = q[i]*ex; fy = q[i]*ey; fz = q[i]*ez; @@ -306,9 +312,7 @@ void FixEfield::post_force(int vflag) double tx,ty,tz; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (iregion >= 0 && - !domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) - continue; + if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; tx = ez*mu[i][1] - ey*mu[i][2]; ty = ex*mu[i][2] - ez*mu[i][0]; tz = ey*mu[i][0] - ex*mu[i][1]; @@ -354,9 +358,7 @@ void FixEfield::post_force(int vflag) if (qflag) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (iregion >= 0 && - !domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) - continue; + if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; if (xstyle == ATOM) fx = qe2f * q[i]*efield[i][0]; else fx = q[i]*ex; f[i][0] += fx; @@ -382,9 +384,7 @@ void FixEfield::post_force(int vflag) double tx,ty,tz; for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { - if (iregion >= 0 && - !domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) - continue; + if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue; tx = ez*mu[i][1] - ey*mu[i][2]; ty = ex*mu[i][2] - ez*mu[i][0]; tz = ey*mu[i][0] - ex*mu[i][1]; diff --git a/src/MISC/fix_evaporate.cpp b/src/MISC/fix_evaporate.cpp index 208c944514..cbaa50db7d 100644 --- a/src/MISC/fix_evaporate.cpp +++ b/src/MISC/fix_evaporate.cpp @@ -185,6 +185,9 @@ void FixEvaporate::pre_exchange() // nbefore = # on procs before me // list[ncount] = list of local indices of atoms I can delete + Region *region = domain->regions[iregion]; + region->prematch(); + double **x = atom->x; int *mask = atom->mask; tagint *tag = atom->tag; @@ -193,8 +196,7 @@ void FixEvaporate::pre_exchange() int ncount = 0; for (i = 0; i < nlocal; i++) if (mask[i] & groupbit) - if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) - list[ncount++] = i; + if (region->match(x[i][0],x[i][1],x[i][2])) list[ncount++] = i; int nall,nbefore; MPI_Allreduce(&ncount,&nall,1,MPI_INT,MPI_SUM,world); diff --git a/src/MISC/fix_oneway.cpp b/src/MISC/fix_oneway.cpp index e0345de3fd..3945dbb29d 100644 --- a/src/MISC/fix_oneway.cpp +++ b/src/MISC/fix_oneway.cpp @@ -89,8 +89,9 @@ void FixOneWay::init() void FixOneWay::end_of_step() { Region *region = domain->regions[regionidx]; - const int idx = direction & XYZMASK; + region->prematch(); + const int idx = direction & XYZMASK; const double * const * const x = atom->x; double * const * const v = atom->v; const int *mask = atom->mask;