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

This commit is contained in:
sjplimp
2014-05-02 14:29:05 +00:00
parent af5d91115f
commit a1c6c99ccc
3 changed files with 18 additions and 15 deletions

View File

@ -259,6 +259,14 @@ void FixEfield::post_force(int vflag)
memory->create(efield,maxatom,4,"efield:efield"); 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[0] = "potential energy" for added force
// fsum[123] = extra force added to atoms // fsum[123] = extra force added to atoms
@ -279,9 +287,7 @@ void FixEfield::post_force(int vflag)
if (qflag) { if (qflag) {
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (iregion >= 0 && if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue;
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
continue;
fx = q[i]*ex; fx = q[i]*ex;
fy = q[i]*ey; fy = q[i]*ey;
fz = q[i]*ez; fz = q[i]*ez;
@ -306,9 +312,7 @@ void FixEfield::post_force(int vflag)
double tx,ty,tz; double tx,ty,tz;
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (iregion >= 0 && if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue;
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
continue;
tx = ez*mu[i][1] - ey*mu[i][2]; tx = ez*mu[i][1] - ey*mu[i][2];
ty = ex*mu[i][2] - ez*mu[i][0]; ty = ex*mu[i][2] - ez*mu[i][0];
tz = ey*mu[i][0] - ex*mu[i][1]; tz = ey*mu[i][0] - ex*mu[i][1];
@ -354,9 +358,7 @@ void FixEfield::post_force(int vflag)
if (qflag) { if (qflag) {
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (iregion >= 0 && if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue;
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
continue;
if (xstyle == ATOM) fx = qe2f * q[i]*efield[i][0]; if (xstyle == ATOM) fx = qe2f * q[i]*efield[i][0];
else fx = q[i]*ex; else fx = q[i]*ex;
f[i][0] += fx; f[i][0] += fx;
@ -382,9 +384,7 @@ void FixEfield::post_force(int vflag)
double tx,ty,tz; double tx,ty,tz;
for (int i = 0; i < nlocal; i++) for (int i = 0; i < nlocal; i++)
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (iregion >= 0 && if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue;
!domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2]))
continue;
tx = ez*mu[i][1] - ey*mu[i][2]; tx = ez*mu[i][1] - ey*mu[i][2];
ty = ex*mu[i][2] - ez*mu[i][0]; ty = ex*mu[i][2] - ez*mu[i][0];
tz = ey*mu[i][0] - ex*mu[i][1]; tz = ey*mu[i][0] - ex*mu[i][1];

View File

@ -185,6 +185,9 @@ void FixEvaporate::pre_exchange()
// nbefore = # on procs before me // nbefore = # on procs before me
// list[ncount] = list of local indices of atoms I can delete // list[ncount] = list of local indices of atoms I can delete
Region *region = domain->regions[iregion];
region->prematch();
double **x = atom->x; double **x = atom->x;
int *mask = atom->mask; int *mask = atom->mask;
tagint *tag = atom->tag; tagint *tag = atom->tag;
@ -193,8 +196,7 @@ void FixEvaporate::pre_exchange()
int ncount = 0; int ncount = 0;
for (i = 0; i < nlocal; i++) for (i = 0; i < nlocal; i++)
if (mask[i] & groupbit) if (mask[i] & groupbit)
if (domain->regions[iregion]->match(x[i][0],x[i][1],x[i][2])) if (region->match(x[i][0],x[i][1],x[i][2])) list[ncount++] = i;
list[ncount++] = i;
int nall,nbefore; int nall,nbefore;
MPI_Allreduce(&ncount,&nall,1,MPI_INT,MPI_SUM,world); MPI_Allreduce(&ncount,&nall,1,MPI_INT,MPI_SUM,world);

View File

@ -89,8 +89,9 @@ void FixOneWay::init()
void FixOneWay::end_of_step() void FixOneWay::end_of_step()
{ {
Region *region = domain->regions[regionidx]; Region *region = domain->regions[regionidx];
const int idx = direction & XYZMASK; region->prematch();
const int idx = direction & XYZMASK;
const double * const * const x = atom->x; const double * const * const x = atom->x;
double * const * const v = atom->v; double * const * const v = atom->v;
const int *mask = atom->mask; const int *mask = atom->mask;