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

This commit is contained in:
sjplimp
2011-01-03 21:58:22 +00:00
parent 4359619985
commit df61f4f568
10 changed files with 139 additions and 52 deletions

View File

@ -187,21 +187,12 @@ FixAveAtom::FixAveAtom(LAMMPS *lmp, int narg, char **arg) :
array[i][m] = 0.0;
// nvalid = next step on which end_of_step does something
// can be this timestep if multiple of peratom_freq and nrepeat = 1
// else backup from next multiple of peratom_freq
irepeat = 0;
nvalid = (update->ntimestep/peratom_freq)*peratom_freq + peratom_freq;
if (nvalid-peratom_freq == update->ntimestep && nrepeat == 1)
nvalid = update->ntimestep;
else
nvalid -= (nrepeat-1)*nevery;
if (nvalid < update->ntimestep) nvalid += peratom_freq;
// add nvalid to all computes that store invocation times
// since don't know a priori which are invoked by this fix
// once in end_of_step() can set timestep for ones actually invoked
irepeat = 0;
nvalid = nextvalid();
modify->addstep_compute_all(nvalid);
}
@ -258,6 +249,14 @@ void FixAveAtom::init()
} else value2index[m] = -1;
}
// need to reset nvalid if nvalid < ntimestep b/c minimize was performed
if (nvalid < update->ntimestep) {
irepeat = 0;
nvalid = nextvalid();
modify->addstep_compute_all(nvalid);
}
}
/* ----------------------------------------------------------------------
@ -429,3 +428,20 @@ int FixAveAtom::unpack_exchange(int nlocal, double *buf)
for (int m = 0; m < nvalues; m++) array[nlocal][m] = buf[m];
return nvalues;
}
/* ----------------------------------------------------------------------
calculate nvalid = next step on which end_of_step does something
can be this timestep if multiple of nfreq and nrepeat = 1
else backup from next multiple of nfreq
------------------------------------------------------------------------- */
int FixAveAtom::nextvalid()
{
int nvalid = (update->ntimestep/peratom_freq)*peratom_freq + peratom_freq;
if (nvalid-peratom_freq == update->ntimestep && nrepeat == 1)
nvalid = update->ntimestep;
else
nvalid -= (nrepeat-1)*nevery;
if (nvalid < update->ntimestep) nvalid += peratom_freq;
return nvalid;
}