forked from lijiext/lammps
git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@9896 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
parent
b1af45327d
commit
e3b479a4cd
|
@ -46,7 +46,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
|
|||
time_depend = 1;
|
||||
scalar_flag = 1;
|
||||
vector_flag = 1;
|
||||
size_vector = 2;
|
||||
size_vector = 1;
|
||||
global_freq = 1;
|
||||
extscalar = 0;
|
||||
extvector = 0;
|
||||
|
@ -89,7 +89,7 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
|
|||
|
||||
// initializations
|
||||
|
||||
t_elapsed = t_laststep = 0.0;
|
||||
t_laststep = 0.0;
|
||||
laststep = update->ntimestep;
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,6 @@ FixDtReset::FixDtReset(LAMMPS *lmp, int narg, char **arg) :
|
|||
int FixDtReset::setmask()
|
||||
{
|
||||
int mask = 0;
|
||||
mask |= INITIAL_INTEGRATE;
|
||||
mask |= END_OF_STEP;
|
||||
return mask;
|
||||
}
|
||||
|
@ -133,15 +132,6 @@ 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 dtv,dtf,dtsq;
|
||||
|
@ -190,9 +180,9 @@ void FixDtReset::end_of_step()
|
|||
|
||||
if (dt == update->dt) return;
|
||||
|
||||
t_elapsed = t_laststep += (update->ntimestep-laststep)*update->dt;
|
||||
laststep = update->ntimestep;
|
||||
|
||||
update->update_time();
|
||||
update->dt = dt;
|
||||
if (respaflag) update->integrate->reset_dt();
|
||||
if (force->pair) force->pair->reset_dt();
|
||||
|
@ -210,6 +200,5 @@ double FixDtReset::compute_scalar()
|
|||
|
||||
double FixDtReset::compute_vector(int n)
|
||||
{
|
||||
if (n == 0) return t_elapsed;
|
||||
return (double) laststep;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ 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);
|
||||
|
@ -41,7 +40,7 @@ class FixDtReset : public Fix {
|
|||
int minbound,maxbound;
|
||||
double tmin,tmax,xmax;
|
||||
double ftm2v;
|
||||
double dt,t_elapsed,t_laststep;
|
||||
double dt,t_laststep;
|
||||
int respaflag;
|
||||
};
|
||||
|
||||
|
|
|
@ -499,6 +499,7 @@ void Respa::cleanup()
|
|||
modify->post_run();
|
||||
modify->delete_fix("RESPA");
|
||||
domain->box_too_small_check();
|
||||
update->update_time();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
|
|
@ -45,7 +45,7 @@ using namespace MathConst;
|
|||
|
||||
// customize a new keyword by adding to this list:
|
||||
|
||||
// step, elapsed, elaplong, dt, cpu, tpcpu, spcpu
|
||||
// step, elapsed, elaplong, dt, time, cpu, tpcpu, spcpu
|
||||
// atoms, temp, press, pe, ke, etotal, enthalpy
|
||||
// evdwl, ecoul, epair, ebond, eangle, edihed, eimp, emol, elong, etail
|
||||
// vol, lx, ly, lz, xlo, xhi, ylo, yhi, zlo, zhi, xy, xz, yz, xlat, ylat, zlat
|
||||
|
@ -647,6 +647,8 @@ void Thermo::parse_fields(char *str)
|
|||
addfield("Elaplong",&Thermo::compute_elapsed_long,BIGINT);
|
||||
} else if (strcmp(word,"dt") == 0) {
|
||||
addfield("Dt",&Thermo::compute_dt,FLOAT);
|
||||
} else if (strcmp(word,"time") == 0) {
|
||||
addfield("Time",&Thermo::compute_time,FLOAT);
|
||||
} else if (strcmp(word,"cpu") == 0) {
|
||||
addfield("CPU",&Thermo::compute_cpu,FLOAT);
|
||||
} else if (strcmp(word,"tpcpu") == 0) {
|
||||
|
@ -994,6 +996,9 @@ int Thermo::evaluate_keyword(char *word, double *answer)
|
|||
} else if (strcmp(word,"dt") == 0) {
|
||||
compute_dt();
|
||||
|
||||
} else if (strcmp(word,"time") == 0) {
|
||||
compute_time();
|
||||
|
||||
} else if (strcmp(word,"cpu") == 0) {
|
||||
if (update->whichflag == 0)
|
||||
error->all(FLERR,
|
||||
|
@ -1447,6 +1452,13 @@ void Thermo::compute_dt()
|
|||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Thermo::compute_time()
|
||||
{
|
||||
dvalue = update->atime + (update->ntimestep-update->atimestep)*update->dt;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void Thermo::compute_cpu()
|
||||
{
|
||||
if (firststep == 0) dvalue = 0.0;
|
||||
|
|
|
@ -122,6 +122,7 @@ class Thermo : protected Pointers {
|
|||
void compute_elapsed();
|
||||
void compute_elapsed_long();
|
||||
void compute_dt();
|
||||
void compute_time();
|
||||
void compute_cpu();
|
||||
void compute_tpcpu();
|
||||
void compute_spcpu();
|
||||
|
|
|
@ -38,6 +38,8 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp)
|
|||
char *str;
|
||||
|
||||
ntimestep = 0;
|
||||
atime = 0.0;
|
||||
atimestep = 0;
|
||||
first_update = 0;
|
||||
|
||||
whichflag = 0;
|
||||
|
@ -356,6 +358,7 @@ void Update::reset_timestep(int narg, char **arg)
|
|||
|
||||
/* ----------------------------------------------------------------------
|
||||
reset timestep
|
||||
set atimestep to new timestep, so future update_time() calls will be correct
|
||||
trigger reset of timestep for output and for fixes that require it
|
||||
do not allow any timestep-dependent fixes to be defined
|
||||
reset eflag/vflag global so nothing will think eng/virial are current
|
||||
|
@ -371,6 +374,8 @@ void Update::reset_timestep(bigint newstep)
|
|||
if (ntimestep < 0) error->all(FLERR,"Timestep must be >= 0");
|
||||
if (ntimestep > MAXBIGINT) error->all(FLERR,"Too big a timestep");
|
||||
|
||||
atimestep = ntimestep;
|
||||
|
||||
output->reset_timestep(ntimestep);
|
||||
|
||||
for (int i = 0; i < modify->nfix; i++) {
|
||||
|
@ -400,6 +405,17 @@ void Update::reset_timestep(bigint newstep)
|
|||
// error->all(FLERR,"Cannot reset timestep with a dynamic region defined");
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
update elapsed simulation time
|
||||
called at end of runs or when timestep size changes
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void Update::update_time()
|
||||
{
|
||||
atime += (ntimestep-atimestep) * dt;
|
||||
atimestep = ntimestep;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
memory usage of update and integrate/minimize
|
||||
------------------------------------------------------------------------- */
|
||||
|
|
|
@ -25,6 +25,8 @@ class Update : protected Pointers {
|
|||
bigint ntimestep; // current step (dynamics or min iterations)
|
||||
int nsteps; // # of steps to run (dynamics or min iter)
|
||||
int whichflag; // 0 for unset, 1 for dynamics, 2 for min
|
||||
double atime; // simulation time at atime_step
|
||||
bigint atimestep; // last timestep atime was updated
|
||||
bigint firststep,laststep; // 1st & last step of this run
|
||||
bigint beginstep,endstep; // 1st and last step of multiple runs
|
||||
int first_update; // 0 before initial update, 1 after
|
||||
|
@ -52,6 +54,7 @@ class Update : protected Pointers {
|
|||
void create_minimize(int, char **);
|
||||
void reset_timestep(int, char **);
|
||||
void reset_timestep(bigint);
|
||||
void update_time();
|
||||
bigint memory_usage();
|
||||
|
||||
private:
|
||||
|
|
|
@ -319,6 +319,7 @@ void Verlet::cleanup()
|
|||
{
|
||||
modify->post_run();
|
||||
domain->box_too_small_check();
|
||||
update->update_time();
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue