fully integrate ABC-FIRE and make it a min_modify option

This commit is contained in:
Axel Kohlmeyer
2023-01-10 16:20:00 -05:00
parent 58097b2e5f
commit 8800adf1cd
8 changed files with 48 additions and 63 deletions

View File

@ -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) <EcheverriRestrepo>`. This
can lead to faster convergence of the minimizer.
The :doc:`min_style <min_style>` *fire* is an optimized implementation of
:doc:`min_style <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).

View File

@ -91,12 +91,12 @@ by this style, at the beginning of a minimization.
Style *fire* is a damped dynamics method described in :ref:`(Bitzek)
<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) <Guenole>` that include different time integration
schemes and defaults parameters. The default parameters can be
modified with the command :doc:`min_modify <min_modify>`.
schemes and default parameters. The default parameters can be modified
with the command :doc:`min_modify <min_modify>`.
Style *fire/old* is the original implementation of *fire* in Lammps,
conserved for backward compatibility. The main differences regarding

View File

@ -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

View File

@ -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) {

View File

@ -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;

View File

@ -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

View File

@ -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;
}
}

View File

@ -39,9 +39,6 @@ class MinFire : public Min {
bigint last_negative, ntimestep_start;
int vdotf_negatif, flagv0;
template <int INTEGRATOR, bool ABCFLAG> int run_iterate(int);
protected:
bool abcflag;
};
} // namespace LAMMPS_NS