Commit JT 072319

- added 2 oso examples in examples/SPIN/spinmin
- added doc for oso_cg and oso_lbfgs
This commit is contained in:
julient31
2019-07-23 09:27:15 -06:00
parent a9a2c7a496
commit f0679cff6d
12 changed files with 200 additions and 32 deletions

View File

@ -647,6 +647,7 @@ pair_sph_lj.html
pair_sph_rhosum.html pair_sph_rhosum.html
pair_sph_taitwater.html pair_sph_taitwater.html
pair_sph_taitwater_morris.html pair_sph_taitwater_morris.html
pair_spin_dipole.html
pair_spin_dmi.html pair_spin_dmi.html
pair_spin_exchange.html pair_spin_exchange.html
pair_spin_magelec.html pair_spin_magelec.html

View File

@ -13,11 +13,11 @@ min_modify command :h3
min_modify keyword values ... :pre min_modify keyword values ... :pre
one or more keyword/value pairs may be listed :ulb,l one or more keyword/value pairs may be listed :ulb,l
keyword = {dmax} or {line} or {alpha_damp} or {discrete_factor} keyword = {dmax} or {line} or {alpha_damp} or {discrete_factor} or {spin_cubic} or {spin_none}
{dmax} value = max {dmax} value = max
max = maximum distance for line search to move (distance units) max = maximum distance for line search to move (distance units)
{line} value = {backtrack} or {quadratic} or {forcezero} {line} value = {backtrack} or {quadratic} or {forcezero} or {spin_cubic} or {spin_none}
backtrack,quadratic,forcezero = style of linesearch to use backtrack,quadratic,forcezero,spin_cubic,spin_none = style of linesearch to use
{alpha_damp} value = damping {alpha_damp} value = damping
damping = fictitious Gilbert damping for spin minimization (adim) damping = fictitious Gilbert damping for spin minimization (adim)
{discrete_factor} value = factor {discrete_factor} value = factor
@ -80,7 +80,21 @@ See "min_spin"_min_spin.html for more information about those
quantities. quantities.
Default values are {alpha_damp} = 1.0 and {discrete_factor} = 10.0. Default values are {alpha_damp} = 1.0 and {discrete_factor} = 10.0.
[Restrictions:] none The choice of a line search algorithm for the {spin_oso_cg} and
{spin_oso_lbfgs} can be specified via the {line} keyword.
The {spin_cubic} and {spin_none} only make sense when those two
when one of those two minimization styles is declared.
The {spin_cubic} keyword activates the line search procedure when
the {spin_oso_cg} algorithm is used.
The {spin_none} keyword deactivates the line search procedure when
the {spin_oso_lbfgs} algorithm is used.
[Restrictions:] The line search procedure of styles
{spin_oso_cg} and {spin_oso_lbfgs} cannot be used for magnetic
NEB calculations. See "neb/spin"_neb_spin.html for more
explanation.
[Related commands:] [Related commands:]

View File

@ -6,14 +6,19 @@
:line :line
min_style spin command :h3 min_style spin command :h3
min_style spin_oso_cg command :h3
min_style spin_oso_lbfgs command :h3
[Syntax:] [Syntax:]
min_style spin :pre min_style spin
min_style spin_oso_cg
min_style spin_oso_lbfgs :pre
[Examples:] [Examples:]
min_style spin :pre min_style spin_oso_lbfgs
min_modify discrete_factor 10.0 line_search 0 :pre
[Description:] [Description:]
@ -46,9 +51,29 @@ definition of this timestep.
{discrete_factor} can be defined with the "min_modify"_min_modify.html {discrete_factor} can be defined with the "min_modify"_min_modify.html
command. command.
NOTE: The {spin} style replaces the force tolerance by a torque Style {spin_oso_cg} defines an orthogonal spin optimization
(OSO) combined to a conjugate gradient (CG) algorithm.
The "min_modify"_min_modify.html command can be used to
couple the {spin_oso_cg} to a line search procedure, and to modify the
discretization factor {discrete_factor}.
Style {spin_oso_lbfgs} defines an orthogonal spin optimization
(OSO) combined to a limited-memory Broyden-Fletcher-Goldfarb-Shanno
(LBFGS) algorithm.
By default, style {spin_oso_lbfgs} uses a line search procedure.
The "min_modify"_min_modify.html command can be used to
deactivate the line search procedure.
For more information about styles {spin_oso_cg} and {spin_oso_lbfgs},
see their implementation reported in "(Ivanov)"_#Ivanov1.
NOTE: All the {spin} styles replace the force tolerance by a torque
tolerance. See "minimize"_minimize.html for more explanation. tolerance. See "minimize"_minimize.html for more explanation.
NOTE: The {spin_oso_cg} and {spin_oso_lbfgs} styles can be used
for magnetic NEB calculations only if the line search procedure
is deactivated. See "neb/spin"_neb_spin.html for more explanation.
[Restrictions:] [Restrictions:]
This minimization procedure is only applied to spin degrees of This minimization procedure is only applied to spin degrees of
@ -63,3 +88,8 @@ freedom for a frozen lattice configuration.
The option defaults are {alpha_damp} = 1.0 and {discrete_factor} = The option defaults are {alpha_damp} = 1.0 and {discrete_factor} =
10.0. 10.0.
:line
:link(Ivanov1)
[(Ivanov)] Ivanov, Uzdin, Jonsson. arXiv preprint arXiv:1904.02669, (2019).

