forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5447 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
4359619985
commit
df61f4f568
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -47,6 +47,8 @@ class FixAveAtom : public Fix {
|
|||
char **ids;
|
||||
|
||||
double **array;
|
||||
|
||||
int nextvalid();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -280,10 +280,6 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
|
|||
save_corr[i][j] = corr[i][j] = 0.0;
|
||||
}
|
||||
|
||||
lastindex = -1;
|
||||
firstindex = 0;
|
||||
nsample = 0;
|
||||
|
||||
// this fix produces a global array
|
||||
|
||||
array_flag = 1;
|
||||
|
@ -292,17 +288,14 @@ FixAveCorrelate::FixAveCorrelate(LAMMPS * lmp, int narg, char **arg):
|
|||
extarray = 0;
|
||||
|
||||
// nvalid = next step on which end_of_step does something
|
||||
// this step if multiple of nevery, else next multiple
|
||||
// startstep is lower bound
|
||||
|
||||
nvalid = update->ntimestep;
|
||||
if (startstep > nvalid) nvalid = startstep;
|
||||
if (nvalid % nevery) nvalid = (nvalid/nevery)*nevery + nevery;
|
||||
|
||||
// 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
|
||||
|
||||
lastindex = -1;
|
||||
firstindex = 0;
|
||||
nsample = 0;
|
||||
nvalid = nextvalid();
|
||||
modify->addstep_compute_all(nvalid);
|
||||
}
|
||||
|
||||
|
@ -360,6 +353,16 @@ void FixAveCorrelate::init()
|
|||
value2index[i] = ivariable;
|
||||
}
|
||||
}
|
||||
|
||||
// need to reset nvalid if nvalid < ntimestep b/c minimize was performed
|
||||
|
||||
if (nvalid < update->ntimestep) {
|
||||
lastindex = -1;
|
||||
firstindex = 0;
|
||||
nsample = 0;
|
||||
nvalid = nextvalid();
|
||||
modify->addstep_compute_all(nvalid);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -575,3 +578,17 @@ double FixAveCorrelate::compute_array(int i, int j)
|
|||
else if (save_count[i]) return save_corr[i][j-2];
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
nvalid = next step on which end_of_step does something
|
||||
this step if multiple of nevery, else next multiple
|
||||
startstep is lower bound
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int FixAveCorrelate::nextvalid()
|
||||
{
|
||||
int nvalid = update->ntimestep;
|
||||
if (startstep > nvalid) nvalid = startstep;
|
||||
if (nvalid % nevery) nvalid = (nvalid/nevery)*nevery + nevery;
|
||||
return nvalid;
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ class FixAveCorrelate : public Fix {
|
|||
double **save_corr;
|
||||
|
||||
void accumulate();
|
||||
int nextvalid();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -477,20 +477,11 @@ FixAveHisto::FixAveHisto(LAMMPS *lmp, int narg, char **arg) :
|
|||
for (int i = 0; i < nbins; i++) bin_total[i] = 0.0;
|
||||
|
||||
// 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
|
||||
|
||||
nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
|
||||
if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
|
||||
nvalid = update->ntimestep;
|
||||
else
|
||||
nvalid -= (nrepeat-1)*nevery;
|
||||
if (nvalid < update->ntimestep) nvalid += nfreq;
|
||||
|
||||
// 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
|
||||
|
||||
nvalid = nextvalid();
|
||||
modify->addstep_compute_all(nvalid);
|
||||
}
|
||||
|
||||
|
@ -550,6 +541,14 @@ void FixAveHisto::init()
|
|||
value2index[i] = ivariable;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -983,3 +982,20 @@ void FixAveHisto::allocate_values(int n)
|
|||
"ave/time:value2index");
|
||||
ids = (char **) memory->srealloc(ids,n*sizeof(char *),"ave/time:ids");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
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 FixAveHisto::nextvalid()
|
||||
{
|
||||
int nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
|
||||
if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
|
||||
nvalid = update->ntimestep;
|
||||
else
|
||||
nvalid -= (nrepeat-1)*nevery;
|
||||
if (nvalid < update->ntimestep) nvalid += nfreq;
|
||||
return nvalid;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ class FixAveHisto : public Fix {
|
|||
void bin_atoms(double *, int);
|
||||
void options(int, char **);
|
||||
void allocate_values(int);
|
||||
int nextvalid();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -372,20 +372,11 @@ FixAveSpatial::FixAveSpatial(LAMMPS *lmp, int narg, char **arg) :
|
|||
values_list = NULL;
|
||||
|
||||
// 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
|
||||
|
||||
nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
|
||||
if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
|
||||
nvalid = update->ntimestep;
|
||||
else
|
||||
nvalid -= (nrepeat-1)*nevery;
|
||||
if (nvalid < update->ntimestep) nvalid += nfreq;
|
||||
|
||||
// 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
|
||||
|
||||
nvalid = nextvalid();
|
||||
modify->addstep_compute_all(nvalid);
|
||||
}
|
||||
|
||||
|
@ -474,6 +465,14 @@ void FixAveSpatial::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);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -1263,6 +1262,23 @@ double FixAveSpatial::compute_array(int i, int j)
|
|||
return values_total[i][j]/norm;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
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 FixAveSpatial::nextvalid()
|
||||
{
|
||||
int nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
|
||||
if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
|
||||
nvalid = update->ntimestep;
|
||||
else
|
||||
nvalid -= (nrepeat-1)*nevery;
|
||||
if (nvalid < update->ntimestep) nvalid += nfreq;
|
||||
return nvalid;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage of varatom and bins
|
||||
------------------------------------------------------------------------- */
|
||||
|
|
|
@ -72,6 +72,7 @@ class FixAveSpatial : public Fix {
|
|||
void atom2bin1d();
|
||||
void atom2bin2d();
|
||||
void atom2bin3d();
|
||||
int nextvalid();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -415,20 +415,11 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||
for (int j = 0; j < nvalues; j++) array_total[i][j] = 0.0;
|
||||
|
||||
// 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
|
||||
|
||||
nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
|
||||
if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
|
||||
nvalid = update->ntimestep;
|
||||
else
|
||||
nvalid -= (nrepeat-1)*nevery;
|
||||
if (nvalid < update->ntimestep) nvalid += nfreq;
|
||||
|
||||
// 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
|
||||
|
||||
nvalid = nextvalid();
|
||||
modify->addstep_compute_all(nvalid);
|
||||
}
|
||||
|
||||
|
@ -490,6 +481,14 @@ void FixAveTime::init()
|
|||
value2index[i] = ivariable;
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -914,3 +913,20 @@ void FixAveTime::allocate_values(int n)
|
|||
offcol = (int *) memory->srealloc(offcol,n*sizeof(int),"ave/time:offcol");
|
||||
ids = (char **) memory->srealloc(ids,n*sizeof(char *),"ave/time:ids");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
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 FixAveTime::nextvalid()
|
||||
{
|
||||
int nvalid = (update->ntimestep/nfreq)*nfreq + nfreq;
|
||||
if (nvalid-nfreq == update->ntimestep && nrepeat == 1)
|
||||
nvalid = update->ntimestep;
|
||||
else
|
||||
nvalid -= (nrepeat-1)*nevery;
|
||||
if (nvalid < update->ntimestep) nvalid += nfreq;
|
||||
return nvalid;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ class FixAveTime : public Fix {
|
|||
void invoke_vector(int);
|
||||
void options(int, char **);
|
||||
void allocate_values(int);
|
||||
int nextvalid();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue