Commit JT 041019
- corrected setforce/spin - added an example - added the documentation (in setforce) - updated the Howto_spin documentation
This commit is contained in:
@ -10,7 +10,7 @@ Documentation"_ld - "LAMMPS Commands"_lc :c
|
|||||||
Magnetic spins :h3
|
Magnetic spins :h3
|
||||||
|
|
||||||
The magnetic spin simulations are enabled by the SPIN package, whose
|
The magnetic spin simulations are enabled by the SPIN package, whose
|
||||||
implementation is detailed in "Tranchida"_#Tranchida7.
|
implementation is detailed in "Tranchida"_#Tranchida.
|
||||||
|
|
||||||
The model represents the simulation of atomic magnetic spins coupled
|
The model represents the simulation of atomic magnetic spins coupled
|
||||||
to lattice vibrations. The dynamics of those magnetic spins can be used
|
to lattice vibrations. The dynamics of those magnetic spins can be used
|
||||||
@ -36,13 +36,28 @@ A Langevin thermostat can be applied to those magnetic spins using
|
|||||||
"fix langevin/spin"_fix_langevin_spin.html. Typically, this thermostat
|
"fix langevin/spin"_fix_langevin_spin.html. Typically, this thermostat
|
||||||
can be coupled to another Langevin thermostat applied to the atoms
|
can be coupled to another Langevin thermostat applied to the atoms
|
||||||
using "fix langevin"_fix_langevin.html in order to simulate
|
using "fix langevin"_fix_langevin.html in order to simulate
|
||||||
thermostatted spin-lattice system.
|
thermostatted spin-lattice systems.
|
||||||
|
|
||||||
The magnetic Gilbert damping can also be applied using "fix
|
The magnetic Gilbert damping can also be applied using "fix
|
||||||
langevin/spin"_fix_langevin_spin.html. It allows to either dissipate
|
langevin/spin"_fix_langevin_spin.html. It allows to either dissipate
|
||||||
the thermal energy of the Langevin thermostat, or to perform a
|
the thermal energy of the Langevin thermostat, or to perform a
|
||||||
relaxation of the magnetic configuration toward an equilibrium state.
|
relaxation of the magnetic configuration toward an equilibrium state.
|
||||||
|
|
||||||
|
The command "fix setforce/spin"_fix_setforce.html allows to set the
|
||||||
|
components of the magnetic precession vectors (while erasing and
|
||||||
|
replacing the previsouly computed magnetic precession vectors on
|
||||||
|
the atom).
|
||||||
|
This command can be used to freeze the magnetic moment of certain
|
||||||
|
atoms in the simulation by zeroing their precession vector.
|
||||||
|
|
||||||
|
The command "fix nve/spin"_fix_nve_spin.html can be used to
|
||||||
|
perform a simplectic integration of the combined dynamics of spins
|
||||||
|
and atomic motions.
|
||||||
|
|
||||||
|
The minimization style "min/spin"_min_spin.html can be applied
|
||||||
|
to the spins to perform a minimization of the spin configuration.
|
||||||
|
|
||||||
|
|
||||||
All the computed magnetic properties can be output by two main
|
All the computed magnetic properties can be output by two main
|
||||||
commands. The first one is "compute spin"_compute_spin.html, that
|
commands. The first one is "compute spin"_compute_spin.html, that
|
||||||
enables to evaluate magnetic averaged quantities, such as the total
|
enables to evaluate magnetic averaged quantities, such as the total
|
||||||
@ -54,6 +69,6 @@ magnetic spin, or the magnetic force acting on this spin.
|
|||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
:link(Tranchida7)
|
:link(Tranchida)
|
||||||
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
||||||
arXiv preprint arXiv:1801.10233, (2018).
|
Journal of Computational Physics, 372, 406-425, (2018).
|
||||||
|
|||||||
@ -99,4 +99,4 @@ integration fix (e.g. {fix nve/spin}).
|
|||||||
|
|
||||||
:link(Tranchida2)
|
:link(Tranchida2)
|
||||||
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
||||||
Journal of Computational Physics, (2018).
|
Journal of Computational Physics, 372, 406-425, (2018).
|
||||||
|
|||||||
@ -73,4 +73,4 @@ instead of "array" is also valid.
|
|||||||
|
|
||||||
:link(Tranchida1)
|
:link(Tranchida1)
|
||||||
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
||||||
Journal of Computational Physics, (2018).
|
Journal of Computational Physics, 372, 406-425, (2018).
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
fix setforce command :h3
|
fix setforce command :h3
|
||||||
fix setforce/kk command :h3
|
fix setforce/kk command :h3
|
||||||
|
fix setforce/spin command :h3
|
||||||
|
|
||||||
[Syntax:]
|
[Syntax:]
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ keyword = {region} :l
|
|||||||
|
|
||||||
fix freeze indenter setforce 0.0 0.0 0.0
|
fix freeze indenter setforce 0.0 0.0 0.0
|
||||||
fix 2 edge setforce NULL 0.0 0.0
|
fix 2 edge setforce NULL 0.0 0.0
|
||||||
|
fix 1 edge setforce/spin 0.0 0.0 0.0
|
||||||
fix 2 edge setforce NULL 0.0 v_oscillate :pre
|
fix 2 edge setforce NULL 0.0 v_oscillate :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
@ -65,6 +67,19 @@ to it.
|
|||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
|
Style {spin} suffix sets the components of the magnetic precession
|
||||||
|
vectors instead of the mechanical forces. This also erases all
|
||||||
|
previously computed magnetic precession vectors on the atom, though
|
||||||
|
additional magnetic fixes could add new forces.
|
||||||
|
|
||||||
|
This command can be used to freeze the magnetic moment of certain
|
||||||
|
atoms in the simulation by zeroing their precession vector.
|
||||||
|
|
||||||
|
All options defined above remain valid, they just apply to the magnetic
|
||||||
|
precession vectors instead of the forces.
|
||||||
|
|
||||||
|
:line
|
||||||
|
|
||||||
Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are
|
Styles with a {gpu}, {intel}, {kk}, {omp}, or {opt} suffix are
|
||||||
functionally the same as the corresponding style without the suffix.
|
functionally the same as the corresponding style without the suffix.
|
||||||
They have been optimized to run faster, depending on your available
|
They have been optimized to run faster, depending on your available
|
||||||
@ -117,7 +132,10 @@ forces to any value besides zero when performing a minimization. Use
|
|||||||
the "fix addforce"_fix_addforce.html command if you want to apply a
|
the "fix addforce"_fix_addforce.html command if you want to apply a
|
||||||
non-zero force to atoms during a minimization.
|
non-zero force to atoms during a minimization.
|
||||||
|
|
||||||
[Restrictions:] none
|
[Restrictions:]
|
||||||
|
|
||||||
|
The fix {setforce/spin} only makes sense when LAMMPS was built with the
|
||||||
|
SPIN package.
|
||||||
|
|
||||||
[Related commands:]
|
[Related commands:]
|
||||||
|
|
||||||
|
|||||||
@ -88,4 +88,4 @@ package"_Build_package.html doc page for more info.
|
|||||||
Physical Review B, 88(18), 184422. (2013).
|
Physical Review B, 88(18), 184422. (2013).
|
||||||
:link(Tranchida5)
|
:link(Tranchida5)
|
||||||
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
||||||
Journal of Computational Physics, (2018).
|
Journal of Computational Physics, 372, 406-425, (2018).
|
||||||
|
|||||||
@ -95,4 +95,4 @@ package"_Build_package.html doc page for more info.
|
|||||||
|
|
||||||
:link(Tranchida3)
|
:link(Tranchida3)
|
||||||
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
||||||
Journal of Computational Physics, (2018).
|
Journal of Computational Physics, 372, 406-425, (2018).
|
||||||
|
|||||||
@ -70,4 +70,4 @@ package"_Build_package.html doc page for more info.
|
|||||||
|
|
||||||
:link(Tranchida4)
|
:link(Tranchida4)
|
||||||
[(Tranchida)] Tranchida, Plimpton, Thibaudeau, and Thompson,
|
[(Tranchida)] Tranchida, Plimpton, Thibaudeau, and Thompson,
|
||||||
Journal of Computational Physics, (2018).
|
Journal of Computational Physics, 372, 406-425, (2018).
|
||||||
|
|||||||
@ -80,4 +80,4 @@ package"_Build_package.html doc page for more info.
|
|||||||
|
|
||||||
:link(Tranchida6)
|
:link(Tranchida6)
|
||||||
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
[(Tranchida)] Tranchida, Plimpton, Thibaudeau and Thompson,
|
||||||
Journal of Computational Physics, (2018).
|
Journal of Computational Physics, 372, 406-425, (2018).
|
||||||
|
|||||||
59
examples/SPIN/setforce_spin/in.spinmin.setforce
Normal file
59
examples/SPIN/setforce_spin/in.spinmin.setforce
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
units metal
|
||||||
|
dimension 3
|
||||||
|
boundary f f f
|
||||||
|
atom_style spin
|
||||||
|
|
||||||
|
# necessary for the serial algorithm (sametag)
|
||||||
|
atom_modify map array
|
||||||
|
|
||||||
|
lattice sc 3.0
|
||||||
|
region box block 0.0 10.0 0.0 10.0 0.0 1.0
|
||||||
|
create_box 2 box
|
||||||
|
region reg1 block 0.0 10.0 0.0 5.0 0.0 1.0
|
||||||
|
region reg2 block 0.0 10.0 6.0 10.0 0.0 1.0
|
||||||
|
create_atoms 1 region reg1
|
||||||
|
create_atoms 2 region reg2
|
||||||
|
|
||||||
|
# setting mass, mag. moments, and interactions for bcc iron
|
||||||
|
|
||||||
|
mass 1 55.845
|
||||||
|
mass 2 55.845
|
||||||
|
set region reg1 spin 2.2 0.0 0.0 1.0
|
||||||
|
set region reg2 spin/random 31 2.2
|
||||||
|
|
||||||
|
group fixed_spin region reg1
|
||||||
|
|
||||||
|
pair_style hybrid/overlay spin/exchange 3.1 spin/dmi 3.1
|
||||||
|
pair_coeff * * spin/exchange exchange 3.1 -0.01593 0.06626915552 1.211
|
||||||
|
pair_coeff * * spin/dmi dmi 3.1 0.12e-03 0.0 0.0 1.0
|
||||||
|
|
||||||
|
neighbor 0.1 bin
|
||||||
|
neigh_modify every 10 check yes delay 20
|
||||||
|
|
||||||
|
fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0 anisotropy 5e-05 0.0 0.0 1.0
|
||||||
|
fix_modify 1 energy yes
|
||||||
|
fix 2 fixed_spin setforce/spin 0.0 0.0 0.0
|
||||||
|
fix 3 all langevin/spin 0.0 0.1 21
|
||||||
|
fix 4 all nve/spin lattice no
|
||||||
|
|
||||||
|
timestep 0.0001
|
||||||
|
|
||||||
|
compute out_mag all spin
|
||||||
|
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 1000
|
||||||
|
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 1000 dump.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3] c_outsp[5] c_outsp[6] c_outsp[7]
|
||||||
|
|
||||||
|
min_style spin
|
||||||
|
min_modify alpha_damp 1.0 discrete_factor 20.0
|
||||||
|
minimize 1.0e-16 1.0e-16 50000 1000
|
||||||
@ -475,8 +475,6 @@ void FixNVESpin::ComputeInteractionsSpin(int i)
|
|||||||
locksetforcespin->single_setforce_spin(i,fmi);
|
locksetforcespin->single_setforce_spin(i,fmi);
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("test after setforce: %g %g %g \n",fmi[0],fmi[1],fmi[2]);
|
|
||||||
|
|
||||||
// replace the magnetic force fm[i] by its new value fmi
|
// replace the magnetic force fm[i] by its new value fmi
|
||||||
|
|
||||||
fm[i][0] = fmi[0];
|
fm[i][0] = fmi[0];
|
||||||
|
|||||||
@ -128,8 +128,6 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3])
|
|||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
int nlocal = atom->nlocal;
|
int nlocal = atom->nlocal;
|
||||||
|
|
||||||
//printf("test inside before setforce: %g %g %g \n",fmi[0],fmi[1],fmi[2]);
|
|
||||||
|
|
||||||
// update region if necessary
|
// update region if necessary
|
||||||
|
|
||||||
Region *region = NULL;
|
Region *region = NULL;
|
||||||
@ -149,18 +147,17 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3])
|
|||||||
foriginal[0] = foriginal[1] = foriginal[2] = 0.0;
|
foriginal[0] = foriginal[1] = foriginal[2] = 0.0;
|
||||||
force_flag = 0;
|
force_flag = 0;
|
||||||
|
|
||||||
|
// constant force
|
||||||
|
|
||||||
if (varflag == CONSTANT) {
|
if (varflag == CONSTANT) {
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
//if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue;
|
if (region && !region->match(x[i][0],x[i][1],x[i][2])) return;
|
||||||
//if (region && region->match(x[i][0],x[i][1],x[i][2])){
|
|
||||||
foriginal[0] += fmi[0];
|
foriginal[0] += fmi[0];
|
||||||
foriginal[1] += fmi[1];
|
foriginal[1] += fmi[1];
|
||||||
foriginal[2] += fmi[2];
|
foriginal[2] += fmi[2];
|
||||||
if (xstyle) fmi[0] = xvalue;
|
if (xstyle) fmi[0] = xvalue;
|
||||||
if (ystyle) fmi[1] = yvalue;
|
if (ystyle) fmi[1] = yvalue;
|
||||||
if (zstyle) fmi[2] = zvalue;
|
if (zstyle) fmi[2] = zvalue;
|
||||||
//printf("test inside inter setforce: %g %g %g \n",fmi[0],fmi[1],fmi[2]);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// variable force, wrap with clear/add
|
// variable force, wrap with clear/add
|
||||||
@ -182,8 +179,7 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3])
|
|||||||
modify->addstep_compute(update->ntimestep + 1);
|
modify->addstep_compute(update->ntimestep + 1);
|
||||||
|
|
||||||
if (mask[i] & groupbit) {
|
if (mask[i] & groupbit) {
|
||||||
//if (region && !region->match(x[i][0],x[i][1],x[i][2])) continue;
|
if (region && !region->match(x[i][0],x[i][1],x[i][2])) return;
|
||||||
if (region && region->match(x[i][0],x[i][1],x[i][2])) {
|
|
||||||
foriginal[0] += fmi[0];
|
foriginal[0] += fmi[0];
|
||||||
foriginal[1] += fmi[1];
|
foriginal[1] += fmi[1];
|
||||||
foriginal[2] += fmi[2];
|
foriginal[2] += fmi[2];
|
||||||
@ -196,8 +192,6 @@ void FixSetForceSpin::single_setforce_spin(int i, double fmi[3])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//printf("test inside after setforce: %g %g %g \n",fmi[0],fmi[1],fmi[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user