View File

@ -11,7 +11,8 @@ min_style command :h3
min_style style :pre min_style style :pre
style = {cg} or {hftn} or {sd} or {quickmin} or {fire} or {spin} :ul style = {cg} or {hftn} or {sd} or {quickmin} or {fire} or {spin}
or {spin_oso_cg} or {spin_oso_lbfgs} :ul
[Examples:] [Examples:]
@ -64,11 +65,25 @@ a minimization.
Style {spin} is a damped spin dynamics with an adaptive Style {spin} is a damped spin dynamics with an adaptive
timestep. timestep.
See the "min/spin"_min_spin.html doc page for more information.
Style {spin_oso_cg} uses an orthogonal spin optimization (OSO)
combined to a conjugate gradient (CG) approach to minimize spin
configurations.
Style {spin_oso_lbfgs} uses an orthogonal spin optimization (OSO)
combined to a limited-memory Broyden-Fletcher-Goldfarb-Shanno
(LBFGS) approach to minimize spin configurations.
See the "min/spin"_min_spin.html doc page for more information
about the {spin}, {spin_oso_cg} and {spin_oso_lbfgs} styles.
Either the {quickmin} and {fire} styles are useful in the context of Either the {quickmin} and {fire} styles are useful in the context of
nudged elastic band (NEB) calculations via the "neb"_neb.html command. nudged elastic band (NEB) calculations via the "neb"_neb.html command.
Either the {spin}, {spin_oso_cg} and {spin_oso_lbfgs} styles are useful
in the context of magnetic geodesic nudged elastic band (GNEB) calculations
via the "neb/spin"_neb_spin.html command.
NOTE: The damped dynamic minimizers use whatever timestep you have NOTE: The damped dynamic minimizers use whatever timestep you have
defined via the "timestep"_timestep.html command. Often they will defined via the "timestep"_timestep.html command. Often they will
converge more quickly if you use a timestep about 10x larger than you converge more quickly if you use a timestep about 10x larger than you

View File

