git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13255 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2015-03-18 22:59:17 +00:00
parent 85b07ef0d4
commit ea303bbf9a
3 changed files with 28 additions and 17 deletions

View File

@ -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
// 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++)
if (varlen[i]) {
int icompute = modify->find_compute(ids[i]);
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()
{
// 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++)
if (varlen[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;
for (i = 0; i < nvalues; i++) {
if (!varlen[i]) continue;
Compute *compute = modify->compute[value2index[i]];
if (ave == RUNNING || ave == WINDOW) compute->lock(this,ntimestep,-1);
else compute->lock(this,ntimestep,ntimestep+(nrepeat-1)*nevery);
if (nrepeat > 1 && ave == ONE) {
Compute *compute = modify->compute[value2index[i]];
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
// 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++) {
if (!varlen[i]) continue;
Compute *compute = modify->compute[value2index[i]];