fix bug using the wrong flag variable and print warning only if a change was made
This commit is contained in:
@ -1873,6 +1873,7 @@ void Domain::set_boundary(int narg, char **arg, int flag)
|
|||||||
else zperiodic = 0;
|
else zperiodic = 0;
|
||||||
|
|
||||||
// record if we changed a periodic boundary to a non-periodic one
|
// record if we changed a periodic boundary to a non-periodic one
|
||||||
|
|
||||||
int pflag=0;
|
int pflag=0;
|
||||||
if ((periodicity[0] && !xperiodic)
|
if ((periodicity[0] && !xperiodic)
|
||||||
|| (periodicity[1] && !yperiodic)
|
|| (periodicity[1] && !yperiodic)
|
||||||
@ -1889,23 +1890,27 @@ void Domain::set_boundary(int narg, char **arg, int flag)
|
|||||||
boundary[1][0] >= 2 || boundary[1][1] >= 2 ||
|
boundary[1][0] >= 2 || boundary[1][1] >= 2 ||
|
||||||
boundary[2][0] >= 2 || boundary[2][1] >= 2) nonperiodic = 2;
|
boundary[2][0] >= 2 || boundary[2][1] >= 2) nonperiodic = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// force non-zero image flags to zero for non-periodic dimensions
|
||||||
|
// keep track if a change was made, so we can print a warning message
|
||||||
|
|
||||||
if (pflag) {
|
if (pflag) {
|
||||||
pflag = 0;
|
pflag = 0;
|
||||||
for (int i=0; i < atom->nlocal; ++i) {
|
for (int i=0; i < atom->nlocal; ++i) {
|
||||||
int xbox = (atom->image[i] & IMGMASK) - IMGMAX;
|
int xbox = (atom->image[i] & IMGMASK) - IMGMAX;
|
||||||
int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX;
|
int ybox = (atom->image[i] >> IMGBITS & IMGMASK) - IMGMAX;
|
||||||
int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX;
|
int zbox = (atom->image[i] >> IMG2BITS) - IMGMAX;
|
||||||
if (!xperiodic) { xbox = 0; pflag = 1; }
|
if ((!xperiodic) && (xbox != 0)) { xbox = 0; pflag = 1; }
|
||||||
if (!yperiodic) { ybox = 0; pflag = 1; }
|
if ((!yperiodic) && (ybox != 0)) { ybox = 0; pflag = 1; }
|
||||||
if (!zperiodic) { zbox = 0; pflag = 1; }
|
if ((!zperiodic) && (zbox != 0)) { zbox = 0; pflag = 1; }
|
||||||
atom->image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) |
|
atom->image[i] = ((imageint) (xbox + IMGMAX) & IMGMASK) |
|
||||||
(((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) |
|
(((imageint) (ybox + IMGMAX) & IMGMASK) << IMGBITS) |
|
||||||
(((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS);
|
(((imageint) (zbox + IMGMAX) & IMGMASK) << IMG2BITS);
|
||||||
}
|
}
|
||||||
int flag_all;
|
int flag_all;
|
||||||
MPI_Allreduce(&flag,&flag_all, 1, MPI_INT, MPI_SUM, world);
|
MPI_Allreduce(&pflag,&flag_all, 1, MPI_INT, MPI_SUM, world);
|
||||||
if ((flag_all > 0) && (comm->me == 0))
|
if ((flag_all > 0) && (comm->me == 0))
|
||||||
error->warning(FLERR,"Reset image flags for non-periodic boundary");
|
error->warning(FLERR,"Resetting image flags for non-periodic dimensions");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user