@ -103,7 +103,8 @@ the line search fails because the step distance backtracks to 0.0
the number of outer iterations or timesteps exceeds {maxiter} the number of outer iterations or timesteps exceeds {maxiter}
the number of total force evaluations exceeds {maxeval} :ul the number of total force evaluations exceeds {maxeval} :ul
NOTE: the "minimization style"_min_style.html {spin} replaces NOTE: the "minimization style"_min_style.html {spin},
{spin_oso_cg}, and {spin_oso_lbfgs} replace
the force tolerance {ftol} by a torque tolerance. the force tolerance {ftol} by a torque tolerance.
The minimization procedure stops if the 2-norm (length) of the The minimization procedure stops if the 2-norm (length) of the
global torque vector (defined as the cross product between the global torque vector (defined as the cross product between the

View File

@ -172,7 +172,8 @@ command is issued.
A NEB calculation proceeds in two stages, each of which is a A NEB calculation proceeds in two stages, each of which is a
minimization procedure, performed via damped dynamics. To enable minimization procedure, performed via damped dynamics. To enable
this, you must first define a damped spin dynamics this, you must first define a damped spin dynamics
"min_style"_min_style.html, using the {spin} style (see "min_style"_min_style.html, using either the {spin},
{spin_oso_cg}, or {spin_oso_lbfgs} style (see
"min_spin"_min_spin.html for more information). "min_spin"_min_spin.html for more information).
The other styles cannot be used, since they relax the lattice The other styles cannot be used, since they relax the lattice
degrees of freedom instead of the spins. degrees of freedom instead of the spins.
@ -358,6 +359,9 @@ This command can only be used if LAMMPS was built with the SPIN
package. See the "Build package"_Build_package.html doc package. See the "Build package"_Build_package.html doc
page for more info. page for more info.
The line search procedures of the {spin_oso_cg} and {spin_oso_lbfgs}
minimization styles cannot be used in a GNEB calculation.
:line :line
[Related commands:] [Related commands:]

View File

@ -25,9 +25,8 @@ pair_coeff * * 10.0
pair_coeff 2 3 8.0 :pre pair_coeff 2 3 8.0 :pre
pair_style spin/dipole/long 9.0 pair_style spin/dipole/long 9.0
pair_coeff * * 1.0 1.0 pair_coeff * * 10.0
pair_coeff 2 3 1.0 1.0 2.5 4.0 scale 0.5 pair_coeff 2 3 6.0 :pre
pair_coeff 2 3 1.0 1.0 2.5 4.0 :pre
[Description:] [Description:]

View File

@ -0,0 +1,54 @@
# bfo in a 3d periodic box
units metal
dimension 3
boundary p p f
atom_style spin
# necessary for the serial algorithm (sametag)
atom_modify map array
lattice sc 3.96
region box block 0.0 34.0 0.0 34.0 0.0 1.0
create_box 1 box
create_atoms 1 box
# setting mass, mag. moments, and interactions for bcc iron
mass 1 1.0
set group all spin/random 11 2.50
pair_style hybrid/overlay spin/exchange 6.0 spin/magelec 4.5 spin/dmi 4.5
pair_coeff * * spin/exchange exchange 6.0 -0.01575 0.0 1.965
# pair_coeff * * spin/magelec magelec 4.5 0.000109 1.0 1.0 1.0
pair_coeff * * spin/magelec magelec 4.5 0.00109 1.0 1.0 1.0
pair_coeff * * spin/dmi dmi 4.5 0.00005 1.0 1.0 1.0
neighbor 0.1 bin
neigh_modify every 10 check yes delay 20
fix 1 all precession/spin anisotropy 0.0000033 0.0 0.0 1.0
fix_modify 1 energy yes
timestep 0.0001
compute out_mag all spin
compute out_pe all pe
compute out_ke all ke
compute out_temp all temp
variable magz equal c_out_mag[3]
variable magnorm equal c_out_mag[4]
variable emag equal c_out_mag[5]
variable tmag equal c_out_mag[6]
thermo 50
thermo_style custom step time v_magnorm v_emag v_tmag temp etotal
thermo_modify format float %20.15g
compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 1 all custom 50 dump.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3] c_outsp[4] c_outsp[5] c_outsp[6] c_outsp[7]
min_style spin/oso_cg
min_modify discrete_factor 10.0 line_search 0
minimize 1.0e-10 1.0e-10 10000 1000

View File

@ -0,0 +1,54 @@
# bfo in a 3d periodic box
units metal
dimension 3
boundary p p f
atom_style spin
# necessary for the serial algorithm (sametag)
atom_modify map array
lattice sc 3.96
region box block 0.0 34.0 0.0 34.0 0.0 1.0
create_box 1 box
create_atoms 1 box
# setting mass, mag. moments, and interactions for bcc iron
mass 1 1.0
set group all spin/random 11 2.50
pair_style hybrid/overlay spin/exchange 6.0 spin/magelec 4.5 spin/dmi 4.5
pair_coeff * * spin/exchange exchange 6.0 -0.01575 0.0 1.965
#pair_coeff * * spin/magelec magelec 4.5 0.000109 1.0 1.0 1.0
pair_coeff * * spin/magelec magelec 4.5 0.00109 1.0 1.0 1.0
pair_coeff * * spin/dmi dmi 4.5 0.00005 1.0 1.0 1.0
neighbor 0.1 bin
neigh_modify every 10 check yes delay 20
fix 1 all precession/spin anisotropy 0.0000033 0.0 0.0 1.0
fix_modify 1 energy yes
timestep 0.0001
compute out_mag all spin
compute out_pe all pe
compute out_ke all ke
compute out_temp all temp
variable magz equal c_out_mag[3]
variable magnorm equal c_out_mag[4]
variable emag equal c_out_mag[5]
variable tmag equal c_out_mag[6]
thermo 50
thermo_style custom step time v_magnorm v_emag v_tmag temp etotal
thermo_modify format float %20.15g
compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 1 all custom 50 dump.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3] c_outsp[4] c_outsp[5] c_outsp[6] c_outsp[7]
min_style spin/oso_lbfgs
min_modify discrete_factor 10.0 line_search 1
minimize 1.0e-15 1.0e-10 10000 1000

