Commit a438d2c8 authored by Julien Guénolé's avatar Julien Guénolé
Browse files

Removing relaxbox code. Cleanup of the code. Add some parameter check. Improved documentation.

parent 0ef2f374
Loading
Loading
Loading
Loading
+35 −28
Changes for doc/src/min_modify.txt: 35 added lines, 28 removed lines.
Original line number Diff line number Diff line
@@ -19,19 +19,24 @@ keyword = {dmax} or {line} or {delaystep} or {dt_grow} or {dt_shrink}
    max = maximum distance for line search to move (distance units)
  {line} value = {backtrack} or {quadratic} or {forcezero}
    backtrack,quadratic,forcezero = style of linesearch to use
  {delaystep} value = {int} for adaptglok
  {dt_grow} value = {float}  for adaptglok
  {dt_shrink} value = {float} for adaptglok
  {alpha0} value = {float}  for adaptglok
  {alpha_shrink} value = {float}  for adaptglok
  {tmax} value = {float}  for adaptglok
  {tmin} value = {float}  for adaptglok
  {delaystep} value = steps
    steps = number of steps for dynamics temporization, adaptglok only
  {dtgrow} value = grow
    grow = factor increasing the timestep, adaptglok only
  {dtshrink} value = shrink
    shrink = factor decreasing the timestep, adaptglok only
  {alpha0} value = alpha
    alpha = coefficient mixing velocities and forces, adaptglok only
  {alphashrink} value = shrink
    shrink = factor decreasing alpha, adaptglok only
  {tmax} value = coef
    coef = factor defining the maximum timestep, adaptglok only
  {tmin} value = coef
    coef = factor defining the minimum timestep, adaptglok only
  {integrator} value = {eulerimplicit} or {eulerexplicit} or {verlet} 
                       or {leapfrog}  for adaptglok
  {halfstepback} value = {yes} or {no} for adaptglok :pre
  {relaxbox} value = {no} or {iso} or {axial} for adaptglok 
  {relaxbox_modulus} value = {float} for adaptglok 
  {relaxbox_rate} value = {float} for adaptglok 
                       or {leapfrog}
    eulerimplicit,eulerexplicit,verlet,leapfrog = integration scheme, adaptglok
  {halfstepback} value = {yes} or {no}, adaptglok only :pre
:ule

[Examples:]
@@ -80,18 +85,20 @@ that difference may be smaller than machine epsilon even if atoms
could move in the gradient direction to reduce forces further.

The style {adaptglok} has several parameters that can be tuned in order
to optimize the relaxation: {integrator}, {delaystep}, {dt_grow}, {dt_shrink}, 
{alpha0}, {alpha_shrink}, {tmax} and {tmin}. The default values have 
been chosen to be reliable in most cases, but one could be willing 
to adapt them for particular cases.
In particular for debugging purpose, it is possible to switch off the 
the backstep when downhill, by using and {halfstepback}.

The style {adaptglok} allows for a basic box relaxation to a stress-free 
state by choosing {relaxbox} {iso} or {axial}. One should give an
approximated value for the bulk modulus {relaxbox_modulus} of the system.
The default value of the relaxation rate {relaxbox_rate} should be 
optimum in most situations.
to optimize the relaxation: {integrator}, {delaystep}, {dtgrow}, {dtshrink}, 
{alpha0}, {alphashrink}, {tmax} and {tmin}.
Different Newton {integrator} can be selected: explicit Euler, 
semi-implicit Euler (= symplectic Euler), leapfrog, and velocity Verlet.
The parameters {tmax} and {tmin} define the maximum and minimum timestep 
allowed during an adaptglok minimization. Those are not in time unit, but are 
multiplication factor applied to the "timestep"_timestep.html. For example, 
{tmax} = 2.0 means that the maximum value the timestep can reach is twice the 
value defined by "timestep"_timestep.html.
Note that even with the default parameters being chosen to be reliable in most
cases, adjusting "timestep"_timestep.html, {tmax} and {tmin} should be consider
to optimize the minimization, in particular for large/complex system.
For debugging purposes, it is possible to switch off the back step when 
downhill with {halfstepback} = 0.

[Restrictions:] none

@@ -101,7 +108,7 @@ optimum in most situations.

[Default:]

The option defaults are dmax = 0.1,  line = quadratic, integrator = eulerimplicit, delaystep = 20, 
dt_grow = 1.1, dt_shrink = 0.5, alpha0 = 0.25, alpha_shrink = 0.99, 
tmax = 2.0, tmin = 0.02,  adaptstep = yes, halfstepback = yes,
relaxbox = no, relaxbox_modulus = 1000000 and relaxbox_rate = 0.33.
The option defaults are dmax = 0.1, line = quadratic, 
integrator = eulerimplicit, delaystep = 20, dt_grow = 1.1, dt_shrink = 0.5, 
alpha0 = 0.25, alpha_shrink = 0.99, tmax = 2.0, tmin = 0.02,  adaptstep = yes 
and halfstepback = yes.
+2 −4
Changes for doc/src/min_style.txt: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -66,10 +66,8 @@ fit the published and unpublished optimizations of the method described
in "(Bitzek)"_#Bitzek. It includes a temporization of the variable
timestep, a backstep when downhill and different integration
schemes.
Note that a basic scheme for having a stress-free simulation box is 
implemented within that style.

