flag to control the initial delay for dtshrink

This commit is contained in:
Julien Guénolé 2017-09-01 20:49:32 +02:00
parent 16934e4ce4
commit a296c43d78
3 changed files with 12 additions and 1 deletions

View File

@ -64,6 +64,7 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp)
tmin = 0.02;
integrator = 0;
halfstepback_flag = 1;
delaystep_start_flag = 1;
relaxbox_mod = 1000000;
relaxbox_rate = 0.33;
relaxbox_flag = 0;
@ -692,6 +693,12 @@ void Min::modify_params(int narg, char **arg)
else if (strcmp(arg[iarg+1],"no") == 0) halfstepback_flag = 0;
else error->all(FLERR,"Illegal min_modify command");
iarg += 2;
} else if (strcmp(arg[iarg],"initialdelay") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
if (strcmp(arg[iarg+1],"yes") == 0) delaystep_start_flag = 1;
else if (strcmp(arg[iarg+1],"no") == 0) delaystep_start_flag = 0;
else error->all(FLERR,"Illegal min_modify command");
iarg += 2;
} else if (strcmp(arg[iarg],"integrator") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
if (strcmp(arg[iarg+1],"eulerimplicit") == 0) integrator = 0;

View File

@ -65,6 +65,7 @@ class Min : protected Pointers {
double tmax,tmin; // timestep multiplicators max, min
int integrator; // Newton integration: euler, leapfrog, verlet...
int halfstepback_flag; // half step backward when v.f <= 0.0
int delaystep_start_flag; // delay the initial dt_shrink
double relaxbox_mod; // Bulk modulus used for box relax
double relaxbox_rate; // for box relaxation to 0 pressure
int relaxbox_flag; // 1: box relaxation iso; 2: aniso

View File

@ -315,7 +315,10 @@ int MinAdaptGlok::iterate(int maxiter)
} else {
last_negative = ntimestep;
if (ntimestep - ntimestep_start > delaystep) {
int delayflag = 1;
if (ntimestep - ntimestep_start < delaystep && delaystep_start_flag)
delayflag = 0;
if (delayflag) {
alpha = alpha0;
if (dt*dtshrink >= dtmin) {
dt *= dtshrink;