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

This commit is contained in:
sjplimp 2011-12-01 00:08:08 +00:00
parent 4badd69f3e
commit 21c24459c9
2 changed files with 25 additions and 12 deletions

View File

@ -43,7 +43,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
time_depend = 1;
scalar_flag = 1;
vector_flag = 1;
size_vector = 1;
size_vector = 2;
global_freq = 1;
extscalar = 0;
extvector = 0;
@ -86,7 +86,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
// initializations
t_elapsed = 0.0;
t_elapsed = t_laststep = 0.0;
laststep = update->ntimestep;
}
@ -95,6 +95,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
int FixDtReset::setmask()
{
int mask = 0;
mask |= INITIAL_INTEGRATE;
mask |= END_OF_STEP;
return mask;
}
@ -113,9 +114,11 @@ void FixDtReset::init()
for (int i = 0; i < output->ndump; i++)
if ((strcmp(output->dump[i]->style,"dcd") == 0 ||
strcmp(output->dump[i]->style,"xtc") == 0) && comm->me == 0)
error->warning(FLERR,"Dump dcd/xtc timestamp may be wrong with fix dt/reset");
error->warning(FLERR,
"Dump dcd/xtc timestamp may be wrong with fix dt/reset");
ftm2v = force->ftm2v;
dt = update->dt;
}
/* ---------------------------------------------------------------------- */
@ -127,16 +130,21 @@ void FixDtReset::setup(int vflag)
/* ---------------------------------------------------------------------- */
void FixDtReset::initial_integrate(int vflag)
{
// calculate elapsed time based on previous reset timestep
t_elapsed = t_laststep + (update->ntimestep-laststep)*dt;
}
/* ---------------------------------------------------------------------- */
void FixDtReset::end_of_step()
{
double dt,dtv,dtf,dtsq;
double dtv,dtf,dtsq;
double vsq,fsq,massinv;
double delx,dely,delz,delr;
// accumulate total time based on previous timestep
t_elapsed += (update->ntimestep - laststep) * update->dt;
// compute vmax and amax of any atom in group
double **v = atom->v;
@ -173,12 +181,15 @@ void FixDtReset::end_of_step()
if (minbound) dt = MAX(dt,tmin);
if (maxbound) dt = MIN(dt,tmax);
// reset update->dt and other classes that depend on it
// if timestep didn't change, just return
// else reset update->dt and other classes that depend on it
// rRESPA, pair style, fixes
laststep = update->ntimestep;
if (dt == update->dt) return;
t_elapsed = t_laststep += (update->ntimestep-laststep)*update->dt;
laststep = update->ntimestep;
update->dt = dt;
if (respaflag) update->integrate->reset_dt();
if (force->pair) force->pair->reset_dt();
@ -196,5 +207,6 @@ double FixDtReset::compute_scalar()
double FixDtReset::compute_vector(int n)
{
return t_elapsed;
if (n == 0) return t_elapsed;
return (double) laststep;
}

View File

@ -31,6 +31,7 @@ class FixDtReset : public Fix {
int setmask();
void init();
void setup(int);
void initial_integrate(int);
void end_of_step();
double compute_scalar();
double compute_vector(int);
@ -40,7 +41,7 @@ class FixDtReset : public Fix {
int minbound,maxbound;
double tmin,tmax,xmax;
double ftm2v;
double t_elapsed;
double dt,t_elapsed,t_laststep;
int respaflag;
};