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

This commit is contained in:
sjplimp
2011-01-11 16:27:24 +00:00
parent 09aa3cfd56
commit 60b4b9eaa7
8 changed files with 58 additions and 19 deletions

View File

@ -192,6 +192,8 @@ void NEB::run()
update->endstep = update->laststep = update->firststep + n1steps; update->endstep = update->laststep = update->firststep + n1steps;
update->nsteps = n1steps; update->nsteps = n1steps;
update->max_eval = n1steps; update->max_eval = n1steps;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many timesteps");
update->minimize->setup(); update->minimize->setup();
@ -259,6 +261,8 @@ void NEB::run()
update->endstep = update->laststep = update->firststep + n2steps; update->endstep = update->laststep = update->firststep + n2steps;
update->nsteps = n2steps; update->nsteps = n2steps;
update->max_eval = n2steps; update->max_eval = n2steps;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many timesteps");
update->minimize->init(); update->minimize->init();
fneb->rclimber = top; fneb->rclimber = top;

View File

@ -210,6 +210,8 @@ void PRD::command(int narg, char **arg)
update->beginstep = update->firststep = update->ntimestep; update->beginstep = update->firststep = update->ntimestep;
update->endstep = update->laststep = update->firststep + nsteps; update->endstep = update->laststep = update->firststep + nsteps;
update->restrict_output = 1; update->restrict_output = 1;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many timesteps");
lmp->init(); lmp->init();
@ -495,6 +497,8 @@ void PRD::quench()
update->whichflag = 2; update->whichflag = 2;
update->nsteps = maxiter; update->nsteps = maxiter;
update->endstep = update->laststep = update->firststep + maxiter; update->endstep = update->laststep = update->firststep + maxiter;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many iterations");
// full init works // full init works

View File

@ -195,6 +195,8 @@ void TAD::command(int narg, char **arg)
update->beginstep = update->firststep = update->ntimestep; update->beginstep = update->firststep = update->ntimestep;
update->endstep = update->laststep = update->firststep + nsteps; update->endstep = update->laststep = update->firststep + nsteps;
update->restrict_output = 1; update->restrict_output = 1;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many timesteps");
lmp->init(); lmp->init();
@ -460,6 +462,8 @@ void TAD::quench()
update->whichflag = 2; update->whichflag = 2;
update->nsteps = maxiter; update->nsteps = maxiter;
update->endstep = update->laststep = update->firststep + maxiter; update->endstep = update->laststep = update->firststep + maxiter;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many iterations");
// full init works // full init works

View File

@ -106,6 +106,8 @@ void Temper::command(int narg, char **arg)
update->nsteps = nsteps; update->nsteps = nsteps;
update->beginstep = update->firststep = update->ntimestep; update->beginstep = update->firststep = update->ntimestep;
update->endstep = update->laststep = update->firststep + nsteps; update->endstep = update->laststep = update->firststep + nsteps;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many timesteps");
lmp->init(); lmp->init();

View File

@ -21,6 +21,7 @@ FixStyle(dt/reset,FixDtReset)
#define LMP_FIX_DT_RESET_H #define LMP_FIX_DT_RESET_H
#include "fix.h" #include "fix.h"
#include "lmptype.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -36,7 +37,8 @@ class FixDtReset : public Fix {
double compute_vector(int); double compute_vector(int);
private: private:
int minbound,maxbound,laststep; bigint laststep;
int minbound,maxbound;
double tmin,tmax,xmax; double tmin,tmax,xmax;
double ftm2v; double ftm2v;
double t_elapsed; double t_elapsed;

View File

@ -13,7 +13,7 @@
// define integer data types used by LAMMPS and associated size limits // define integer data types used by LAMMPS and associated size limits
// smallint = variables for system on 1 processor (nlocal, etc) // smallint = variables for system on 1 processor (nlocal, nmax, etc)
// tagint = variables for atom IDs (tag) // tagint = variables for atom IDs (tag)
// bigint = variables for total system (natoms, ntimestep, etc) // bigint = variables for total system (natoms, ntimestep, etc)
@ -31,8 +31,8 @@
// NOTE: if your machine/MPI does not support "long long" ints, // NOTE: if your machine/MPI does not support "long long" ints,
// but only "long" ints, then you will likely need to set // but only "long" ints, then you will likely need to set
// MPI_LMP_BIGINT to MPI_LONG, LLONG_MAX to LONG_MAX, // MPI_LONG_LONG to MPI_LONG, LLONG_MAX to LONG_MAX,
// "lld" to "ld", and ATOBIGINT to atol // "lld" to "ld", and atoll to atol
#ifndef LMP_LMPTYPE_H #ifndef LMP_LMPTYPE_H
#define LMP_LMPTYPE_H #define LMP_LMPTYPE_H

View File

@ -46,6 +46,8 @@ void Minimize::command(int narg, char **arg)
update->whichflag = 2; update->whichflag = 2;
update->beginstep = update->firststep = update->ntimestep; update->beginstep = update->firststep = update->ntimestep;
update->endstep = update->laststep = update->firststep + update->nsteps; update->endstep = update->laststep = update->firststep + update->nsteps;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many iterations");
lmp->init(); lmp->init();
update->minimize->setup(); update->minimize->setup();