Either the {quickmin} and {fire} styles are useful in the context of
Either the {quickmin}, {fire} and {adaptglok} styles are useful in the context of
nudged elastic band (NEB) calculations via the "neb"_neb.html command.

NOTE: The damped dynamic minimizers use whatever timestep you have
@@ -77,7 +75,7 @@ defined via the "timestep"_timestep.html command. Often they will
converge more quickly if you use a timestep about 10x larger than you
would normally use for dynamics simulations.

NOTE: The {quickmin}, {fire}, and {hftn} styles do not yet support the
NOTE: The {quickmin}, {fire}, {adaptglok}, and {hftn} styles do not yet support the
use of the "fix box/relax"_fix_box_relax.html command or minimizations
involving the electron radius in "eFF"_pair_eff.html models.

+3 −3
Changes for doc/src/minimize.txt: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -64,9 +64,9 @@ backtracking method is described in Nocedal and Wright's Numerical
Optimization (Procedure 3.1 on p 41).

The "minimization styles"_min_style.html {quickmin}, {fire} and 
{adaptglok} perform damped dynamics using an Euler integration step 
(Velocity-Verlet for {adaptglok}). Thus they require a 
"timestep"_timestep.html be defined.
{adaptglok} perform damped dynamics using an Euler integration step. The style
{adaptglok} can also use a leapfrog or velocity Verlet integration step.
Thus they require a "timestep"_timestep.html be defined.

NOTE: The damped dynamic minimizers use whatever timestep you have
defined via the "timestep"_timestep.html command.  Often they will
+9 −27
Changes for src/min.cpp: 9 added lines, 27 removed lines.
Original line number Diff line number Diff line
@@ -56,17 +56,14 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp)
  linestyle = 1;

  delaystep = 20;
  dt_grow = 1.1;
  dt_shrink = 0.5;
  dtgrow = 1.1;
  dtshrink = 0.5;
  alpha0 = 0.25;
  alpha_shrink = 0.99;
  alphashrink = 0.99;
  tmax = 2.0;
  tmin = 0.02;
  integrator = 0;
  relaxbox_modulus = 1000000;
  relaxbox_rate = 0.33;
  halfstepback_flag = 1;
  relaxbox_flag = 0;

  elist_global = elist_atom = NULL;
  vlist_global = vlist_atom = NULL;
@@ -660,21 +657,21 @@ void Min::modify_params(int narg, char **arg)
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      delaystep = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"dt_grow") == 0) {
    } else if (strcmp(arg[iarg],"dtgrow") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      dt_grow = force->numeric(FLERR,arg[iarg+1]);
      dtgrow = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"dt_shrink") == 0) {
    } else if (strcmp(arg[iarg],"dtshrink") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      dt_shrink = force->numeric(FLERR,arg[iarg+1]);
      dtshrink = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"alpha0") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      alpha0 = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"alpha_shrink") == 0) {
    } else if (strcmp(arg[iarg],"alphashrink") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      alpha_shrink = force->numeric(FLERR,arg[iarg+1]);
      alphashrink = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;
    } else if (strcmp(arg[iarg],"tmax") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
@@ -690,21 +687,6 @@ 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],"relaxbox") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      if (strcmp(arg[iarg+1],"no") == 0) relaxbox_flag = 0;
      else if (strcmp(arg[iarg+1],"iso") == 0) relaxbox_flag = 1;
      else if (strcmp(arg[iarg+1],"axial") == 0) relaxbox_flag = 2;
      else error->all(FLERR,"Illegal min_modify command");
      iarg += 2;       
    } else if (strcmp(arg[iarg],"relaxbox_modulus") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      relaxbox_modulus = force->numeric(FLERR,arg[iarg+1]);
      iarg += 2;       
    } else if (strcmp(arg[iarg],"relaxbox_rate") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command");
      relaxbox_rate = force->numeric(FLERR,arg[iarg+1]);
      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;
+7 −9
Changes for src/min.h: 7 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -58,15 +58,13 @@ class Min : protected Pointers {
  double dmax;                // max dist to move any atom in one step
  int linestyle;              // 0 = backtrack, 1 = quadratic, 2 = forcezero

  int delaystep;              // minium steps of dynamics (adaptglok)
  double dt_grow,dt_shrink;   // timestep increase, decrease (adaptglok)
  double alpha0,alpha_shrink; // mixing velocities+forces coefficient (adaptglok)
  double tmax,tmin;           // timestep max, min (adaptglok)
  int integrator;             // choose the style of time integrator (adaptglok)
  double relaxbox_modulus;        // Bulk modulus used for box relax (for adaptglok)
  double relaxbox_rate;      // for box relaxation to 0 pressure (for adaptglok)
  int halfstepback_flag;      // 1: half step backward when v.f <= 0.0 (adaptglok)
  int relaxbox_flag;          // 1: box relaxation iso; 2: axial
  // only for min_adaptglok
  int delaystep;              // minium steps of dynamics
  double dtgrow,dtshrink;     // timestep increase, decrease 
  double alpha0,alphashrink;  // mixing velocities+forces coefficient
  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 nelist_global,nelist_atom;    // # of PE,virial computes to check
  int nvlist_global,nvlist_atom;
Loading