forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@1121 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
a933856363
commit
3ec5b83564
|
@ -199,6 +199,13 @@ FixAveTime::FixAveTime(LAMMPS *lmp, int narg, char **arg) :
|
|||
|
||||
if (nvalid < update->ntimestep)
|
||||
error->all("Fix ave/time cannot be started on this timestep");
|
||||
|
||||
// must set timestep for all computes that store invocation times
|
||||
// since don't know a priori which are invoked by this fix
|
||||
// once in end_of_step() can just set timestep for ones actually invoked
|
||||
|
||||
for (int i = 0; i < modify->ncompute; i++)
|
||||
if (modify->compute[i]->timeflag) modify->compute[i]->add_step(nvalid);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
@ -72,6 +72,8 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp)
|
|||
|
||||
end_of_step_every = NULL;
|
||||
|
||||
list_timeflag = NULL;
|
||||
|
||||
nfix_restart_global = 0;
|
||||
id_restart_global = style_restart_global = state_restart_global = NULL;
|
||||
nfix_restart_peratom = 0;
|
||||
|
@ -108,6 +110,8 @@ Modify::~Modify()
|
|||
|
||||
delete [] end_of_step_every;
|
||||
|
||||
delete [] list_timeflag;
|
||||
|
||||
restart_deallocate();
|
||||
|
||||
// delete all computes
|
||||
|
@ -153,8 +157,12 @@ void Modify::init()
|
|||
list_init(MIN_POST_FORCE,n_min_post_force,list_min_post_force);
|
||||
list_init(MIN_ENERGY,n_min_energy,list_min_energy);
|
||||
|
||||
// create list of computes that store invocation times
|
||||
|
||||
list_init_compute();
|
||||
|
||||
// init each compute
|
||||
// notify relevant computes they may be called on this timestep
|
||||
// for computes that store invocation times, add initial step to their list
|
||||
|
||||
for (i = 0; i < ncompute; i++) {
|
||||
compute[i]->init();
|
||||
|
@ -573,25 +581,28 @@ int Modify::find_compute(char *id)
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
clear the invoked flag of computes that stores their next invocation
|
||||
called by classes that are invoking computes
|
||||
loop over computes that store invocation times
|
||||
clear their invoked flag
|
||||
called by classes that invoke computes
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Modify::clearstep_compute()
|
||||
{
|
||||
for (int icompute = 0; icompute < ncompute; icompute++)
|
||||
if (compute[icompute]->timeflag) compute[icompute]->invoked = 0;
|
||||
for (int icompute = 0; icompute < n_timeflag; icompute++)
|
||||
compute[list_timeflag[icompute]]->invoked = 0;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
schedule the next invocation of computes that were invoked
|
||||
called by classes that invoked computes to schedule the next invocation
|
||||
loop over computes that store invocation times
|
||||
if it was invoked, schedule the next invocation
|
||||
called by classes that invoke computes
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Modify::addstep_compute(int ntimestep)
|
||||
{
|
||||
for (int icompute = 0; icompute < ncompute; icompute++)
|
||||
if (compute[icompute]->invoked) compute[icompute]->add_step(ntimestep);
|
||||
for (int icompute = 0; icompute < n_timeflag; icompute++)
|
||||
if (compute[list_timeflag[icompute]]->invoked)
|
||||
compute[list_timeflag[icompute]]->add_step(ntimestep);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
@ -823,6 +834,24 @@ void Modify::list_init_thermo_energy(int mask, int &n, int *&list)
|
|||
if (fmask[i] & mask && fix[i]->thermo_energy) list[n++] = i;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
create list of compute indices for computes which store invocation times
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Modify::list_init_compute()
|
||||
{
|
||||
delete [] list_timeflag;
|
||||
|
||||
n_timeflag = 0;
|
||||
for (int i = 0; i < ncompute; i++)
|
||||
if (compute[i]->timeflag) n_timeflag++;
|
||||
list_timeflag = new int[n_timeflag];
|
||||
|
||||
n_timeflag = 0;
|
||||
for (int i = 0; i < ncompute; i++)
|
||||
if (compute[i]->timeflag) list_timeflag[n_timeflag++] = i;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
return # of bytes of allocated memory from all fixes
|
||||
------------------------------------------------------------------------- */
|
||||
|
|
|
@ -86,6 +86,9 @@ class Modify : protected Pointers {
|
|||
|
||||
int *end_of_step_every;
|
||||
|
||||
int n_timeflag; // list of computes that store time invocation
|
||||
int *list_timeflag;
|
||||
|
||||
int nfix_restart_global;
|
||||
char **id_restart_global;
|
||||
char **style_restart_global;
|
||||
|
@ -98,6 +101,7 @@ class Modify : protected Pointers {
|
|||
void list_init(int, int &, int *&);
|
||||
void list_init_end_of_step(int, int &, int *&);
|
||||
void list_init_thermo_energy(int, int &, int *&);
|
||||
void list_init_compute();
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -184,7 +184,6 @@ void Verlet::iterate(int n)
|
|||
// force computations
|
||||
|
||||
ev_set(ntimestep);
|
||||
///printf("AAA %d %d %d\n",ntimestep,eflag,vflag);
|
||||
force_clear(vflag);
|
||||
|
||||
timer->stamp();
|
||||
|
|
Loading…
Reference in New Issue