View File

@ -14,6 +14,7 @@
#include "stdlib.h" #include "stdlib.h"
#include "string.h" #include "string.h"
#include "run.h" #include "run.h"
#include "lmptype.h"
#include "domain.h" #include "domain.h"
#include "update.h" #include "update.h"
#include "integrate.h" #include "integrate.h"
@ -44,14 +45,14 @@ void Run::command(int narg, char **arg)
if (domain->box_exist == 0) if (domain->box_exist == 0)
error->all("Run command before simulation box is defined"); error->all("Run command before simulation box is defined");
int nsteps = atoi(arg[0]); bigint nsteps_input = ATOBIGINT(arg[0]);
// parse optional args // parse optional args
int uptoflag = 0; int uptoflag = 0;
int startflag = 0; int startflag = 0;
int stopflag = 0; int stopflag = 0;
int start,stop; bigint start,stop;
int preflag = 1; int preflag = 1;
int postflag = 1; int postflag = 1;
int nevery = 0; int nevery = 0;
@ -67,12 +68,12 @@ void Run::command(int narg, char **arg)
} else if (strcmp(arg[iarg],"start") == 0) { } else if (strcmp(arg[iarg],"start") == 0) {
if (iarg+2 > narg) error->all("Illegal run command"); if (iarg+2 > narg) error->all("Illegal run command");
startflag = 1; startflag = 1;
start = atoi(arg[iarg+1]); start = ATOBIGINT(arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"stop") == 0) { } else if (strcmp(arg[iarg],"stop") == 0) {
if (iarg+2 > narg) error->all("Illegal run command"); if (iarg+2 > narg) error->all("Illegal run command");
stopflag = 1; stopflag = 1;
stop = atoi(arg[iarg+1]); stop = ATOBIGINT(arg[iarg+1]);
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"pre") == 0) { } else if (strcmp(arg[iarg],"pre") == 0) {
if (iarg+2 > narg) error->all("Illegal run command"); if (iarg+2 > narg) error->all("Illegal run command");
@ -103,9 +104,34 @@ void Run::command(int narg, char **arg)
} else error->all("Illegal run command"); } else error->all("Illegal run command");
} }
// adjust nsteps if upto was specified // set nsteps as integer, using upto value if specified
int nsteps;
if (!uptoflag) {
if (nsteps_input < 0 || nsteps_input > MAXSMALLINT)
error->all("Invalid run command N value");
nsteps = static_cast<int> (nsteps_input);
} else {
bigint delta = nsteps_input - update->ntimestep;
if (delta < 0 || delta > MAXSMALLINT)
error->all("Invalid run command upto value");
nsteps = static_cast<int> (delta);
}
if (uptoflag) nsteps -= update->ntimestep; // error check
if (startflag) {
if (start < 0 || start > MAXBIGINT)
error->all("Invalid run command start/stop value");
if (start > update->ntimestep)
error->all("Run command start value is after start of run");
}
if (stopflag) {
if (stop < 0 || stop > MAXBIGINT)
error->all("Invalid run command start/stop value");
if (stop < update->ntimestep + nsteps)
error->all("Run command stop value is before end of run");
}
// if nevery, make copies of arg strings that are commands // if nevery, make copies of arg strings that are commands
// required because re-parsing commands via input->one() will wipe out args // required because re-parsing commands via input->one() will wipe out args
@ -122,15 +148,6 @@ void Run::command(int narg, char **arg)
} }
} }
// error check
if (uptoflag && nsteps < 0)
error->all("Run command upto value is before current timestep");
if (startflag && start > update->ntimestep)
error->all("Run command start value is after start of run");
if (stopflag && stop < update->ntimestep + nsteps)
error->all("Run command stop value is before end of run");
// perform a single run // perform a single run
// use start/stop to set begin/end step // use start/stop to set begin/end step
// if pre or 1st run, do System init/setup, // if pre or 1st run, do System init/setup,
@ -143,6 +160,8 @@ void Run::command(int narg, char **arg)
update->nsteps = nsteps; update->nsteps = nsteps;
update->firststep = update->ntimestep; update->firststep = update->ntimestep;
update->laststep = update->ntimestep + nsteps; update->laststep = update->ntimestep + nsteps;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many timesteps");
if (startflag) update->beginstep = start; if (startflag) update->beginstep = start;
else update->beginstep = update->firststep; else update->beginstep = update->firststep;
@ -181,6 +200,8 @@ void Run::command(int narg, char **arg)
update->nsteps = nsteps; update->nsteps = nsteps;
update->firststep = update->ntimestep; update->firststep = update->ntimestep;
update->laststep = update->ntimestep + nsteps; update->laststep = update->ntimestep + nsteps;
if (update->laststep < 0 || update->laststep > MAXBIGINT)
error->all("Too many timesteps");
if (startflag) update->beginstep = start; if (startflag) update->beginstep = start;
else update->beginstep = update->firststep; else update->beginstep = update->firststep;