diff --git a/src/domain.cpp b/src/domain.cpp index 97dbe265c5..85b78407c3 100644 --- a/src/domain.cpp +++ b/src/domain.cpp @@ -108,13 +108,20 @@ Domain::~Domain() void Domain::init() { - // set box_change if box dimensions/shape ever changes - // due to shrink-wrapping, fixes that change volume (npt, vol/rescale, etc) + // set box_change flags if box size/shape/sub-domains ever change + // due to shrink-wrapping or fixes that change box size/shape/sub-domains + + box_change_size = box_change_shape = box_change_domain = 0; + + if (nonperiodic == 2) box_change_size = 1; + for (int i = 0; i < modify->nfix; i++) { + if (modify->fix[i]->box_change_size) box_change_size = 1; + if (modify->fix[i]->box_change_shape) box_change_shape = 1; + if (modify->fix[i]->box_change_domain) box_change_domain = 1; + } box_change = 0; - if (nonperiodic == 2) box_change = 1; - for (int i = 0; i < modify->nfix; i++) - if (modify->fix[i]->box_change) box_change = 1; + if (box_change_size || box_change_shape || box_change_domain) box_change = 1; // check for fix deform diff --git a/src/domain.h b/src/domain.h index df97793b44..1a48e4ee79 100644 --- a/src/domain.h +++ b/src/domain.h @@ -75,7 +75,11 @@ class Domain : protected Pointers { double h[6],h_inv[6]; // shape matrix in Voigt notation double h_rate[6],h_ratelo[3]; // rate of box size/shape change - int box_change; // 1 if box bounds ever change, 0 if fixed + int box_change; // 1 if any of next 3 flags are set, else 0 + int box_change_size; // 1 if box size changes, 0 if not + int box_change_shape; // 1 if box shape changes, 0 if not + int box_change_domain; // 1 if proc sub-domains change, 0 if not + int deform_flag; // 1 if fix deform exist, else 0 int deform_vremap; // 1 if fix deform remaps v, else 0 int deform_groupbit; // atom group to perform v remap for diff --git a/src/fix.cpp b/src/fix.cpp index 56045e8573..50857340ad 100644 --- a/src/fix.cpp +++ b/src/fix.cpp @@ -49,9 +49,7 @@ Fix::Fix(LAMMPS *lmp, int narg, char **arg) : Pointers(lmp) restart_global = 0; restart_peratom = 0; force_reneighbor = 0; - box_change = 0; - box_change_size = 0; - box_change_shape = 0; + box_change_size = box_change_shape = box_change_domain = 0; thermo_energy = 0; rigid_flag = 0; virial_flag = 0; diff --git a/src/fix.h b/src/fix.h index 0123aba0f2..77f0b72aea 100644 --- a/src/fix.h +++ b/src/fix.h @@ -26,9 +26,11 @@ class Fix : protected Pointers { int restart_global; // 1 if Fix saves global state, 0 if not int restart_peratom; // 1 if Fix saves peratom state, 0 if not int force_reneighbor; // 1 if Fix forces reneighboring, 0 if not - int box_change; // 1 if Fix changes box, 0 if not + int box_change_size; // 1 if Fix changes box size, 0 if not int box_change_shape; // 1 if Fix changes box shape, 0 if not + int box_change_domain; // 1 if Fix changes proc sub-domains, 0 if not + bigint next_reneighbor; // next timestep to force a reneighboring int thermo_energy; // 1 if fix_modify enabled ThEng, 0 if not int nevery; // how often to call an end_of_step fix diff --git a/src/fix_ave_spatial.cpp b/src/fix_ave_spatial.cpp index a644aab323..e83115f029 100644 --- a/src/fix_ave_spatial.cpp +++ b/src/fix_ave_spatial.cpp @@ -75,7 +75,8 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) : else if (strcmp(arg[iarg+1],"center") == 0) originflag[ndim] = CENTER; else if (strcmp(arg[iarg+1],"upper") == 0) originflag[ndim] = UPPER; else originflag[ndim] = COORD; - if (originflag[ndim] == COORD) origin[ndim] = force->numeric(FLERR,arg[iarg+1]); + if (originflag[ndim] == COORD) + origin[ndim] = force->numeric(FLERR,arg[iarg+1]); delta[ndim] = force->numeric(FLERR,arg[iarg+2]); ndim++; @@ -441,8 +442,9 @@ void FixAveSpatial::init() // # of bins cannot vary for ave = RUNNING or WINDOW if (ave == RUNNING || ave == WINDOW) { - if (scaleflag != REDUCED && domain->box_change) - error->all(FLERR,"Fix ave/spatial settings invalid with changing box"); + if (scaleflag != REDUCED && domain->box_change_size) + error->all(FLERR, + "Fix ave/spatial settings invalid with changing box size"); } // set indices and check validity of all computes,fixes,variables diff --git a/src/fix_balance.cpp b/src/fix_balance.cpp index 5ee057ab5f..316140be3c 100644 --- a/src/fix_balance.cpp +++ b/src/fix_balance.cpp @@ -34,7 +34,7 @@ FixBalance::FixBalance(LAMMPS *lmp, int narg, char **arg) : { if (narg < 7) error->all(FLERR,"Illegal fix balance command"); - box_change = 1; + box_change_domain = 1; scalar_flag = 1; extscalar = 0; vector_flag = 1; diff --git a/src/fix_box_relax.cpp b/src/fix_box_relax.cpp index dea4e507a3..8f2a1bf253 100644 --- a/src/fix_box_relax.cpp +++ b/src/fix_box_relax.cpp @@ -48,7 +48,6 @@ FixBoxRelax::FixBoxRelax(LAMMPS *lmp, int narg, char **arg) : scalar_flag = 1; extscalar = 1; global_freq = 1; - box_change = 1; no_change_box = 1; // default values diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index 74bb8fa3e9..e62776c32c 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -50,7 +50,6 @@ FixDeform::FixDeform(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { if (narg < 4) error->all(FLERR,"Illegal fix deform command"); - box_change = 1; no_change_box = 1; nevery = force->inumeric(FLERR,arg[3]); diff --git a/src/fix_nh.cpp b/src/fix_nh.cpp index 5fc51a8e5e..5e0eb3aeff 100644 --- a/src/fix_nh.cpp +++ b/src/fix_nh.cpp @@ -427,7 +427,6 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) if (p_flag[i]) pstat_flag = 1; if (pstat_flag) { - box_change = 1; if (p_flag[0] || p_flag[1] || p_flag[2]) box_change_size = 1; if (p_flag[3] || p_flag[4] || p_flag[5]) box_change_shape = 1; no_change_box = 1; diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index cb6ab21542..f4e86f74c9 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -41,7 +41,6 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : { if (narg < 5) error->all(FLERR,"Illegal fix press/berendsen command"); - box_change = 1; box_change_size = 1; // Berendsen barostat applied every step diff --git a/src/fix_viscosity.cpp b/src/fix_viscosity.cpp index 8006c93a75..ee94a6e6a3 100644 --- a/src/fix_viscosity.cpp +++ b/src/fix_viscosity.cpp @@ -73,7 +73,8 @@ FixViscosity::FixViscosity(LAMMPS *lmp, int narg, char **arg) : if (strcmp(arg[iarg],"swap") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix viscosity command"); nswap = force->inumeric(FLERR,arg[iarg+1]); - if (nswap <= 0) error->all(FLERR,"Fix viscosity swap value must be positive"); + if (nswap <= 0) + error->all(FLERR,"Fix viscosity swap value must be positive"); iarg += 2; } else if (strcmp(arg[iarg],"vtarget") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal fix viscosity command");