store 'nchunk for msd' on first pass

because nchunk can be modified elsewhere
This commit is contained in:
Jacob Gissinger
2024-07-06 15:57:18 -04:00
parent b7942ead3f
commit b1db2ddb3f
2 changed files with 5 additions and 2 deletions

View File

@ -32,6 +32,7 @@ ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) :
{
if (narg != 4) error->all(FLERR, "Illegal compute msd/chunk command");
msdnchunk = 0;
array_flag = 1;
size_array_cols = 4;
size_array_rows = 0;
@ -117,14 +118,14 @@ void ComputeMSDChunk::compute_array()
double massone;
double unwrap[3];
int oldnchunk = nchunk;
ComputeChunk::compute_array();
int *ichunk = cchunk->ichunk;
// first time call, allocate per-chunk arrays
// thereafter, require nchunk remain the same
if (!firstflag && (oldnchunk != nchunk))
if (firstflag) msdnchunk = nchunk;
else if (msdnchunk != nchunk)
error->all(FLERR, "Compute msd/chunk nchunk is not static");
// zero local per-chunk values

View File

@ -35,6 +35,8 @@ class ComputeMSDChunk : public ComputeChunk {
double memory_usage() override;
private:
int msdnchunk;
char *id_fix;
class FixStoreGlobal *fix;