git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13255 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -548,7 +548,7 @@ void ComputeChunkAtom::compute_peratom()
|
|||||||
set lock, so that nchunk will not change from startstep to stopstep
|
set lock, so that nchunk will not change from startstep to stopstep
|
||||||
called by fix ave/chunk for duration of its Nfreq epoch
|
called by fix ave/chunk for duration of its Nfreq epoch
|
||||||
OK if called by multiple fix ave/chunk commands
|
OK if called by multiple fix ave/chunk commands
|
||||||
error if all callers do not have same duration
|
but error if all callers do not have same duration
|
||||||
last caller holds the lock, so it can also unlock
|
last caller holds the lock, so it can also unlock
|
||||||
lockstop can be positive for final step of finite-size time window
|
lockstop can be positive for final step of finite-size time window
|
||||||
or can be -1 for infinite-size time window
|
or can be -1 for infinite-size time window
|
||||||
|
|||||||
@ -297,7 +297,8 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
// increment lock counter in compute chunk/atom
|
// increment lock counter in compute chunk/atom
|
||||||
// only if nrepeat > 1, so that locking spans multiple timesteps
|
// only if nrepeat > 1 or ave = RUNNING/WINDOW,
|
||||||
|
// so that locking spans multiple timesteps
|
||||||
|
|
||||||
int icompute = modify->find_compute(idchunk);
|
int icompute = modify->find_compute(idchunk);
|
||||||
if (icompute < 0)
|
if (icompute < 0)
|
||||||
@ -305,7 +306,9 @@ FixAveChunk::FixAveChunk(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
cchunk = (ComputeChunkAtom *) modify->compute[icompute];
|
cchunk = (ComputeChunkAtom *) modify->compute[icompute];
|
||||||
if (strcmp(cchunk->style,"chunk/atom") != 0)
|
if (strcmp(cchunk->style,"chunk/atom") != 0)
|
||||||
error->all(FLERR,"Fix ave/chunk does not use chunk/atom compute");
|
error->all(FLERR,"Fix ave/chunk does not use chunk/atom compute");
|
||||||
if (nrepeat > 1) cchunk->lockcount++;
|
|
||||||
|
if (nrepeat > 1 || ave == RUNNING || ave == WINDOW) cchunk->lockcount++;
|
||||||
|
if (ave == RUNNING || ave == WINDOW) cchunk->lock(this,update->ntimestep,-1);
|
||||||
|
|
||||||
// print file comment lines
|
// print file comment lines
|
||||||
|
|
||||||
@ -409,10 +412,11 @@ FixAveChunk::~FixAveChunk()
|
|||||||
|
|
||||||
// decrement lock counter in compute chunk/atom, it if still exists
|
// decrement lock counter in compute chunk/atom, it if still exists
|
||||||
|
|
||||||
if (nrepeat > 1) {
|
if (nrepeat > 1 || ave == RUNNING || ave == WINDOW) {
|
||||||
int icompute = modify->find_compute(idchunk);
|
int icompute = modify->find_compute(idchunk);
|
||||||
if (icompute >= 0) {
|
if (icompute >= 0) {
|
||||||
cchunk = (ComputeChunkAtom *) modify->compute[icompute];
|
cchunk = (ComputeChunkAtom *) modify->compute[icompute];
|
||||||
|
if (ave == RUNNING || ave == WINDOW) cchunk->unlock(this);
|
||||||
cchunk->lockcount--;
|
cchunk->lockcount--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -515,8 +519,7 @@ void FixAveChunk::end_of_step()
|
|||||||
// zero out arrays that accumulate over many samples, but not across epochs
|
// zero out arrays that accumulate over many samples, but not across epochs
|
||||||
// invoke setup_chunks() to determine current nchunk
|
// invoke setup_chunks() to determine current nchunk
|
||||||
// re-allocate per-chunk arrays if needed
|
// re-allocate per-chunk arrays if needed
|
||||||
// then invoke lock() so nchunk cannot change until Nfreq epoch is over
|
// invoke lock() so nchunk cannot change until Nfreq epoch is over
|
||||||
// use final arg = -1 for infinite-time window
|
|
||||||
// wrap setup_chunks in clearstep/addstep b/c it may invoke computes
|
// wrap setup_chunks in clearstep/addstep b/c it may invoke computes
|
||||||
// both nevery and nfreq are future steps,
|
// both nevery and nfreq are future steps,
|
||||||
// since call below to cchunk->ichunk()
|
// since call below to cchunk->ichunk()
|
||||||
@ -530,8 +533,8 @@ void FixAveChunk::end_of_step()
|
|||||||
modify->addstep_compute(ntimestep+nfreq);
|
modify->addstep_compute(ntimestep+nfreq);
|
||||||
}
|
}
|
||||||
allocate();
|
allocate();
|
||||||
if (ave == RUNNING || ave == WINDOW) cchunk->lock(this,ntimestep,-1);
|
if (nrepeat > 1 && ave == ONE)
|
||||||
else cchunk->lock(this,ntimestep,ntimestep+(nrepeat-1)*nevery);
|
cchunk->lock(this,ntimestep,ntimestep+(nrepeat-1)*nevery);
|
||||||
for (m = 0; m < nchunk; m++) {
|
for (m = 0; m < nchunk; m++) {
|
||||||
count_many[m] = count_sum[m] = 0.0;
|
count_many[m] = count_sum[m] = 0.0;
|
||||||
for (i = 0; i < nvalues; i++) values_many[m][i] = 0.0;
|
for (i = 0; i < nvalues; i++) values_many[m][i] = 0.0;
|
||||||
@ -762,7 +765,7 @@ void FixAveChunk::end_of_step()
|
|||||||
// unlock compute chunk/atom at end of Nfreq epoch
|
// unlock compute chunk/atom at end of Nfreq epoch
|
||||||
// do not unlock if ave = RUNNING or WINDOW
|
// do not unlock if ave = RUNNING or WINDOW
|
||||||
|
|
||||||
if (ave == ONE) cchunk->unlock(this);
|
if (nrepeat > 1 && ave == ONE) cchunk->unlock(this);
|
||||||
|
|
||||||
// time average across samples
|
// time average across samples
|
||||||
// if normflag = ALL, final is total value / total count
|
// if normflag = ALL, final is total value / total count
|
||||||
|
|||||||
@ -276,11 +276,14 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// enable locking of row count by this fix for computes of variable length
|
// enable locking of row count by this fix for computes of variable length
|
||||||
// only if nrepeat > 1, so that locking spans multiple timesteps
|
// only if nrepeat > 1, so that locking spans multiple timesteps
|
||||||
|
|
||||||
if (any_variable_length && nrepeat > 1) {
|
if (any_variable_length &&
|
||||||
|
(nrepeat > 1 || ave == RUNNING || ave == WINDOW)) {
|
||||||
for (int i = 0; i < nvalues; i++)
|
for (int i = 0; i < nvalues; i++)
|
||||||
if (varlen[i]) {
|
if (varlen[i]) {
|
||||||
int icompute = modify->find_compute(ids[i]);
|
int icompute = modify->find_compute(ids[i]);
|
||||||
modify->compute[icompute]->lock_enable();
|
modify->compute[icompute]->lock_enable();
|
||||||
|
if (ave == RUNNING || ave == WINDOW)
|
||||||
|
modify->compute[icompute]->lock(this,update->ntimestep,-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,13 +456,17 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
FixAveTime::~FixAveTime()
|
FixAveTime::~FixAveTime()
|
||||||
{
|
{
|
||||||
// decrement lock counter in compute chunk/atom, it if still exists
|
// decrement lock counter in compute chunk/atom, it if still exists
|
||||||
// NOTE: better comment
|
|
||||||
|
|
||||||
if (any_variable_length && nrepeat > 1) {
|
if (any_variable_length &&
|
||||||
|
(nrepeat > 1 || ave == RUNNING || ave == WINDOW)) {
|
||||||
for (int i = 0; i < nvalues; i++)
|
for (int i = 0; i < nvalues; i++)
|
||||||
if (varlen[i]) {
|
if (varlen[i]) {
|
||||||
int icompute = modify->find_compute(ids[i]);
|
int icompute = modify->find_compute(ids[i]);
|
||||||
if (icompute >= 0) modify->compute[icompute]->lock_disable();
|
if (icompute >= 0) {
|
||||||
|
if (ave == RUNNING || ave == WINDOW)
|
||||||
|
modify->compute[icompute]->unlock(this);
|
||||||
|
modify->compute[icompute]->lock_disable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -732,9 +739,10 @@ void FixAveTime::invoke_vector(bigint ntimestep)
|
|||||||
bigint ntimestep = update->ntimestep;
|
bigint ntimestep = update->ntimestep;
|
||||||
for (i = 0; i < nvalues; i++) {
|
for (i = 0; i < nvalues; i++) {
|
||||||
if (!varlen[i]) continue;
|
if (!varlen[i]) continue;
|
||||||
Compute *compute = modify->compute[value2index[i]];
|
if (nrepeat > 1 && ave == ONE) {
|
||||||
if (ave == RUNNING || ave == WINDOW) compute->lock(this,ntimestep,-1);
|
Compute *compute = modify->compute[value2index[i]];
|
||||||
else compute->lock(this,ntimestep,ntimestep+(nrepeat-1)*nevery);
|
compute->lock(this,ntimestep,ntimestep+(nrepeat-1)*nevery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -817,7 +825,7 @@ void FixAveTime::invoke_vector(bigint ntimestep)
|
|||||||
// unlock any variable length computes at end of Nfreq epoch
|
// unlock any variable length computes at end of Nfreq epoch
|
||||||
// do not unlock if ave = RUNNING or WINDOW
|
// do not unlock if ave = RUNNING or WINDOW
|
||||||
|
|
||||||
if (any_variable_length && ave == ONE) {
|
if (any_variable_length && nrepeat > 1 && ave == ONE) {
|
||||||
for (i = 0; i < nvalues; i++) {
|
for (i = 0; i < nvalues; i++) {
|
||||||
if (!varlen[i]) continue;
|
if (!varlen[i]) continue;
|
||||||
Compute *compute = modify->compute[value2index[i]];
|
Compute *compute = modify->compute[value2index[i]];
|
||||||
|
|||||||
Reference in New Issue
Block a user