From a296c43d7887b131417650707072f8681d05e331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Gu=C3=A9nol=C3=A9?= Date: Fri, 1 Sep 2017 20:49:32 +0200 Subject: [PATCH] flag to control the initial delay for dtshrink --- src/min.cpp | 7 +++++++ src/min.h | 1 + src/min_adaptglok.cpp | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/min.cpp b/src/min.cpp index 8e775e5609..bf2149cd19 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -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; diff --git a/src/min.h b/src/min.h index 62024fddaf..6cb7fcfcd6 100644 --- a/src/min.h +++ b/src/min.h @@ -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 diff --git a/src/min_adaptglok.cpp b/src/min_adaptglok.cpp index 3c54201e09..8deaa82691 100644 --- a/src/min_adaptglok.cpp +++ b/src/min_adaptglok.cpp @@ -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;