more use of modernized APIs
This commit is contained in:
@ -120,9 +120,8 @@ void ComputeDisplaceAtom::init()
|
|||||||
{
|
{
|
||||||
// set fix which stores original atom coords
|
// set fix which stores original atom coords
|
||||||
|
|
||||||
int ifix = modify->find_fix(id_fix);
|
fix = (FixStore *) modify->get_fix_by_id(id_fix);
|
||||||
if (ifix < 0) error->all(FLERR,"Could not find compute displace/atom fix ID");
|
if (!fix) error->all(FLERR,"Could not find compute displace/atom fix with ID {}", id_fix);
|
||||||
fix = (FixStore *) modify->fix[ifix];
|
|
||||||
|
|
||||||
if (refreshflag) {
|
if (refreshflag) {
|
||||||
ivar = input->variable->find(rvar);
|
ivar = input->variable->find(rvar);
|
||||||
|
|||||||
@ -117,22 +117,17 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
"Compute global/atom compute array is accessed out-of-range");
|
"Compute global/atom compute array is accessed out-of-range");
|
||||||
|
|
||||||
} else if (whichref == ArgInfo::FIX) {
|
} else if (whichref == ArgInfo::FIX) {
|
||||||
int ifix = modify->find_fix(idref);
|
auto ifix = modify->get_fix_by_id(idref);
|
||||||
if (ifix < 0)
|
if (!ifix)
|
||||||
error->all(FLERR,"Fix ID for compute global/atom does not exist");
|
error->all(FLERR,"Fix ID {} for compute global/atom does not exist", idref);
|
||||||
if (!modify->fix[ifix]->peratom_flag)
|
if (!ifix->peratom_flag)
|
||||||
error->all(FLERR,"Compute global/atom fix does not "
|
error->all(FLERR,"Compute global/atom fix {} does not calculate a per-atom vector or array", idref);
|
||||||
"calculate a per-atom vector or array");
|
if (indexref == 0 && (ifix->size_peratom_cols != 0))
|
||||||
if (indexref == 0 &&
|
error->all(FLERR,"Compute global/atom fix {} does not calculate a per-atom vector", idref);
|
||||||
modify->fix[ifix]->size_peratom_cols != 0)
|
if (indexref && (ifix->size_peratom_cols == 0))
|
||||||
error->all(FLERR,"Compute global/atom fix does not "
|
error->all(FLERR,"Compute global/atom fix {} does not calculate a per-atom array", idref);
|
||||||
"calculate a per-atom vector");
|
if (indexref && indexref > ifix->size_peratom_cols)
|
||||||
if (indexref && modify->fix[ifix]->size_peratom_cols == 0)
|
error->all(FLERR, "Compute global/atom fix {} array is accessed out-of-range", idref);
|
||||||
error->all(FLERR,"Compute global/atom fix does not "
|
|
||||||
"calculate a per-atom array");
|
|
||||||
if (indexref && indexref > modify->fix[ifix]->size_peratom_cols)
|
|
||||||
error->all(FLERR,
|
|
||||||
"Compute global/atom fix array is accessed out-of-range");
|
|
||||||
|
|
||||||
} else if (whichref == ArgInfo::VARIABLE) {
|
} else if (whichref == ArgInfo::VARIABLE) {
|
||||||
int ivariable = input->variable->find(idref);
|
int ivariable = input->variable->find(idref);
|
||||||
@ -162,30 +157,25 @@ ComputeGlobalAtom::ComputeGlobalAtom(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if (which[i] == ArgInfo::FIX) {
|
} else if (which[i] == ArgInfo::FIX) {
|
||||||
int ifix = modify->find_fix(ids[i]);
|
auto ifix = modify->get_fix_by_id(ids[i]);
|
||||||
if (ifix < 0)
|
if (!ifix)
|
||||||
error->all(FLERR,"Fix ID for compute global/atom does not exist");
|
error->all(FLERR,"Fix ID for compute global/atom does not exist");
|
||||||
if (argindex[i] == 0) {
|
if (argindex[i] == 0) {
|
||||||
if (!modify->fix[ifix]->vector_flag)
|
if (!ifix->vector_flag)
|
||||||
error->all(FLERR,"Compute global/atom fix does not "
|
error->all(FLERR,"Compute global/atom fix {} does not calculate a global vector", ids[i]);
|
||||||
"calculate a global vector");
|
|
||||||
} else {
|
} else {
|
||||||
if (!modify->fix[ifix]->array_flag)
|
if (!ifix->array_flag)
|
||||||
error->all(FLERR,"Compute global/atom fix does not "
|
error->all(FLERR,"Compute global/atom fix {} does not calculate a global array", ids[i]);
|
||||||
"calculate a global array");
|
if (argindex[i] > ifix->size_array_cols)
|
||||||
if (argindex[i] > modify->fix[ifix]->size_array_cols)
|
error->all(FLERR,"Compute global/atom fix {} array is accessed out-of-range", ids[i]);
|
||||||
error->all(FLERR,"Compute global/atom fix array is "
|
|
||||||
"accessed out-of-range");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (which[i] == ArgInfo::VARIABLE) {
|
} else if (which[i] == ArgInfo::VARIABLE) {
|
||||||
int ivariable = input->variable->find(ids[i]);
|
int ivariable = input->variable->find(ids[i]);
|
||||||
if (ivariable < 0)
|
if (ivariable < 0)
|
||||||
error->all(FLERR,"Variable name for compute global/atom "
|
error->all(FLERR,"Variable name for compute global/atom does not exist");
|
||||||
"does not exist");
|
|
||||||
if (input->variable->vectorstyle(ivariable) == 0)
|
if (input->variable->vectorstyle(ivariable) == 0)
|
||||||
error->all(FLERR,"Compute global/atom variable is not "
|
error->all(FLERR,"Compute global/atom variable is not vector-style variable");
|
||||||
"vector-style variable");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +358,7 @@ void ComputeGlobalAtom::compute_peratom()
|
|||||||
|
|
||||||
} else if (which[m] == ArgInfo::FIX) {
|
} else if (which[m] == ArgInfo::FIX) {
|
||||||
if (update->ntimestep % modify->fix[value2index[m]]->peratom_freq)
|
if (update->ntimestep % modify->fix[value2index[m]]->peratom_freq)
|
||||||
error->all(FLERR,"Fix used in compute global/atom not "
|
error->all(FLERR,"Fix used in compute global/atom not computed at compatible time");
|
||||||
"computed at compatible time");
|
|
||||||
Fix *fix = modify->fix[value2index[m]];
|
Fix *fix = modify->fix[value2index[m]];
|
||||||
vmax = fix->size_vector;
|
vmax = fix->size_vector;
|
||||||
|
|
||||||
|
|||||||
@ -113,8 +113,8 @@ ComputeMSD::~ComputeMSD()
|
|||||||
|
|
||||||
if (modify->nfix) modify->delete_fix(id_fix);
|
if (modify->nfix) modify->delete_fix(id_fix);
|
||||||
|
|
||||||
delete [] id_fix;
|
delete[] id_fix;
|
||||||
delete [] vector;
|
delete[] vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -123,9 +123,8 @@ void ComputeMSD::init()
|
|||||||
{
|
{
|
||||||
// set fix which stores reference atom coords
|
// set fix which stores reference atom coords
|
||||||
|
|
||||||
int ifix = modify->find_fix(id_fix);
|
fix = (FixStore *) modify->get_fix_by_id(id_fix);
|
||||||
if (ifix < 0) error->all(FLERR,"Could not find compute msd fix ID");
|
if (!fix) error->all(FLERR,"Could not find compute msd fix with ID {}", id_fix);
|
||||||
fix = (FixStore *) modify->fix[ifix];
|
|
||||||
|
|
||||||
// nmsd = # of atoms in group
|
// nmsd = # of atoms in group
|
||||||
|
|
||||||
|
|||||||
@ -69,8 +69,8 @@ ComputeMSDChunk::~ComputeMSDChunk()
|
|||||||
|
|
||||||
if (modify->nfix) modify->delete_fix(id_fix);
|
if (modify->nfix) modify->delete_fix(id_fix);
|
||||||
|
|
||||||
delete [] id_fix;
|
delete[] id_fix;
|
||||||
delete [] idchunk;
|
delete[] idchunk;
|
||||||
memory->destroy(massproc);
|
memory->destroy(massproc);
|
||||||
memory->destroy(masstotal);
|
memory->destroy(masstotal);
|
||||||
memory->destroy(com);
|
memory->destroy(com);
|
||||||
@ -93,9 +93,8 @@ void ComputeMSDChunk::init()
|
|||||||
// if firstflag, will be created in setup()
|
// if firstflag, will be created in setup()
|
||||||
|
|
||||||
if (!firstflag) {
|
if (!firstflag) {
|
||||||
int ifix = modify->find_fix(id_fix);
|
fix = (FixStore *) modify->get_fix_by_id(id_fix);
|
||||||
if (ifix < 0) error->all(FLERR,"Could not find compute msd/chunk fix ID");
|
if (!fix) error->all(FLERR,"Could not find compute msd/chunk fix with ID {}", id_fix);
|
||||||
fix = (FixStore *) modify->fix[ifix];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -195,8 +195,8 @@ void ComputePressure::init()
|
|||||||
if (improperflag && force->improper) nvirial++;
|
if (improperflag && force->improper) nvirial++;
|
||||||
}
|
}
|
||||||
if (fixflag)
|
if (fixflag)
|
||||||
for (int i = 0; i < modify->nfix; i++)
|
for (auto &ifix : modify->get_fix_list())
|
||||||
if (modify->fix[i]->thermo_virial) nvirial++;
|
if (ifix->thermo_virial) nvirial++;
|
||||||
|
|
||||||
if (nvirial) {
|
if (nvirial) {
|
||||||
vptr = new double*[nvirial];
|
vptr = new double*[nvirial];
|
||||||
@ -214,9 +214,9 @@ void ComputePressure::init()
|
|||||||
if (improperflag && force->improper)
|
if (improperflag && force->improper)
|
||||||
vptr[nvirial++] = force->improper->virial;
|
vptr[nvirial++] = force->improper->virial;
|
||||||
if (fixflag)
|
if (fixflag)
|
||||||
for (int i = 0; i < modify->nfix; i++)
|
for (auto &ifix : modify->get_fix_list())
|
||||||
if (modify->fix[i]->virial_global_flag && modify->fix[i]->thermo_virial)
|
if (ifix->virial_global_flag && ifix->thermo_virial)
|
||||||
vptr[nvirial++] = modify->fix[i]->virial;
|
vptr[nvirial++] = ifix->virial;
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag Kspace contribution separately, since not summed across procs
|
// flag Kspace contribution separately, since not summed across procs
|
||||||
|
|||||||
@ -218,34 +218,26 @@ ComputeReduce::ComputeReduce(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
"Compute reduce compute calculates global values");
|
"Compute reduce compute calculates global values");
|
||||||
|
|
||||||
} else if (which[i] == ArgInfo::FIX) {
|
} else if (which[i] == ArgInfo::FIX) {
|
||||||
int ifix = modify->find_fix(ids[i]);
|
auto ifix = modify->get_fix_by_id(ids[i]);
|
||||||
if (ifix < 0)
|
if (!ifix)
|
||||||
error->all(FLERR,"Fix ID for compute reduce does not exist");
|
error->all(FLERR,"Fix ID {} for compute reduce does not exist", ids[i]);
|
||||||
if (modify->fix[ifix]->peratom_flag) {
|
if (ifix->peratom_flag) {
|
||||||
flavor[i] = PERATOM;
|
flavor[i] = PERATOM;
|
||||||
if (argindex[i] == 0 &&
|
if (argindex[i] == 0 && (ifix->size_peratom_cols != 0))
|
||||||
modify->fix[ifix]->size_peratom_cols != 0)
|
error->all(FLERR,"Compute reduce fix {} does not calculate a per-atom vector", ids[i]);
|
||||||
error->all(FLERR,"Compute reduce fix does not "
|
if (argindex[i] && (ifix->size_peratom_cols == 0))
|
||||||
"calculate a per-atom vector");
|
error->all(FLERR,"Compute reduce fix {} does not calculate a per-atom array", ids[i]);
|
||||||
if (argindex[i] && modify->fix[ifix]->size_peratom_cols == 0)
|
if (argindex[i] && (argindex[i] > ifix->size_peratom_cols))
|
||||||
error->all(FLERR,"Compute reduce fix does not "
|
error->all(FLERR,"Compute reduce fix {} array is accessed out-of-range", ids[i]);
|
||||||
"calculate a per-atom array");
|
} else if (ifix->local_flag) {
|
||||||
if (argindex[i] &&
|
|
||||||
argindex[i] > modify->fix[ifix]->size_peratom_cols)
|
|
||||||
error->all(FLERR,"Compute reduce fix array is accessed out-of-range");
|
|
||||||
} else if (modify->fix[ifix]->local_flag) {
|
|
||||||
flavor[i] = LOCAL;
|
flavor[i] = LOCAL;
|
||||||
if (argindex[i] == 0 &&
|
if (argindex[i] == 0 && (ifix->size_local_cols != 0))
|
||||||
modify->fix[ifix]->size_local_cols != 0)
|
error->all(FLERR,"Compute reduce fix {} does not calculate a local vector", ids[i]);
|
||||||
error->all(FLERR,"Compute reduce fix does not "
|
if (argindex[i] && (ifix->size_local_cols == 0))
|
||||||
"calculate a local vector");
|
error->all(FLERR,"Compute reduce fix {} does not calculate a local array", ids[i]);
|
||||||
if (argindex[i] && modify->fix[ifix]->size_local_cols == 0)
|
if (argindex[i] && (argindex[i] > ifix->size_local_cols))
|
||||||
error->all(FLERR,"Compute reduce fix does not "
|
error->all(FLERR,"Compute reduce fix {} array is accessed out-of-range", ids[i]);
|
||||||
"calculate a local array");
|
} else error->all(FLERR,"Compute reduce fix {} calculates global values", ids[i]);
|
||||||
if (argindex[i] &&
|
|
||||||
argindex[i] > modify->fix[ifix]->size_local_cols)
|
|
||||||
error->all(FLERR,"Compute reduce fix array is accessed out-of-range");
|
|
||||||
} else error->all(FLERR,"Compute reduce fix calculates global values");
|
|
||||||
|
|
||||||
} else if (which[i] == ArgInfo::VARIABLE) {
|
} else if (which[i] == ArgInfo::VARIABLE) {
|
||||||
int ivariable = input->variable->find(ids[i]);
|
int ivariable = input->variable->find(ids[i]);
|
||||||
|
|||||||
@ -123,30 +123,24 @@ ComputeReduceChunk::ComputeReduceChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
"Compute reduce/chunk compute array is accessed out-of-range");
|
"Compute reduce/chunk compute array is accessed out-of-range");
|
||||||
|
|
||||||
} else if (which[i] == ArgInfo::FIX) {
|
} else if (which[i] == ArgInfo::FIX) {
|
||||||
int ifix = modify->find_fix(ids[i]);
|
auto ifix = modify->get_fix_by_id(ids[i]);
|
||||||
if (ifix < 0)
|
if (!ifix)
|
||||||
error->all(FLERR,"Fix ID for compute reduce/chunk does not exist");
|
error->all(FLERR,"Fix ID {} for compute reduce/chunk does not exist", ids[i]);
|
||||||
if (!modify->fix[ifix]->peratom_flag)
|
if (!ifix->peratom_flag)
|
||||||
error->all(FLERR,"Compute reduce/chunk fix does not "
|
error->all(FLERR,"Compute reduce/chunk fix {} does not calculate per-atom values", ids[i]);
|
||||||
"calculate per-atom values");
|
if ((argindex[i] == 0) && (ifix->size_peratom_cols != 0))
|
||||||
if (argindex[i] == 0 &&
|
error->all(FLERR,"Compute reduce/chunk fix {} does not calculate a per-atom vector", ids[i]);
|
||||||
modify->fix[ifix]->size_peratom_cols != 0)
|
if (argindex[i] && (ifix->size_peratom_cols == 0))
|
||||||
error->all(FLERR,"Compute reduce/chunk fix does not "
|
error->all(FLERR,"Compute reduce/chunk fix {} does not calculate a per-atom array", ids[i]);
|
||||||
"calculate a per-atom vector");
|
if (argindex[i] && (argindex[i] > ifix->size_peratom_cols))
|
||||||
if (argindex[i] && modify->fix[ifix]->size_peratom_cols == 0)
|
error->all(FLERR,"Compute reduce/chunk fix {} array is accessed out-of-range", ids[i]);
|
||||||
error->all(FLERR,"Compute reduce/chunk fix does not "
|
|
||||||
"calculate a per-atom array");
|
|
||||||
if (argindex[i] && argindex[i] > modify->fix[ifix]->size_peratom_cols)
|
|
||||||
error->all(FLERR,"Compute reduce/chunk fix array is "
|
|
||||||
"accessed out-of-range");
|
|
||||||
|
|
||||||
} else if (which[i] == ArgInfo::VARIABLE) {
|
} else if (which[i] == ArgInfo::VARIABLE) {
|
||||||
int ivariable = input->variable->find(ids[i]);
|
int ivariable = input->variable->find(ids[i]);
|
||||||
if (ivariable < 0)
|
if (ivariable < 0)
|
||||||
error->all(FLERR,"Variable name for compute reduce/chunk does not exist");
|
error->all(FLERR,"Variable name for compute reduce/chunk does not exist");
|
||||||
if (input->variable->atomstyle(ivariable) == 0)
|
if (input->variable->atomstyle(ivariable) == 0)
|
||||||
error->all(FLERR,"Compute reduce/chunk variable is "
|
error->all(FLERR,"Compute reduce/chunk variable is not atom-style variable");
|
||||||
"not atom-style variable");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,8 +374,7 @@ void ComputeReduceChunk::compute_one(int m, double *vchunk, int nstride)
|
|||||||
} else if (which[m] == ArgInfo::FIX) {
|
} else if (which[m] == ArgInfo::FIX) {
|
||||||
Fix *fix = modify->fix[vidx];
|
Fix *fix = modify->fix[vidx];
|
||||||
if (update->ntimestep % fix->peratom_freq)
|
if (update->ntimestep % fix->peratom_freq)
|
||||||
error->all(FLERR,"Fix used in compute reduce/chunk not "
|
error->all(FLERR,"Fix used in compute reduce/chunk not computed at compatible time");
|
||||||
"computed at compatible time");
|
|
||||||
|
|
||||||
if (argindex[m] == 0) {
|
if (argindex[m] == 0) {
|
||||||
double *vfix = fix->vector_atom;
|
double *vfix = fix->vector_atom;
|
||||||
|
|||||||
@ -151,8 +151,7 @@ double ComputeReduceRegion::compute_one(int m, int flag)
|
|||||||
|
|
||||||
} else if (which[m] == ArgInfo::FIX) {
|
} else if (which[m] == ArgInfo::FIX) {
|
||||||
if (update->ntimestep % modify->fix[n]->peratom_freq)
|
if (update->ntimestep % modify->fix[n]->peratom_freq)
|
||||||
error->all(FLERR,"Fix used in compute reduce not computed at "
|
error->all(FLERR,"Fix used in compute reduce not computed at compatible time");
|
||||||
"compatible time");
|
|
||||||
Fix *fix = modify->fix[n];
|
Fix *fix = modify->fix[n];
|
||||||
|
|
||||||
if (flavor[m] == PERATOM) {
|
if (flavor[m] == PERATOM) {
|
||||||
|
|||||||
@ -92,25 +92,22 @@ ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
"global vector or array");
|
"global vector or array");
|
||||||
|
|
||||||
} else if (which[i] == ArgInfo::FIX) {
|
} else if (which[i] == ArgInfo::FIX) {
|
||||||
int ifix = modify->find_fix(ids[i]);
|
auto ifix = modify->get_fix_by_id(ids[i]);
|
||||||
if (ifix < 0)
|
if (!ifix)
|
||||||
error->all(FLERR,"Fix ID for compute slice does not exist");
|
error->all(FLERR,"Fix ID {} for compute slice does not exist", ids[i]);
|
||||||
if (modify->fix[ifix]->vector_flag) {
|
if (ifix->vector_flag) {
|
||||||
if (argindex[i])
|
if (argindex[i])
|
||||||
error->all(FLERR,"Compute slice fix does not "
|
error->all(FLERR,"Compute slice fix {} does not calculate a global array", ids[i]);
|
||||||
"calculate a global array");
|
if (nstop > ifix->size_vector)
|
||||||
if (nstop > modify->fix[ifix]->size_vector)
|
error->all(FLERR,"Compute slice fix {} vector is accessed out-of-range", ids[i]);
|
||||||
error->all(FLERR,"Compute slice fix vector is accessed out-of-range");
|
} else if (ifix->array_flag) {
|
||||||
} else if (modify->fix[ifix]->array_flag) {
|
|
||||||
if (argindex[i] == 0)
|
if (argindex[i] == 0)
|
||||||
error->all(FLERR,"Compute slice fix does not "
|
error->all(FLERR,"Compute slice fix {} does not calculate a global vector", ids[i]);
|
||||||
"calculate a global vector");
|
if (argindex[i] > ifix->size_array_cols)
|
||||||
if (argindex[i] > modify->fix[ifix]->size_array_cols)
|
error->all(FLERR,"Compute slice fix {} array is accessed out-of-range", ids[i]);
|
||||||
error->all(FLERR,"Compute slice fix array is accessed out-of-range");
|
if (nstop > ifix->size_array_rows)
|
||||||
if (nstop > modify->fix[ifix]->size_array_rows)
|
error->all(FLERR,"Compute slice fix {} array is accessed out-of-range", ids[i]);
|
||||||
error->all(FLERR,"Compute slice fix array is accessed out-of-range");
|
} else error->all(FLERR,"Compute slice fix {} does not calculate global vector or array", ids[i]);
|
||||||
} else error->all(FLERR,"Compute slice fix does not calculate "
|
|
||||||
"global vector or array");
|
|
||||||
|
|
||||||
} else if (which[i] == ArgInfo::VARIABLE) {
|
} else if (which[i] == ArgInfo::VARIABLE) {
|
||||||
int ivariable = input->variable->find(ids[i]);
|
int ivariable = input->variable->find(ids[i]);
|
||||||
@ -144,16 +141,16 @@ ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
} else extvector = modify->compute[icompute]->extarray;
|
} else extvector = modify->compute[icompute]->extarray;
|
||||||
} else if (which[0] == ArgInfo::FIX) {
|
} else if (which[0] == ArgInfo::FIX) {
|
||||||
int ifix = modify->find_fix(ids[0]);
|
auto ifix = modify->get_fix_by_id(ids[0]);
|
||||||
if (argindex[0] == 0) {
|
if (argindex[0] == 0) {
|
||||||
extvector = modify->fix[ifix]->extvector;
|
extvector = ifix->extvector;
|
||||||
if (modify->fix[ifix]->extvector == -1) {
|
if (ifix->extvector == -1) {
|
||||||
extlist = new int[size_vector];
|
extlist = new int[size_vector];
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = nstart; i < nstop; i += nskip)
|
for (int i = nstart; i < nstop; i += nskip)
|
||||||
extlist[j++] = modify->fix[ifix]->extlist[i-1];
|
extlist[j++] = ifix->extlist[i-1];
|
||||||
}
|
}
|
||||||
} else extvector = modify->fix[ifix]->extarray;
|
} else extvector = ifix->extarray;
|
||||||
} else if (which[0] == ArgInfo::VARIABLE) {
|
} else if (which[0] == ArgInfo::VARIABLE) {
|
||||||
extvector = 0;
|
extvector = 0;
|
||||||
}
|
}
|
||||||
@ -178,15 +175,15 @@ ComputeSlice::ComputeSlice(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (modify->compute[icompute]->extarray) extarray = 1;
|
if (modify->compute[icompute]->extarray) extarray = 1;
|
||||||
}
|
}
|
||||||
} else if (which[i] == ArgInfo::FIX) {
|
} else if (which[i] == ArgInfo::FIX) {
|
||||||
int ifix = modify->find_fix(ids[i]);
|
auto ifix = modify->get_fix_by_id(ids[i]);
|
||||||
if (argindex[i] == 0) {
|
if (argindex[i] == 0) {
|
||||||
if (modify->fix[ifix]->extvector == 1) extarray = 1;
|
if (ifix->extvector == 1) extarray = 1;
|
||||||
if (modify->fix[ifix]->extvector == -1) {
|
if (ifix->extvector == -1) {
|
||||||
for (int j = 0; j < modify->fix[ifix]->size_vector; j++)
|
for (int j = 0; j < ifix->size_vector; j++)
|
||||||
if (modify->fix[ifix]->extlist[j]) extarray = 1;
|
if (ifix->extlist[j]) extarray = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (modify->fix[ifix]->extarray) extarray = 1;
|
if (ifix->extarray) extarray = 1;
|
||||||
}
|
}
|
||||||
} else if (which[i] == ArgInfo::VARIABLE) {
|
} else if (which[i] == ArgInfo::VARIABLE) {
|
||||||
// variable is always intensive, does not change extarray
|
// variable is always intensive, does not change extarray
|
||||||
|
|||||||
@ -13,21 +13,23 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "compute_stress_atom.h"
|
#include "compute_stress_atom.h"
|
||||||
#include <cstring>
|
|
||||||
#include "atom.h"
|
|
||||||
#include "update.h"
|
|
||||||
#include "comm.h"
|
|
||||||
#include "force.h"
|
|
||||||
#include "pair.h"
|
|
||||||
#include "bond.h"
|
|
||||||
#include "angle.h"
|
#include "angle.h"
|
||||||
|
#include "atom.h"
|
||||||
|
#include "bond.h"
|
||||||
|
#include "comm.h"
|
||||||
#include "dihedral.h"
|
#include "dihedral.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "fix.h"
|
||||||
|
#include "force.h"
|
||||||
#include "improper.h"
|
#include "improper.h"
|
||||||
#include "kspace.h"
|
#include "kspace.h"
|
||||||
#include "modify.h"
|
|
||||||
#include "fix.h"
|
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
#include "modify.h"
|
||||||
|
#include "pair.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -218,11 +220,9 @@ void ComputeStressAtom::compute_peratom()
|
|||||||
// and fix ave/spatial uses a per-atom stress from this compute as input
|
// and fix ave/spatial uses a per-atom stress from this compute as input
|
||||||
|
|
||||||
if (fixflag) {
|
if (fixflag) {
|
||||||
Fix **fix = modify->fix;
|
for (auto &ifix : modify->get_fix_list())
|
||||||
int nfix = modify->nfix;
|
if (ifix->virial_peratom_flag && ifix->thermo_virial) {
|
||||||
for (int ifix = 0; ifix < nfix; ifix++)
|
double **vatom = ifix->vatom;
|
||||||
if (fix[ifix]->virial_peratom_flag && fix[ifix]->thermo_virial) {
|
|
||||||
double **vatom = fix[ifix]->vatom;
|
|
||||||
if (vatom)
|
if (vatom)
|
||||||
for (i = 0; i < nlocal; i++)
|
for (i = 0; i < nlocal; i++)
|
||||||
for (j = 0; j < 6; j++)
|
for (j = 0; j < 6; j++)
|
||||||
|
|||||||
@ -67,15 +67,11 @@ void ComputeTempDeform::init()
|
|||||||
|
|
||||||
// check fix deform remap settings
|
// check fix deform remap settings
|
||||||
|
|
||||||
for (i = 0; i < modify->nfix; i++)
|
auto fixes = modify->get_fix_by_style("^deform");
|
||||||
if (utils::strmatch(modify->fix[i]->style, "^deform")) {
|
if (fixes.size() > 0) {
|
||||||
if (((FixDeform *) modify->fix[i])->remapflag == Domain::X_REMAP && comm->me == 0)
|
if (((FixDeform *) fixes[0])->remapflag == Domain::X_REMAP && comm->me == 0)
|
||||||
error->warning(FLERR,
|
error->warning(FLERR, "Using compute temp/deform with inconsistent fix deform remap option");
|
||||||
"Using compute temp/deform with inconsistent fix deform remap option");
|
} else error->warning(FLERR, "Using compute temp/deform with no fix deform defined");
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == modify->nfix && comm->me == 0)
|
|
||||||
error->warning(FLERR, "Using compute temp/deform with no fix deform defined");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
@ -40,8 +40,7 @@ ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
||||||
|
|
||||||
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
|
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
|
||||||
fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 3",
|
fix = (FixStore *) modify->add_fix(fmt::format("{} {} STORE peratom 1 3", id_fix, group->names[igroup]));
|
||||||
id_fix, group->names[igroup]));
|
|
||||||
|
|
||||||
// store current velocities in fix store array
|
// store current velocities in fix store array
|
||||||
// skip if reset from restart file
|
// skip if reset from restart file
|
||||||
@ -85,9 +84,8 @@ void ComputeVACF::init()
|
|||||||
{
|
{
|
||||||
// set fix which stores original atom velocities
|
// set fix which stores original atom velocities
|
||||||
|
|
||||||
int ifix = modify->find_fix(id_fix);
|
fix = (FixStore *) modify->get_fix_by_id(id_fix);
|
||||||
if (ifix < 0) error->all(FLERR,"Could not find compute vacf fix ID");
|
if (!fix) error->all(FLERR,"Could not find compute vacf fix ID {}", id_fix);
|
||||||
fix = (FixStore *) modify->fix[ifix];
|
|
||||||
|
|
||||||
// nvacf = # of atoms in group
|
// nvacf = # of atoms in group
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user