Commit 2 JT 031219

- modified examples (gneb and spinmin now distinct)
- started documention for spinmin
This commit is contained in:
julient31
2019-03-12 16:59:13 -06:00
parent 75ddde438c
commit f6fb8b220d
9 changed files with 42 additions and 163 deletions

View File

@ -13,11 +13,15 @@ min_modify command :h3
min_modify keyword values ... :pre
one or more keyword/value pairs may be listed :ulb,l
keyword = {dmax} or {line}
keyword = {dmax} or {line} or {alpha_damp} or {discret_factor}
{dmax} value = max
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 :pre
backtrack,quadratic,forcezero = style of linesearch to use
{alpha_damp} value = damping
damping = fictitious Gilbert damping for spin minimization (adim)
{discret_factor} value = factor
factor = defines a dividing factor for adaptive spin timestep (adim) :pre
:ule
[Examples:]
@ -65,6 +69,9 @@ difference of two large values (energy before and energy after) and
that difference may be smaller than machine epsilon even if atoms
could move in the gradient direction to reduce forces further.
Keywords {alpha_damp} and {discret_factor} only make sense when
a {spinmin} minimization style is declared.
[Restrictions:] none
[Related commands:]

View File

@ -11,11 +11,12 @@ min_style command :h3
min_style style :pre
style = {cg} or {hftn} or {sd} or {quickmin} or {fire} :ul
style = {cg} or {hftn} or {sd} or {quickmin} or {fire} or {spinmin} :ul
[Examples:]
min_style cg
min_style spinmin
min_style fire :pre
[Description:]
@ -61,9 +62,21 @@ 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.
Style {spinmin} is a damped spin dynamics with a variable
timestep as described in "(Tranchida)"_#Tranchida.
The value of the fictitious Gilbert damping and of the dividing
factor for the adaptive timestep can be modified by the
{alpha_damp} and {discret_factor} options respectively.
Those options can be defined using the "min_modify"_min_modify.html
command.
Either the {quickmin} and {fire} styles are useful in the context of
nudged elastic band (NEB) calculations via the "neb"_neb.html command.
The {spinmin} style is useful in the context of geodesic nudged
elastic band (GNEB) calculations via the "neb/spin"_neb_spin.html
command.
NOTE: The damped dynamic minimizers use whatever timestep you have
defined via the "timestep"_timestep.html command. Often they will
converge more quickly if you use a timestep about 10x larger than you

View File

@ -1,4 +1,4 @@
# bcc iron in a 3d periodic box
# bfo in a 3d periodic box
units metal
dimension 3
@ -9,7 +9,7 @@ atom_style spin
atom_modify map array
lattice sc 3.96
region box block 0.0 68.0 0.0 68.0 0.0 1.0
region box block 0.0 34.0 0.0 34.0 0.0 1.0
create_box 1 box
create_atoms 1 box
@ -17,7 +17,6 @@ create_atoms 1 box
mass 1 1.0
set group all spin/random 11 2.50
#set group all spin 2.5 -1.0 0.0 0.0
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
@ -30,7 +29,8 @@ neigh_modify every 10 check yes delay 20
#fix 1 all precession/spin zeeman 0.001 0.0 0.0 1.0 anisotropy 0.01 1.0 0.0 0.0
fix 1 all precession/spin anisotropy 0.0000033 0.0 0.0 1.0
fix 2 all langevin/spin 0.1 0.0 21
fix_modify 1 energy yes
fix 2 all langevin/spin 0.0 0.1 21
fix 3 all nve/spin lattice no
timestep 0.0001
@ -50,8 +50,8 @@ 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 200 all custom 1 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]
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 spinmin
minimize 1.0e-6 1.0e-6 10000 10000
#minimize 1.0e-8 1.0e-8 10000 1000
min_modify alpha_damp 1.0 discret_factor 10.0
minimize 0.0 0.0 10000 1000

View File

