diff --git a/src/RHEO/compute_rheo_vshift.cpp b/src/RHEO/compute_rheo_vshift.cpp index 0047521e37..801b65fe3b 100644 --- a/src/RHEO/compute_rheo_vshift.cpp +++ b/src/RHEO/compute_rheo_vshift.cpp @@ -81,8 +81,8 @@ void ComputeRHEOVShift::init() cutsq = cut * cut; cutthird = cut / 3.0; - multiphase_flag = fix_rheo->shift_multiphase_flag; - if (multiphase_flag) { + cross_type_flag = fix_rheo->shift_cross_type_flag; + if (cross_type_flag) { scale = fix_rheo->shift_scale; wmin = fix_rheo->shift_wmin; cmin = fix_rheo->shift_cmin; @@ -134,7 +134,7 @@ void ComputeRHEOVShift::compute_peratom() if (nmax_store < atom->nmax) { memory->grow(vshift, atom->nmax, 3, "rheo:vshift"); - if (multiphase_flag) { + if (cross_type_flag) { memory->grow(ct, atom->nmax, "rheo:ct"); memory->grow(cgradt, atom->nmax, 3, "rheo:cgradt"); memory->grow(wsame, atom->nmax, "rheo:wsame"); @@ -254,7 +254,7 @@ void ComputeRHEOVShift::compute_peratom() for (a = 0; a < dim; a++) vshift[i][a] = 0.0; - if (multiphase_flag) correct_interfaces(); + if (cross_type_flag) correct_interfaces(); } /* ---------------------------------------------------------------------- */ @@ -624,7 +624,7 @@ double ComputeRHEOVShift::memory_usage() { double bytes = 3 * nmax_store * sizeof(double); - if (multiphase_flag) + if (cross_type_flag) bytes += 5 * nmax_store * sizeof(double); return bytes; diff --git a/src/RHEO/compute_rheo_vshift.h b/src/RHEO/compute_rheo_vshift.h index 5d763ab008..04512c9740 100644 --- a/src/RHEO/compute_rheo_vshift.h +++ b/src/RHEO/compute_rheo_vshift.h @@ -46,7 +46,7 @@ class ComputeRHEOVShift : public Compute { int nmax_store, comm_stage; double dtv, cut, cutsq, cutthird; double scale, wmin, cmin; - int surface_flag, interface_flag, multiphase_flag; + int surface_flag, interface_flag, cross_type_flag; double *rho0; double *wsame, *ct, **cgradt; int *shift_type; diff --git a/src/RHEO/fix_rheo.cpp b/src/RHEO/fix_rheo.cpp index 806ef0873c..06ffa654af 100644 --- a/src/RHEO/fix_rheo.cpp +++ b/src/RHEO/fix_rheo.cpp @@ -52,9 +52,9 @@ static const char cite_rheo[] = /* ---------------------------------------------------------------------- */ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), rho0(nullptr), csq(nullptr), compute_grad(nullptr), - compute_kernel(nullptr), compute_interface(nullptr), compute_surface(nullptr), - compute_rhosum(nullptr), compute_vshift(nullptr) + Fix(lmp, narg, arg), rho0(nullptr), csq(nullptr), shift_type(nullptr), + compute_grad(nullptr), compute_kernel(nullptr), compute_interface(nullptr), + compute_surface(nullptr), compute_rhosum(nullptr), compute_vshift(nullptr) { time_integrate = 1; @@ -68,20 +68,18 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : shift_flag = 0; interface_flag = 0; surface_flag = 0; - oxidation_flag = 0; - self_mass_flag = 0; coordination_flag = 0; - shift_multiphase_flag = 0; + + rhosum_self_mass_flag = 0; + shift_cross_type_flag = 0; int i; int n = atom->ntypes; memory->create(rho0, n + 1, "rheo:rho0"); memory->create(csq, n + 1, "rheo:csq"); - memory->create(shift_type, n + 1, "rheo:shift_type"); for (i = 1; i <= n; i++) { rho0[i] = 1.0; csq[i] = 1.0; - shift_type[i] = 1; } if (igroup != 0) error->all(FLERR, "fix rheo command requires group all"); @@ -115,19 +113,26 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : while (iarg < narg) { if (strcmp(arg[iarg], "shift") == 0) { shift_flag = 1; - } else if (strcmp(arg[iarg], "shift/multiphase/scale") == 0) { - if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo shift/multiphase/scale", error); - shift_multiphase_flag = 1; - shift_scale = utils::numeric(FLERR, arg[iarg + 1], false, lmp); - shift_wmin = utils::numeric(FLERR, arg[iarg + 2], false, lmp); - shift_cmin = utils::numeric(FLERR, arg[iarg + 3], false, lmp); - iarg += 3; - } else if (strcmp(arg[iarg], "shift/type") == 0) { - if (iarg + n >= narg) utils::missing_cmd_args(FLERR, "fix rheo shift/type", error); - for (i = 1; i <= n; i++) { - shift_type[i] = utils::logical(FLERR, arg[iarg + i], false, lmp); + memory->create(shift_type, n + 1, "rheo:shift_type"); + for (i = 1; i <= n; i++) shift_type[i] = 1; + while (iarg < narg) { // optional sub-arguments + if (strcmp(arg[iarg], "scale/cross/type") == 0) { + if (iarg + 3 >= narg) utils::missing_cmd_args(FLERR, "fix rheo shift scale/cross/type", error); + shift_cross_type_flag = 1; + shift_scale = utils::numeric(FLERR, arg[iarg + 1], false, lmp); + shift_wmin = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + shift_cmin = utils::numeric(FLERR, arg[iarg + 3], false, lmp); + iarg += 3; + } else if (strcmp(arg[iarg], "exclude/type") == 0) { + if (iarg + n >= narg) utils::missing_cmd_args(FLERR, "fix rheo shift exclude/type", error); + for (i = 1; i <= n; i++) + shift_type[i] = utils::logical(FLERR, arg[iarg + i], false, lmp); + iarg += n; + } else { + break; + } + iarg += 1; } - iarg += n; } else if (strcmp(arg[iarg], "thermal") == 0) { thermal_flag = 1; } else if (strcmp(arg[iarg], "surface/detection") == 0) { @@ -149,8 +154,14 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : interface_flag = 1; } else if (strcmp(arg[iarg], "rho/sum") == 0) { rhosum_flag = 1; - } else if (strcmp(arg[iarg], "self/mass") == 0) { - self_mass_flag = 1; + while (iarg < narg) { // optional sub-arguments + if (strcmp(arg[iarg], "self/mass") == 0) { + rhosum_self_mass_flag = 1; + } else { + break; + } + iarg += 1; + } } else if (strcmp(arg[iarg], "density") == 0) { if (iarg + n >= narg) utils::missing_cmd_args(FLERR, "fix rheo density", error); for (i = 1; i <= n; i++) rho0[i] = utils::numeric(FLERR, arg[iarg + i], false, lmp); @@ -168,12 +179,6 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) : iarg += 1; } - if ((!shift_flag) && shift_multiphase_flag) - error->all(FLERR, "Cannot use shift/multiphase/scale without shifting"); - - if (self_mass_flag && (!rhosum_flag)) - error->all(FLERR, "Cannot use self/mass setting without rho/sum"); - #if 0 if (lmp->citeme) lmp->citeme->add(cite_rheo); #endif @@ -212,7 +217,7 @@ void FixRHEO::post_constructor() if (rhosum_flag) { compute_rhosum = dynamic_cast( - modify->add_compute(fmt::format("rheo_rhosum all RHEO/RHO/SUM {}", self_mass_flag))); + modify->add_compute(fmt::format("rheo_rhosum all RHEO/RHO/SUM {}", rhosum_self_mass_flag))); compute_rhosum->fix_rheo = this; } diff --git a/src/RHEO/fix_rheo.h b/src/RHEO/fix_rheo.h index acad9f0321..aa80bc938e 100644 --- a/src/RHEO/fix_rheo.h +++ b/src/RHEO/fix_rheo.h @@ -41,23 +41,25 @@ class FixRHEO : public Fix { // Model parameters double cut; double *rho0, *csq; - int *shift_type; - int self_mass_flag; int zmin_kernel, zmin_surface, zmin_splash; int kernel_style, surface_style; double divr_surface; + + // Settings flags + int thermal_flag; + int rhosum_flag; + int interface_flag; + int surface_flag; + int shift_flag; + int coordination_flag; + + // Optional sub-flags/parameters + int rhosum_self_mass_flag; + int *shift_type; + int shift_cross_type_flag; double shift_scale, shift_wmin, shift_cmin; // Accessory fixes/computes - int thermal_flag; - int rhosum_flag; - int shift_flag; - int interface_flag; - int surface_flag; - int oxidation_flag; - int coordination_flag; - int shift_multiphase_flag; - int viscosity_fix_defined; int pressure_fix_defined; int thermal_fix_defined;