new accessor APIs for fixes and computes in Modify plus a few applications
This commit is contained in:
@ -316,40 +316,30 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
}
|
||||
|
||||
if (which == ArgInfo::COMPUTE) {
|
||||
int icompute = modify->find_compute(cfvid);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Compute ID for compute chunk /atom does not exist");
|
||||
if (modify->compute[icompute]->peratom_flag == 0)
|
||||
error->all(FLERR,
|
||||
"Compute chunk/atom compute does not calculate "
|
||||
"per-atom values");
|
||||
if (argindex == 0 &&
|
||||
modify->compute[icompute]->size_peratom_cols != 0)
|
||||
error->all(FLERR,"Compute chunk/atom compute does not "
|
||||
"calculate a per-atom vector");
|
||||
if (argindex && modify->compute[icompute]->size_peratom_cols == 0)
|
||||
error->all(FLERR,"Compute chunk/atom compute does not "
|
||||
"calculate a per-atom array");
|
||||
if (argindex &&
|
||||
argindex > modify->compute[icompute]->size_peratom_cols)
|
||||
error->all(FLERR,"Compute chunk/atom compute array is "
|
||||
"accessed out-of-range");
|
||||
cchunk = modify->get_compute_by_id(cfvid);
|
||||
if (!cchunk)
|
||||
error->all(FLERR,"Compute ID {} for compute chunk /atom does not exist",cfvid);
|
||||
if (cchunk->peratom_flag == 0)
|
||||
error->all(FLERR,"Compute chunk/atom compute does not calculate per-atom values");
|
||||
if ((argindex == 0) && (cchunk->size_peratom_cols != 0))
|
||||
error->all(FLERR,"Compute chunk/atom compute does not calculate a per-atom vector");
|
||||
if (argindex && (cchunk->size_peratom_cols == 0))
|
||||
error->all(FLERR,"Compute chunk/atom compute does not calculate a per-atom array");
|
||||
if (argindex && argindex > cchunk->size_peratom_cols)
|
||||
error->all(FLERR,"Compute chunk/atom compute array is accessed out-of-range");
|
||||
}
|
||||
|
||||
if (which == ArgInfo::FIX) {
|
||||
int ifix = modify->find_fix(cfvid);
|
||||
if (ifix < 0)
|
||||
error->all(FLERR,"Fix ID for compute chunk/atom does not exist");
|
||||
if (modify->fix[ifix]->peratom_flag == 0)
|
||||
error->all(FLERR,"Compute chunk/atom fix does not calculate "
|
||||
"per-atom values");
|
||||
if (argindex == 0 && modify->fix[ifix]->size_peratom_cols != 0)
|
||||
error->all(FLERR,
|
||||
"Compute chunk/atom fix does not calculate a per-atom vector");
|
||||
if (argindex && modify->fix[ifix]->size_peratom_cols == 0)
|
||||
error->all(FLERR,
|
||||
"Compute chunk/atom fix does not calculate a per-atom array");
|
||||
if (argindex && argindex > modify->fix[ifix]->size_peratom_cols)
|
||||
fchunk = modify->get_fix_by_id(cfvid);
|
||||
if (!fchunk)
|
||||
error->all(FLERR,"Fix ID {} for compute chunk/atom does not exist",cfvid);
|
||||
if (fchunk->peratom_flag == 0)
|
||||
error->all(FLERR,"Compute chunk/atom fix does not calculate per-atom values");
|
||||
if (argindex == 0 && fchunk->size_peratom_cols != 0)
|
||||
error->all(FLERR,"Compute chunk/atom fix does not calculate a per-atom vector");
|
||||
if (argindex && fchunk->size_peratom_cols == 0)
|
||||
error->all(FLERR,"Compute chunk/atom fix does not calculate a per-atom array");
|
||||
if (argindex && argindex > fchunk->size_peratom_cols)
|
||||
error->all(FLERR,"Compute chunk/atom fix array is accessed out-of-range");
|
||||
}
|
||||
|
||||
@ -358,16 +348,14 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (ivariable < 0)
|
||||
error->all(FLERR,"Variable name for compute chunk/atom does not exist");
|
||||
if (input->variable->atomstyle(ivariable) == 0)
|
||||
error->all(FLERR,"Compute chunk/atom variable is not "
|
||||
"atom-style variable");
|
||||
error->all(FLERR,"Compute chunk/atom variable is not atom-style variable");
|
||||
}
|
||||
|
||||
// setup scaling
|
||||
|
||||
if (binflag) {
|
||||
if (domain->triclinic == 1 && scaleflag != REDUCED)
|
||||
error->all(FLERR,"Compute chunk/atom for triclinic boxes "
|
||||
"requires units reduced");
|
||||
error->all(FLERR,"Compute chunk/atom for triclinic boxes requires units reduced");
|
||||
}
|
||||
|
||||
if (scaleflag == LATTICE) {
|
||||
@ -501,15 +489,13 @@ void ComputeChunkAtom::init()
|
||||
// set compute,fix,variable
|
||||
|
||||
if (which == ArgInfo::COMPUTE) {
|
||||
int icompute = modify->find_compute(cfvid);
|
||||
if (icompute < 0)
|
||||
error->all(FLERR,"Compute ID for compute chunk/atom does not exist");
|
||||
cchunk = modify->compute[icompute];
|
||||
cchunk = modify->get_compute_by_id(cfvid);
|
||||
if (!cchunk)
|
||||
error->all(FLERR,"Compute ID {} for compute chunk/atom does not exist",cfvid);
|
||||
} else if (which == ArgInfo::FIX) {
|
||||
int ifix = modify->find_fix(cfvid);
|
||||
if (ifix < 0)
|
||||
error->all(FLERR,"Fix ID for compute chunk/atom does not exist");
|
||||
fchunk = modify->fix[ifix];
|
||||
fchunk = modify->get_fix_by_id(cfvid);
|
||||
if (!fchunk)
|
||||
error->all(FLERR,"Fix ID {} for compute chunk/atom does not exist",cfvid);
|
||||
} else if (which == ArgInfo::VARIABLE) {
|
||||
int ivariable = input->variable->find(cfvid);
|
||||
if (ivariable < 0)
|
||||
|
||||
Reference in New Issue
Block a user