@ -9,7 +9,7 @@ atom_style spin
atom_modify map array
lattice bcc 2.8665
region box block 0.0 4.0 0.0 4.0 0.0 1.0
region box block 0.0 4.0 0.0 4.0 0.0 4.0
create_box 1 box
create_atoms 1 box
@ -17,7 +17,7 @@ create_atoms 1 box
mass 1 55.845
set group all spin/random 31 2.2
#set group all spin 2.2 -1.0 0.0 0.0
#set group all spin 2.2 1.0 1.0 -1.0
pair_style spin/exchange 3.5
pair_coeff * * exchange 3.4 0.02726 0.2171 1.841
@ -26,8 +26,9 @@ neighbor 0.1 bin
neigh_modify every 10 check yes delay 20
#fix 1 all precession/spin zeeman 0.001 0.0 0.0 1.0 anisotropy 0.01 1.0 0.0 0.0
fix 1 all precession/spin anisotropy 0.001 0.0 0.0 1.0
fix 2 all langevin/spin 0.1 0.0 21
fix 1 all precession/spin anisotropy 0.0001 0.0 0.0 1.0
fix_modify 1 energy yes
fix 2 all langevin/spin 0.0 0.1 21
fix 3 all nve/spin lattice no
timestep 0.0001
@ -37,18 +38,20 @@ compute out_pe all pe
compute out_ke all ke
compute out_temp all temp
variable magx equal c_out_mag[1]
variable magy equal c_out_mag[2]
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 1
thermo_style custom step time v_magnorm v_emag v_tmag temp etotal
thermo 100
thermo_style custom step time v_magx v_magz v_magnorm v_tmag etotal
thermo_modify format float %20.15g
compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 1 all custom 1 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]
dump 1 all custom 100 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 spinmin
minimize 1.0e-6 1.0e-6 1000 10000
#minimize 1.0e-8 1.0e-6 1000 10000
min_modify alpha_damp 1.0 discret_factor 10.0
minimize 1.0e-10 1.0e-10 100000 1000

View File