View File

@ -80,12 +80,12 @@ void MinSpin::setup_style()
int MinSpin::modify_param(int narg, char **arg) int MinSpin::modify_param(int narg, char **arg)
{ {
if (strcmp(arg[0],"alpha_damp") == 0) { if (strcmp(arg[0],"alpha_damp") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); if (narg < 2) error->all(FLERR,"Illegal min_modify command");
alpha_damp = force->numeric(FLERR,arg[1]); alpha_damp = force->numeric(FLERR,arg[1]);
return 2; return 2;
} }
if (strcmp(arg[0],"discrete_factor") == 0) { if (strcmp(arg[0],"discrete_factor") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); if (narg < 2) error->all(FLERR,"Illegal min_modify command");
discrete_factor = force->numeric(FLERR,arg[1]); discrete_factor = force->numeric(FLERR,arg[1]);
return 2; return 2;
} }

View File

@ -133,12 +133,10 @@ void MinSpinOSO_CG::setup_style()
int MinSpinOSO_CG::modify_param(int narg, char **arg) int MinSpinOSO_CG::modify_param(int narg, char **arg)
{ {
if (strcmp(arg[0],"line_search") == 0) { if (strcmp(arg[0],"line_search") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); if (narg < 2) error->all(FLERR,"Illegal min_modify command");
use_line_search = force->numeric(FLERR,arg[1]); use_line_search = force->numeric(FLERR,arg[1]);
if (nreplica > 1 && use_line_search) if (nreplica > 1 && use_line_search)
error->all(FLERR,"Illegal fix_modify command, cannot use NEB and line search together"); error->all(FLERR,"Illegal fix_modify command, cannot use NEB and line search together");
return 2; return 2;
} }
if (strcmp(arg[0],"discrete_factor") == 0) { if (strcmp(arg[0],"discrete_factor") == 0) {
@ -250,9 +248,9 @@ int MinSpinOSO_CG::iterate(int maxiter)
neval++; neval++;
} }
//// energy tolerance criterion // energy tolerance criterion
//// only check after DELAYSTEP elapsed since velocties reset to 0 // only check after DELAYSTEP elapsed since velocties reset to 0
//// sync across replicas if running multi-replica minimization // sync across replicas if running multi-replica minimization
if (update->etol > 0.0 && ntimestep-last_negative > DELAYSTEP) { if (update->etol > 0.0 && ntimestep-last_negative > DELAYSTEP) {
if (update->multireplica == 0) { if (update->multireplica == 0) {

View File

@ -145,16 +145,14 @@ int MinSpinOSO_LBFGS::modify_param(int narg, char **arg)
{ {
if (strcmp(arg[0],"line_search") == 0) { if (strcmp(arg[0],"line_search") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); if (narg < 2) error->all(FLERR,"Illegal min_modify command");
use_line_search = force->numeric(FLERR,arg[1]); use_line_search = force->numeric(FLERR,arg[1]);
if (nreplica > 1 && use_line_search) if (nreplica > 1 && use_line_search)
error->all(FLERR,"Illegal fix_modify command, cannot use NEB and line search together"); error->all(FLERR,"Illegal min_modify command, cannot use NEB and line search together");
return 2; return 2;
} }
if (strcmp(arg[0],"discrete_factor") == 0) { if (strcmp(arg[0],"discrete_factor") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); if (narg < 2) error->all(FLERR,"Illegal min_modify command");
double discrete_factor; double discrete_factor;
discrete_factor = force->numeric(FLERR,arg[1]); discrete_factor = force->numeric(FLERR,arg[1]);
maxepsrot = MY_2PI / (10 * discrete_factor); maxepsrot = MY_2PI / (10 * discrete_factor);
@ -266,9 +264,9 @@ int MinSpinOSO_LBFGS::iterate(int maxiter)
neval++; neval++;
} }
//// energy tolerance criterion // energy tolerance criterion
//// only check after DELAYSTEP elapsed since velocties reset to 0 // only check after DELAYSTEP elapsed since velocties reset to 0
//// sync across replicas if running multi-replica minimization // sync across replicas if running multi-replica minimization
if (update->etol > 0.0 && ntimestep-last_negative > DELAYSTEP) { if (update->etol > 0.0 && ntimestep-last_negative > DELAYSTEP) {
if (update->multireplica == 0) { if (update->multireplica == 0) {