use accessor function to get and process list of fixes

This commit is contained in:
Axel Kohlmeyer
2022-03-16 14:18:09 -04:00
parent 4be3da727a
commit 7e2fef096f
6 changed files with 31 additions and 53 deletions

View File

@ -91,8 +91,7 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) :
if (which[i] == ArgInfo::COMPUTE) {
int icompute = modify->find_compute(ids[i]);
if (icompute < 0)
error->all(FLERR,"Compute ID for compute chunk/spread/atom "
"does not exist");
error->all(FLERR,"Compute ID for compute chunk/spread/atom does not exist");
if (!utils::strmatch(modify->compute[icompute]->style,"/chunk$"))
error->all(FLERR,"Compute for compute chunk/spread/atom "
@ -100,32 +99,26 @@ ComputeChunkSpreadAtom(LAMMPS *lmp, int narg, char **arg) :
if (argindex[i] == 0) {
if (!modify->compute[icompute]->vector_flag)
error->all(FLERR,"Compute chunk/spread/atom compute "
"does not calculate global vector");
error->all(FLERR,"Compute chunk/spread/atom compute does not calculate global vector");
} else {
if (!modify->compute[icompute]->array_flag)
error->all(FLERR,"Compute chunk/spread/atom compute "
"does not calculate global array");
error->all(FLERR,"Compute chunk/spread/atom compute does not calculate global array");
if (argindex[i] > modify->compute[icompute]->size_array_cols)
error->all(FLERR,"Compute chunk/spread/atom compute array "
"is accessed out-of-range");
error->all(FLERR,"Compute chunk/spread/atom compute array is accessed out-of-range");
}
} else if (which[i] == ArgInfo::FIX) {
int ifix = modify->find_fix(ids[i]);
if (ifix < 0)
error->all(FLERR,"Fix ID for compute chunk/spread/atom does not exist");
auto ifix = modify->get_fix_by_id(ids[i]);
if (ifix)
error->all(FLERR,"Fix ID {} for compute chunk/spread/atom does not exist", ids[i]);
if (argindex[i] == 0) {
if (!modify->fix[ifix]->vector_flag)
error->all(FLERR,"Compute chunk/spread/atom fix "
"does not calculate global vector");
if (!ifix->vector_flag)
error->all(FLERR,"Compute chunk/spread/atom fix does not calculate global vector");
} else {
if (!modify->fix[ifix]->array_flag)
error->all(FLERR,"Compute chunk/spread/atom fix "
"does not calculate global array");
if (argindex[i] > modify->fix[ifix]->size_array_cols)
error->all(FLERR,"Compute chunk/spread/atom fix array "
"is accessed out-of-range");
if (!ifix->array_flag)
error->all(FLERR,"Compute chunk/spread/atom fix does not calculate global array");
if (argindex[i] > ifix->size_array_cols)
error->all(FLERR,"Compute chunk/spread/atom fix array is accessed out-of-range");
}
}
}
@ -287,7 +280,7 @@ void ComputeChunkSpreadAtom::compute_peratom()
// check if index exceeds fix output length/rows
} else if (which[m] == ArgInfo::FIX) {
Fix *fix = modify->fix[n];
auto &fix = modify->get_fix_list()[n];
if (update->ntimestep % fix->global_freq)
error->all(FLERR,"Fix used in compute chunk/spread/atom not "
"computed at compatible time");