@ -843,156 +843,12 @@ double FixNEB_spin::geodesic_distance(double spi[3], double spj[3])
return dist;
}
/* ----------------------------------------------------------------------
geometric damped advance os spins
---------------------------------------------------------------------- */
//void FixNEB_spin::advance_spins(double dts)
//{
// //int j=0;
// //int *sametag = atom->sametag;
// int nlocal = atom->nlocal;
// int *mask = atom->mask;
// double **sp = atom->sp;
// double **fm = atom->fm;
// double tdampx,tdampy,tdampz;
// double msq,scale,fm2,energy,dts2;
// double alpha;
// double spi[3],fmi[3];
// double cp[3],g[3];
//
// //cp[0] = cp[1] = cp[2] = 0.0;
// //g[0] = g[1] = g[2] = 0.0;
// dts2 = dts*dts;
//
// // fictitious Gilbert damping of 1
// alpha = 1.0;
//
// // loop on all spins on proc.
//
// if (ireplica != nreplica-1 && ireplica != 0)
// for (int i = 0; i < nlocal; i++)
// if (mask[i] & groupbit) {
//
// spi[0] = sp[i][0];
// spi[1] = sp[i][1];
// spi[2] = sp[i][2];
//
// fmi[0] = fm[i][0];
// fmi[1] = fm[i][1];
// fmi[2] = fm[i][2];
//
// // calc. damping torque
//
// tdampx = -alpha*(fmi[1]*spi[2] - fmi[2]*spi[1]);
// tdampy = -alpha*(fmi[2]*spi[0] - fmi[0]*spi[2]);
// tdampz = -alpha*(fmi[0]*spi[1] - fmi[1]*spi[0]);
//
// // apply advance algorithm (geometric, norm preserving)
//
// fm2 = (tdampx*tdampx+tdampy*tdampy+tdampz*tdampz);
// energy = (sp[i][0]*tdampx)+(sp[i][1]*tdampy)+(sp[i][2]*tdampz);
//
// cp[0] = tdampy*sp[i][2]-tdampz*sp[i][1];
// cp[1] = tdampz*sp[i][0]-tdampx*sp[i][2];
// cp[2] = tdampx*sp[i][1]-tdampy*sp[i][0];
//
// g[0] = sp[i][0]+cp[0]*dts;
// g[1] = sp[i][1]+cp[1]*dts;
// g[2] = sp[i][2]+cp[2]*dts;
//
// g[0] += (fm[i][0]*energy-0.5*sp[i][0]*fm2)*0.5*dts2;
// g[1] += (fm[i][1]*energy-0.5*sp[i][1]*fm2)*0.5*dts2;
// g[2] += (fm[i][2]*energy-0.5*sp[i][2]*fm2)*0.5*dts2;
//
// g[0] /= (1+0.25*fm2*dts2);
// g[1] /= (1+0.25*fm2*dts2);
// g[2] /= (1+0.25*fm2*dts2);
//
// sp[i][0] = g[0];
// sp[i][1] = g[1];
// sp[i][2] = g[2];
//
// // renormalization (check if necessary)
//
// msq = g[0]*g[0] + g[1]*g[1] + g[2]*g[2];
// scale = 1.0/sqrt(msq);
// sp[i][0] *= scale;
// sp[i][1] *= scale;
// sp[i][2] *= scale;
//
// // comm. sp[i] to atoms with same tag (for serial algo)
//
// // no need for simplecticity
// //if (sector_flag == 0) {
// // if (sametag[i] >= 0) {
// // j = sametag[i];
// // while (j >= 0) {
// // sp[j][0] = sp[i][0];
// // sp[j][1] = sp[i][1];
// // sp[j][2] = sp[i][2];
// // j = sametag[j];
// // }
// // }
// //}
// //
//
// }
//}
/* ----------------------------------------------------------------------
evaluate max timestep
---------------------------------------------------------------------- */
//double FixNEB_spin::evaluate_dt()
//{
// double dtmax;
// double fmsq;
// double fmaxsqone,fmaxsqloc,fmaxsqall;
// int nlocal = atom->nlocal;
// int *mask = atom->mask;
// double **fm = atom->fm;
//
// // finding max fm on this proc.
//
// fmsq = fmaxsqone = fmaxsqloc = fmaxsqall = 0.0;
// for (int i = 0; i < nlocal; i++)
// if (mask[i] & groupbit) {
// fmsq = fm[i][0]*fm[i][0]+fm[i][1]*fm[i][1]+fm[i][2]*fm[i][2];
// fmaxsqone = MAX(fmaxsqone,fmsq);
// }
//
// // finding max fm on this replica
//
// fmaxsqloc = fmaxsqone;
// MPI_Allreduce(&fmaxsqone,&fmaxsqloc,1,MPI_DOUBLE,MPI_MAX,world);
//
// // finding max fm over all replicas, if necessary
// // this communicator would be invalid for multiprocess replicas
//
// if (update->multireplica == 1) {
// fmaxsqall = fmaxsqloc;
// MPI_Allreduce(&fmaxsqloc,&fmaxsqall,1,MPI_DOUBLE,MPI_MAX,universe->uworld);
// }
//
// if (fmaxsqall < fmaxsqloc)
// error->all(FLERR,"Incorrect fmaxall calc.");
//
// // define max timestep
// // dividing by 10 the inverse of max frequency
//
// dtmax = MY_2PI/(10.0*sqrt(fmaxsqall));
//
// return dtmax;
//}
/* ----------------------------------------------------------------------
send/recv NEB atoms to/from adjacent replicas
received atoms matching my local atoms are stored in xprev,xnext
replicas 0 and N-1 send but do not receive any atoms
------------------------------------------------------------------------- */
void FixNEB_spin::inter_replica_comm()
{
int i,m;