Fixing indexing error in fix rheo arg parsing

This commit is contained in:
Joel Thomas Clemmer
2025-04-17 13:49:36 -06:00
parent 2ca9e188c0
commit e1e87cc9ef

View File

@ -118,17 +118,17 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) :
shift_flag = 1;
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);
while (iarg + 1 < narg) { // optional sub-arguments
if (strcmp(arg[iarg + 1], "scale/cross/type") == 0) {
if (iarg + 4 >= 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_cmin = utils::numeric(FLERR, arg[iarg + 2], false, lmp);
shift_wmin = utils::numeric(FLERR, arg[iarg + 3], false, lmp);
shift_scale = utils::numeric(FLERR, arg[iarg + 2], false, lmp);
shift_cmin = utils::numeric(FLERR, arg[iarg + 3], false, lmp);
shift_wmin = utils::numeric(FLERR, arg[iarg + 4], false, lmp);
iarg += 3;
} else if (strcmp(arg[iarg], "exclude/type") == 0) {
if (iarg + 1 >= narg) utils::missing_cmd_args(FLERR, "fix rheo shift exclude/type", error);
utils::bounds(FLERR, arg[iarg + 1], 1, n, nlo, nhi, error);
} else if (strcmp(arg[iarg + 1], "exclude/type") == 0) {
if (iarg + 2 >= narg) utils::missing_cmd_args(FLERR, "fix rheo shift exclude/type", error);
utils::bounds(FLERR, arg[iarg + 2], 1, n, nlo, nhi, error);
for (i = nlo; i <= nhi; i++) shift_type[i] = 0;
iarg += 1;
} else {