From fe940abecfb1daebd0a58dc56b6e2512e2b1b7fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Gu=C3=A9nol=C3=A9?= Date: Fri, 30 Jun 2017 18:35:59 +0200 Subject: [PATCH] update --- src/min.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++ src/min.h | 6 +++++ src/min_adaptglok.cpp | 4 +++- 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/src/min.cpp b/src/min.cpp index d308efb848..6c1006a82d 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -55,6 +55,14 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp) searchflag = 0; linestyle = 1; + DELAYSTEP = 20; + DT_GROW = 1.1; + DT_SHRINK = 0.5; + ALPHA0 = 0.25; + ALPHA_SHRINK = 0.99; + TMAX = 2.0; + TMIN = 0.02; + elist_global = elist_atom = NULL; vlist_global = vlist_atom = NULL; @@ -643,6 +651,50 @@ void Min::modify_params(int narg, char **arg) if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); dmax = force->numeric(FLERR,arg[iarg+1]); iarg += 2; + /* Wolfram + Hack: define some new parameters + DELAYSTEP 5 + DT_GROW 1.1 + DT_SHRINK 0.5 + ALPHA0 0.1 + ALPHA_SHRINK 0.99 + TMAX 10.0 + */ + } else if (strcmp(arg[iarg],"fire_delaystep") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); + DELAYSTEP = force->numeric(FLERR,arg[iarg+1]); + if (comm->me == 0 && screen) fprintf(screen,"DELAYSTEP: %d \n", DELAYSTEP); + iarg += 2; + } else if (strcmp(arg[iarg],"fire_dt_grow") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); + DT_GROW = force->numeric(FLERR,arg[iarg+1]); + if (comm->me == 0 && screen) fprintf(screen,"DT_GROW: %.8f \n", DT_GROW); + iarg += 2; + } else if (strcmp(arg[iarg],"fire_dt_shrink") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); + DT_SHRINK = force->numeric(FLERR,arg[iarg+1]); + if (comm->me == 0 && screen) fprintf(screen,"DT_SHRINK: %.8f \n", DT_SHRINK); + iarg += 2; + } else if (strcmp(arg[iarg],"fire_alpha0") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); + ALPHA0 = force->numeric(FLERR,arg[iarg+1]); + if (comm->me == 0 && screen) fprintf(screen,"ALPHA0: %.8f \n", ALPHA0); + iarg += 2; + } else if (strcmp(arg[iarg],"fire_alpha_shrink") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); + ALPHA_SHRINK = force->numeric(FLERR,arg[iarg+1]); + if (comm->me == 0 && screen) fprintf(screen,"ALPHA_SHRINK: %.8f \n", ALPHA_SHRINK); + iarg += 2; + } else if (strcmp(arg[iarg],"fire_tmax") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); + TMAX = force->numeric(FLERR,arg[iarg+1]); + if (comm->me == 0 && screen) fprintf(screen,"TMAX: %.8f \n", TMAX); + iarg += 2; + } else if (strcmp(arg[iarg],"fire_tmin") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); + TMAX = force->numeric(FLERR,arg[iarg+1]); + if (comm->me == 0 && screen) fprintf(screen,"TMIN: %.8f \n", TMAX); + iarg += 2; } else if (strcmp(arg[iarg],"line") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); if (strcmp(arg[iarg+1],"backtrack") == 0) linestyle = 0; diff --git a/src/min.h b/src/min.h index 021198bc09..e4ffa7c6f9 100644 --- a/src/min.h +++ b/src/min.h @@ -58,6 +58,12 @@ class Min : protected Pointers { double dmax; // max dist to move any atom in one step int linestyle; // 0 = backtrack, 1 = quadratic, 2 = forcezero +/* Wolframs include of FIRE parameters */ + int DELAYSTEP; // FIRE parameters + double DT_GROW,DT_SHRINK; + double ALPHA0,ALPHA_SHRINK; + double TMAX,TMIN; + int nelist_global,nelist_atom; // # of PE,virial computes to check int nvlist_global,nvlist_atom; class Compute **elist_global; // lists of PE,virial Computes diff --git a/src/min_adaptglok.cpp b/src/min_adaptglok.cpp index b6f9aa25c8..a2c31d1ae8 100644 --- a/src/min_adaptglok.cpp +++ b/src/min_adaptglok.cpp @@ -27,6 +27,7 @@ using namespace LAMMPS_NS; #define EPS_ENERGY 1.0e-8 +/* Default values defined in min.cpp > Min::Min(LAMMPS *lmp) : Pointers(lmp) #define DELAYSTEP 20 #define DT_GROW 1.1 #define DT_SHRINK 0.5 @@ -34,6 +35,7 @@ using namespace LAMMPS_NS; #define ALPHA_SHRINK 0.99 #define TMAX 2.0 #define TMIN 0.02 // as harcoded in IMD: 1/50 +*/ /* ---------------------------------------------------------------------- */ @@ -242,7 +244,7 @@ int MinAdaptGlok::iterate(int maxiter) v[i][1] += dtfm * f[i][1]; v[i][2] += dtfm * f[i][2]; if (vdotfall > 0.0) { - // we perform the mixing AFTER the timeintegration + // we perform the mixing AFTER the velocity has been calculated v[i][0] = scale1*v[i][0] + scale2*f[i][0]; v[i][1] = scale1*v[i][1] + scale2*f[i][1]; v[i][2] = scale1*v[i][2] + scale2*f[i][2];