diff --git a/doc/src/min_modify.rst b/doc/src/min_modify.rst index 217e0b6523..aee9a78696 100644 --- a/doc/src/min_modify.rst +++ b/doc/src/min_modify.rst @@ -14,7 +14,7 @@ Syntax .. parsed-literal:: - keyword = *dmax* or *line* or *norm* or *alpha_damp* or *discrete_factor* or *integrator* or *tmax* + keyword = *dmax* or *line* or *norm* or *alpha_damp* or *discrete_factor* or *integrator* or *abcfire* or *tmax* *dmax* value = max max = maximum distance for line search to move (distance units) *line* value = *backtrack* or *quadratic* or *forcezero* or *spin_cubic* or *spin_none* @@ -29,6 +29,9 @@ Syntax factor = discretization factor for adaptive spin timestep (adim) *integrator* value = *eulerimplicit* or *verlet* or *leapfrog* or *eulerexplicit* time integration scheme for fire minimization + *abcfire* value = yes or no (default no) + yes = use ABC-FIRE variant of fire minimization style + no = use default FIRE variant of fire minimization style *tmax* value = factor factor = maximum adaptive timestep for fire minimization (adim) @@ -149,6 +152,14 @@ reached your minimization criteria. This could happen when the system comes to be stuck in a local basin of the phase space. *vdfmax* is the maximum number of consecutive iterations with P(t) < 0. +.. versionadded:: TBD + +The *abcfire* keyword allows to activate the ABC-FIRE variant of the +*fire* minimization algorithm. ABC-FIRE introduces an additional factor +that modifies the bias and scaling of the velocities of the atoms during +the mixing step :ref:`(Echeverri Restrepo) `. This +can lead to faster convergence of the minimizer. + The :doc:`min_style ` *fire* is an optimized implementation of :doc:`min_style ` *fire/old*. It can however behave similarly to the *fire/old* style by using the following set of parameters: @@ -184,3 +195,7 @@ For the *fire* style, the option defaults are integrator = eulerimplicit, tmax = 10.0, tmin = 0.02, delaystep = 20, dtgrow = 1.1, dtshrink = 0.5, alpha0 = 0.25, alphashrink = 0.99, vdfmax = 2000, halfstepback = yes and initialdelay = yes. + +.. _EcheverriRestrepo: + +**(EcheverriRestrepo)** Echeverri Restrepo, Andric, Comput Mater Sci, 218, 111978 (2023). diff --git a/doc/src/min_style.rst b/doc/src/min_style.rst index eab43ed3ca..56a7989dc4 100644 --- a/doc/src/min_style.rst +++ b/doc/src/min_style.rst @@ -91,12 +91,12 @@ by this style, at the beginning of a minimization. Style *fire* is a damped dynamics method described in :ref:`(Bitzek) `, which is similar to *quickmin* but adds a variable timestep and alters the projection operation to maintain components of the -velocity non-parallel to the current force vector. The velocity of -each atom is initialized to 0.0 by this style, at the beginning of a -minimization. This style correspond to an optimized version described +velocity non-parallel to the current force vector. The velocity of each +atom is initialized to 0.0 by this style, at the beginning of a +minimization. This style correspond to an optimized version described in :ref:`(Guenole) ` that include different time integration -schemes and defaults parameters. The default parameters can be -modified with the command :doc:`min_modify `. +schemes and default parameters. The default parameters can be modified +with the command :doc:`min_modify `. Style *fire/old* is the original implementation of *fire* in Lammps, conserved for backward compatibility. The main differences regarding diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 8e5a7ae6ad..90fcea09b4 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -97,6 +97,7 @@ amu Amzallag analytical Anders +Andric Andrienko Andzelm Ang @@ -873,6 +874,7 @@ ebook ebt ec Ec +Echeverri eco ecoul ecp @@ -3042,6 +3044,7 @@ resquared REsquared restartfile restartinfo +Restrepo rethrowing Revenga rewrap @@ -4025,6 +4028,7 @@ Zi ziegenhain Ziegenhain zincblende +zj Zj zlim zlo diff --git a/src/min.cpp b/src/min.cpp index 9e31fb4f26..002d302d7d 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -72,6 +72,7 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp) delaystep_start_flag = 1; max_vdotf_negatif = 2000; alpha_final = 0.0; + abcflag = 0; elist_global = elist_atom = nullptr; vlist_global = vlist_atom = cvlist_atom = nullptr; @@ -719,13 +720,17 @@ void Min::modify_params(int narg, char **arg) else if (strcmp(arg[iarg+1],"eulerexplicit") == 0) integrator = EULEREXPLICIT; else error->all(FLERR,"Illegal min_modify command"); iarg += 2; + } else if (strcmp(arg[iarg],"abcfire") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal min_modify command"); + abcflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + 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; - else if (strcmp(arg[iarg+1],"quadratic") == 0) linestyle = 1; - else if (strcmp(arg[iarg+1],"forcezero") == 0) linestyle = 2; - else if (strcmp(arg[iarg+1],"spin_cubic") == 0) linestyle = 3; - else if (strcmp(arg[iarg+1],"spin_none") == 0) linestyle = 4; + if (strcmp(arg[iarg+1],"backtrack") == 0) linestyle = BACKTRACK; + else if (strcmp(arg[iarg+1],"quadratic") == 0) linestyle = QUADRATIC; + else if (strcmp(arg[iarg+1],"forcezero") == 0) linestyle = FORCEZERO; + else if (strcmp(arg[iarg+1],"spin_cubic") == 0) linestyle = SPIN_CUBIC; + else if (strcmp(arg[iarg+1],"spin_none") == 0) linestyle = SPIN_NONE; else error->all(FLERR,"Illegal min_modify command"); iarg += 2; } else if (strcmp(arg[iarg],"norm") == 0) { diff --git a/src/min.h b/src/min.h index 74aa024eff..16629db69b 100644 --- a/src/min.h +++ b/src/min.h @@ -100,6 +100,7 @@ class Min : protected Pointers { int halfstepback_flag; // half step backward when v.f <= 0.0 int delaystep_start_flag; // delay the initial dt_shrink int max_vdotf_negatif; // maximum iteration with v.f > 0.0 + int abcflag; // when 1 use ABC-FIRE variant instead of FIRE, default 0 int nelist_global, nelist_atom; // # of PE,virial computes to check int nvlist_global, nvlist_atom, ncvlist_atom; diff --git a/src/min_abcfire.h b/src/min_abcfire.h deleted file mode 100644 index f339a8253c..0000000000 --- a/src/min_abcfire.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#ifdef MINIMIZE_CLASS -// clang-format off -MinimizeStyle(abcfire,MinABCFire); -// clang-format on -#else - -#ifndef LMP_MIN_ABCFIRE_H -#define LMP_MIN_ABCFIRE_H - -#include "min_fire.h" - -namespace LAMMPS_NS { - -class MinABCFire : public MinFire { - public: - MinABCFire(class LAMMPS *_lmp) : MinFire(_lmp) { abcflag = true; } -}; -} // namespace LAMMPS_NS - -#endif -#endif diff --git a/src/min_fire.cpp b/src/min_fire.cpp index d5f2e3e568..df8e952b69 100644 --- a/src/min_fire.cpp +++ b/src/min_fire.cpp @@ -42,10 +42,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -MinFire::MinFire(LAMMPS *lmp) : Min(lmp) -{ - abcflag = false; -} +MinFire::MinFire(LAMMPS *lmp) : Min(lmp) {} /* ---------------------------------------------------------------------- */ @@ -77,17 +74,17 @@ void MinFire::setup_style() // print the parameters used within fire/abcfire into the log const char *integrator_names[] = {"eulerimplicit", "verlet", "leapfrog", "eulerexplicit"}; - const char *yesno[] = {"yes", "no"}; + const char *yesno[] = {"no", "yes"}; if (comm->me == 0) utils::logmesg(lmp, " Parameters for {}:\n" - " {:^5} {:^9} {:^6} {:^8} {:^6} {:^11} {:^4} {:^4} {:^14} {:^12} \n" - " {:^5} {:^9} {:^6} {:^8} {:^6} {:^11} {:^4} {:^4} {:^14} {:^12} \n", + " {:^5} {:^9} {:^6} {:^8} {:^6} {:^11} {:^4} {:^4} {:^14} {:^12} {:^11}\n" + " {:^5} {:^9} {:^6} {:^8} {:^6} {:^11} {:^4} {:^4} {:^14} {:^12} {:^11}\n", update->minimize_style, "dmax", "delaystep", "dtgrow", "dtshrink", "alpha0", - "alphashrink", "tmax", "tmin", "integrator", "halfstepback", dmax, delaystep, - dtgrow, dtshrink, alpha0, alphashrink, tmax, tmin, integrator_names[integrator], - yesno[halfstepback_flag]); + "alphashrink", "tmax", "tmin", "integrator", "halfstepback", "abcfire", dmax, + delaystep, dtgrow, dtshrink, alpha0, alphashrink, tmax, tmin, + integrator_names[integrator], yesno[halfstepback_flag], yesno[abcflag]); // initialize the velocities @@ -140,8 +137,8 @@ int MinFire::iterate(int maxiter) break; default: - error->all(FLERR, "Unexpected integrator style {}; expected 1-{}", - integrator, (int)EULEREXPLICIT); + error->all(FLERR, "Unexpected integrator style {}; expected 1-{}", integrator, + (int) EULEREXPLICIT); return MAXITER; } } @@ -267,7 +264,7 @@ template int MinFire::run_iterate(int maxiter) // limit the value of alpha to avoid divergence of abcfire if (alpha < 1e-10) { alpha=1e-10; - } + } // calculate the factor abc, used for abcfire abc = (1-pow(1-alpha, (ntimestep-last_negative))); @@ -355,7 +352,7 @@ template int MinFire::run_iterate(int maxiter) } } } - + // limit timestep so no particle moves further than dmax dtvone = dt; @@ -367,7 +364,7 @@ template int MinFire::run_iterate(int maxiter) if (dtvone*vmax > dmax) dtvone = dmax/vmax; } } - + MPI_Allreduce(&dtvone,&dtv,1,MPI_DOUBLE,MPI_MIN,world); // reset velocities when necessary diff --git a/src/min_fire.h b/src/min_fire.h index 2f68d70493..bc8e662bd5 100644 --- a/src/min_fire.h +++ b/src/min_fire.h @@ -39,9 +39,6 @@ class MinFire : public Min { bigint last_negative, ntimestep_start; int vdotf_negatif, flagv0; template int run_iterate(int); - - protected: - bool abcflag; }; } // namespace LAMMPS_NS