add option to compute chunk/atom to access the number of chunks as a global scalar
This commit is contained in:
@ -64,6 +64,8 @@ ComputeChunkAtom::ComputeChunkAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (narg < 4) error->all(FLERR,"Illegal compute chunk/atom command");
|
||||
|
||||
peratom_flag = 1;
|
||||
scalar_flag = 1;
|
||||
extscalar = 0;
|
||||
size_peratom_cols = 0;
|
||||
create_attribute = 1;
|
||||
|
||||
@ -639,6 +641,20 @@ void ComputeChunkAtom::compute_peratom()
|
||||
for (int i = 0; i < nlocal; i++) chunk[i] = ichunk[i];
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
to return the number of chunks, we first need to make certain
|
||||
that compute_peratom() has been called.
|
||||
------------------------------------------------------------------------- */
|
||||
double ComputeChunkAtom::compute_scalar()
|
||||
{
|
||||
if (invoked_peratom != update->ntimestep)
|
||||
compute_peratom();
|
||||
invoked_scalar = update->ntimestep;
|
||||
|
||||
return (scalar = nchunk);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
set lock, so that nchunk will not change from startstep to stopstep
|
||||
called by fix for duration of time it requires lock
|
||||
|
||||
Reference in New Issue
Block a user