Commit modifs before release 1 (03/26/18)

This commit is contained in:
julient31
2018-03-26 13:30:36 -06:00
parent 08bc115380
commit a315599bac
36 changed files with 6660 additions and 598 deletions

View File

@ -28,9 +28,9 @@ pair_coeff * * pair/spin/me me 4.5 0.000109 1.0 1.0 1.0
neighbor 0.1 bin neighbor 0.1 bin
neigh_modify every 10 check yes delay 20 neigh_modify every 10 check yes delay 20
fix 1 all force/spin anisotropy 0.0000033 0.0 0.0 1.0 fix 1 all precession/spin anisotropy 0.0000033 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.1 21 fix 2 all langevin/spin 0.0 0.1 21
fix 3 all integration/spin lattice no fix 3 all nve/spin lattice yes
timestep 0.0002 timestep 0.0002
@ -43,12 +43,12 @@ variable magz equal c_out_mag[3]
variable magnorm equal c_out_mag[4] variable magnorm equal c_out_mag[4]
variable emag equal c_out_mag[5] variable emag equal c_out_mag[5]
variable tmag equal c_out_mag[6] variable tmag equal c_out_mag[6]
variable mag_force equal f_1
thermo_style custom step time v_magnorm v_emag temp etotal thermo_style custom step time v_magnorm v_emag temp etotal
thermo 50 thermo 50
dump 1 all custom 50 dump_spin_BFO.lammpstrj type x y z spx spy spz compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 100 all custom 1 dump_bfo.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3]
run 5000 run 5000

View File

@ -15,7 +15,7 @@ region box block 0.0 5.0 0.0 5.0 0.0 5.0
create_box 1 box create_box 1 box
create_atoms 1 box create_atoms 1 box
# setting mass, mag. moments, and interactions for cobalt # setting mass, mag. moments, and interactions for fcc cobalt
mass 1 58.93 mass 1 58.93
@ -29,11 +29,10 @@ pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
neighbor 0.1 bin neighbor 0.1 bin
neigh_modify every 10 check yes delay 20 neigh_modify every 10 check yes delay 20
fix 1 all force/spin zeeman 0.0 0.0 0.0 1.0 fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.0 21 fix 2 all langevin/spin 0.0 0.0 21
fix 3 all integration/spin lattice yes fix 3 all nve/spin lattice yes
timestep 0.0001 timestep 0.0001
# compute and output options # compute and output options
@ -47,12 +46,12 @@ variable magz equal c_out_mag[3]
variable magnorm equal c_out_mag[4] variable magnorm equal c_out_mag[4]
variable emag equal c_out_mag[5] variable emag equal c_out_mag[5]
variable tmag equal c_out_mag[6] variable tmag equal c_out_mag[6]
variable mag_force equal f_1
thermo_style custom step time v_magnorm v_emag temp etotal thermo_style custom step time v_magnorm v_emag temp etotal
thermo 10 thermo 10
dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 100 all custom 1 dump_cobalt_fcc.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3]
run 10000 run 1000

View File

@ -1,4 +1,4 @@
# fcc cobalt in a 3d periodic box # hcp cobalt in a 3d periodic box
clear clear
units metal units metal
@ -10,13 +10,12 @@ boundary p p p
# necessary for the serial algorithm (sametag) # necessary for the serial algorithm (sametag)
atom_modify map array atom_modify map array
#lattice hcp 2.5071 2.5071 4.0695
lattice hcp 2.5071 lattice hcp 2.5071
region box block 0.0 5.0 0.0 5.0 0.0 5.0 region box block 0.0 5.0 0.0 5.0 0.0 5.0
create_box 1 box create_box 1 box
create_atoms 1 box create_atoms 1 box
# setting mass, mag. moments, and interactions for cobalt # setting mass, mag. moments, and interactions for hcp cobalt
mass 1 58.93 mass 1 58.93
@ -32,11 +31,10 @@ pair_coeff * * pair/spin/exchange exchange 4.0 0.3593 1.135028015e-05 1.06456856
neighbor 0.1 bin neighbor 0.1 bin
neigh_modify every 10 check yes delay 20 neigh_modify every 10 check yes delay 20
fix 1 all force/spin zeeman 0.01 0.0 0.0 1.0 fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.0 21 fix 2 all langevin/spin 0.0 0.0 21
fix 3 all integration/spin lattice yes fix 3 all nve/spin lattice yes
timestep 0.0001 timestep 0.0001
@ -49,12 +47,11 @@ variable magz equal c_out_mag[3]
variable magnorm equal c_out_mag[4] variable magnorm equal c_out_mag[4]
variable emag equal c_out_mag[5] variable emag equal c_out_mag[5]
variable tmag equal c_out_mag[6] variable tmag equal c_out_mag[6]
variable mag_force equal f_1
thermo_style custom step time v_magnorm v_emag temp etotal thermo_style custom step time v_magnorm v_emag temp etotal
thermo 10 thermo 10
dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 100 all custom 1 dump_cobalt_hcp.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3]
run 1000
run 20000

View File

@ -22,22 +22,20 @@ mass 1 55.845
set group all spin/random 31 2.2 set group all spin/random 31 2.2
velocity all create 100 4928459 rot yes dist gaussian velocity all create 100 4928459 rot yes dist gaussian
#pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair/spin/soc/neel 4.0
pair_style hybrid/overlay eam/alloy pair/spin/exchange 3.5 pair_style hybrid/overlay eam/alloy pair/spin/exchange 3.5
pair_coeff * * eam/alloy ../examples/SPIN/iron/Fe_Mishin2006.eam.alloy Fe pair_coeff * * eam/alloy ../examples/SPIN/iron/Fe_Mishin2006.eam.alloy Fe
pair_coeff * * pair/spin/exchange exchange 3.4 0.02726 0.2171 1.841 pair_coeff * * pair/spin/exchange exchange 3.4 0.02726 0.2171 1.841
#pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731
neighbor 0.1 bin neighbor 0.1 bin
neigh_modify every 10 check yes delay 20 neigh_modify every 10 check yes delay 20
fix 1 all force/spin zeeman 0.0 0.0 0.0 1.0 fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.0 21 fix 2 all langevin/spin 0.0 0.0 21
fix 3 all integration/spin lattice yes fix 3 all nve/spin lattice yes
timestep 0.0001 timestep 0.0001
# compute and output options
compute out_mag all compute/spin compute out_mag all compute/spin
compute out_pe all pe compute out_pe all pe
@ -48,12 +46,11 @@ variable magz equal c_out_mag[3]
variable magnorm equal c_out_mag[4] variable magnorm equal c_out_mag[4]
variable emag equal c_out_mag[5] variable emag equal c_out_mag[5]
variable tmag equal c_out_mag[6] variable tmag equal c_out_mag[6]
variable mag_force equal f_1
thermo_style custom step time v_magnorm v_tmag temp v_emag ke pe etotal thermo_style custom step time v_magnorm v_tmag temp v_emag ke pe etotal
thermo 50 thermo 50
dump 1 all custom 50 dump_iron.lammpstrj type x y z spx spy spz compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 100 all custom 1 dump_iron.lammpstrj type x y z c_outsp[1] c_outsp[2] c_outsp[3]
run 100000 run 100000

View File

@ -1,5 +1,5 @@
2.492 2.803 2.495 8.3
3.524 0.0816 3.524 -3.99
4.316 0.35 4.31 0.998
4.983 0.16 4.99 -0.955
5.572 0.0408 5.56 0.213

View File

@ -1,4 +1,4 @@
# fcc cobalt in a 3d periodic box # fcc nickel in a 3d periodic box
clear clear
units metal units metal
@ -19,25 +19,24 @@ create_atoms 1 box
mass 1 58.69 mass 1 58.69
set group all spin/random 31 0.6 set group all spin/random 31 0.63
#set group all spin 0.63 0.0 0.0 1.0
velocity all create 100 4928459 rot yes dist gaussian velocity all create 100 4928459 rot yes dist gaussian
#pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair/spin/soc/neel 4.0
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/nickel/Ni99.eam.alloy Ni pair_coeff * * eam/alloy ../examples/SPIN/nickel/Ni99.eam.alloy Ni
pair_coeff * * pair/spin/exchange exchange 4.0 0.009718152197 0.000153 1.243 pair_coeff * * pair/spin/exchange exchange 4.0 0.50 0.2280246862 1.229983475
#pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731
neighbor 0.1 bin neighbor 0.1 bin
neigh_modify every 10 check yes delay 20 neigh_modify every 10 check yes delay 20
fix 1 all force/spin zeeman 0.0 0.0 0.0 1.0 fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.0 21 fix 2 all langevin/spin 0.0 0.0 21
fix 3 all integration/spin lattice yes fix 3 all nve/spin lattice yes
timestep 0.0001 timestep 0.0001
# compute and output options
compute out_mag all compute/spin compute out_mag all compute/spin
compute out_pe all pe compute out_pe all pe
@ -48,12 +47,12 @@ variable magz equal c_out_mag[3]
variable magnorm equal c_out_mag[4] variable magnorm equal c_out_mag[4]
variable emag equal c_out_mag[5] variable emag equal c_out_mag[5]
variable tmag equal c_out_mag[6] variable tmag equal c_out_mag[6]
variable mag_force equal f_1
thermo_style custom step time v_magnorm v_emag temp etotal thermo_style custom step time v_magnorm v_emag temp v_tmag etotal
thermo 10 thermo 50
#dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 50 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]
run 1000 run 2000

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
# start a spin-lattice simulation from a data file # start a spin-lattice simulation from a data file
clear clear
units metal units metal
@ -12,6 +13,9 @@ atom_modify map array
read_data ../examples/SPIN/read_restart/Norm_randXY_8x8x32.data read_data ../examples/SPIN/read_restart/Norm_randXY_8x8x32.data
======= =======
=======
# start a spin-lattice simulation from a data file
>>>>>>> Commit modifs before release 1 (03/26/18)
clear clear
units metal units metal
dimension 3 dimension 3
@ -22,14 +26,17 @@ atom_style spin
# necessary for the serial algorithm (sametag) # necessary for the serial algorithm (sametag)
atom_modify map array atom_modify map array
read_data ../examples/SPIN/Norm_randXY_8x8x32_test.data <<<<<<< HEAD
>>>>>>> Commit before meeting 032218 >>>>>>> Commit before meeting 032218
=======
read_data ../examples/SPIN/read_restart/Norm_randXY_8x8x32.data
>>>>>>> Commit modifs before release 1 (03/26/18)
mass 1 58.93 mass 1 58.93
# define magneto-mechanical potentials and forces # define magneto-mechanical potentials and forces
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/read_restart/Co_PurjaPun_2012.eam.alloy Co pair_coeff * * eam/alloy ../examples/SPIN/read_restart/Co_PurjaPun_2012.eam.alloy Co
pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885 pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
@ -49,18 +56,27 @@ pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair/spin/soc/neel 4.
pair_coeff * * eam/alloy ../examples/SPIN/Co_PurjaPun_2012.eam.alloy Co pair_coeff * * eam/alloy ../examples/SPIN/Co_PurjaPun_2012.eam.alloy Co
pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885 pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731 pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731
=======
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/read_restart/Co_PurjaPun_2012.eam.alloy Co
pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
>>>>>>> Commit modifs before release 1 (03/26/18)
neighbor 1.0 bin neighbor 1.0 bin
neigh_modify every 1 check no delay 0 neigh_modify every 1 check no delay 0
fix 1 all force/spin zeeman 0.0 0.0 0.0 1.0 fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.0 21 fix 2 all langevin/spin 0.0 0.0 21
fix 3 all integration/spin serial fix 3 all nve/spin lattice yes
timestep 0.0001 timestep 0.0001
<<<<<<< HEAD
# define outputs # define outputs
>>>>>>> Commit before meeting 032218 >>>>>>> Commit before meeting 032218
=======
# define outputs and computes
>>>>>>> Commit modifs before release 1 (03/26/18)
compute out_mag all compute/spin compute out_mag all compute/spin
compute out_pe all pe compute out_pe all pe
@ -76,6 +92,7 @@ thermo 10
thermo_style custom step time v_magnorm v_emag v_tmag temp etotal thermo_style custom step time v_magnorm v_emag v_tmag temp etotal
thermo_modify format float %20.15g thermo_modify format float %20.15g
<<<<<<< HEAD
<<<<<<< HEAD <<<<<<< HEAD
compute outsp all property/atom spx spy spz sp fmx fmy fmz compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 100 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 100 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]
@ -86,4 +103,10 @@ dump 1 all custom 1 dump.lammpstrj type x y z spx spy spz
run 10000 run 10000
>>>>>>> Commit before meeting 032218 >>>>>>> Commit before meeting 032218
=======
compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 100 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]
run 100
>>>>>>> Commit modifs before release 1 (03/26/18)

View File

@ -1,3 +1,4 @@
# start a spin-lattice simulation from a data file
clear clear
units metal units metal
atom_style spin atom_style spin
@ -25,18 +26,18 @@ set group single_spin spin/random 11 1.72
velocity all create 200 4928459 rot yes dist gaussian velocity all create 200 4928459 rot yes dist gaussian
# define magneto-mechanical potentials and forces # define magneto-mechanical potentials and forces
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0 pair/spin/soc/neel 4.0
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/Co_PurjaPun_2012.eam.alloy Co pair_coeff * * eam/alloy ../examples/SPIN/Co_PurjaPun_2012.eam.alloy Co
pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885 pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
pair_coeff * * pair/spin/soc/neel neel 4.0 0.003330282 0.864159 2.13731
neighbor 1.0 bin neighbor 1.0 bin
neigh_modify every 1 check no delay 0 neigh_modify every 1 check no delay 0
fix 1 all force/spin zeeman 0.0 0.0 0.0 1.0 fix 1 all precession/spin zeeman 0.0 0.0 0.0 1.0
fix 2 all langevin/spin 0.0 0.0 0.0 21 fix 2 all langevin/spin 0.0 0.0 0.0 21
fix 3 all integration/spin serial fix 3 all nve/spin lattice yes
timestep 0.0001 timestep 0.0001
# define outputs # define outputs
@ -50,13 +51,13 @@ variable magz equal c_out_mag[4]
variable magnorm equal c_out_mag[5] variable magnorm equal c_out_mag[5]
variable emag equal c_out_mag[6] variable emag equal c_out_mag[6]
variable tmag equal c_out_mag[7] variable tmag equal c_out_mag[7]
variable mag_force equal f_1
thermo 10 thermo 10
thermo_style custom step time v_magnorm v_emag v_tmag temp etotal thermo_style custom step time v_magnorm v_emag v_tmag temp etotal
thermo_modify format float %20.15g thermo_modify format float %20.15g
dump 1 all custom 20 dump.lammpstrj type x y z spx spy spz compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 100 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]
run 1000 run 1000

View File

@ -0,0 +1,58 @@
# fcc cobalt in a 3d periodic box
clear
units metal
atom_style spin
dimension 3
boundary p p p
# necessary for the serial algorithm (sametag)
atom_modify map array
lattice fcc 3.54
region box block 0.0 5.0 0.0 5.0 0.0 5.0
create_box 1 box
create_atoms 1 box
# setting mass, mag. moments, and interactions for cobalt
mass 1 58.93
set group all spin/random 31 1.72
velocity all create 100 4928459 rot yes dist gaussian
pair_style hybrid/overlay eam/alloy pair/spin/exchange 4.0
pair_coeff * * eam/alloy ../examples/SPIN/cobalt_fcc/Co_PurjaPun_2012.eam.alloy Co
pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885
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
fix 2 all langevin/spin 0.0 0.0 21
fix 3 all nve/spin lattice yes
timestep 0.0001
# compute and output options
compute out_mag all compute/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_style custom step time v_magnorm v_emag temp etotal
thermo 10
compute outsp all property/atom spx spy spz sp fmx fmy fmz
dump 100 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]
run 10000
write_restart restart_fcc_cobalt.equil

View File

@ -1,4 +1,5 @@
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov Steve Plimpton, sjplimp@sandia.gov
@ -43,14 +44,13 @@ AtomVecSpin::AtomVecSpin(LAMMPS *lmp) : AtomVec(lmp)
size_forward = 7; size_forward = 7;
size_reverse = 6; size_reverse = 6;
size_border = 11; size_border = 10;
size_velocity = 3; size_velocity = 3;
size_data_atom = 9; size_data_atom = 9;
size_data_vel = 4; size_data_vel = 4;
xcol_data = 4; xcol_data = 4;
forceclearflag = 1; forceclearflag = 1;
atom->mumag_flag = 1;
atom->sp_flag = 1; atom->sp_flag = 1;
} }
@ -83,7 +83,6 @@ void AtomVecSpin::grow(int n)
// allocating mag. quantities // allocating mag. quantities
mumag = memory->grow(atom->mumag,nmax,"atom:mumag");
sp = memory->grow(atom->sp,nmax,4,"atom:sp"); sp = memory->grow(atom->sp,nmax,4,"atom:sp");
fm = memory->grow(atom->fm,nmax*comm->nthreads,3,"atom:fm"); fm = memory->grow(atom->fm,nmax*comm->nthreads,3,"atom:fm");
@ -101,7 +100,7 @@ void AtomVecSpin::grow_reset()
tag = atom->tag; type = atom->type; tag = atom->tag; type = atom->type;
mask = atom->mask; image = atom->image; mask = atom->mask; image = atom->image;
x = atom->x; v = atom->v; f = atom->f; x = atom->x; v = atom->v; f = atom->f;
mumag = atom->mumag; sp = atom->sp; fm = atom->fm; sp = atom->sp; fm = atom->fm;
} }
@ -122,7 +121,6 @@ void AtomVecSpin::copy(int i, int j, int delflag)
v[j][1] = v[i][1]; v[j][1] = v[i][1];
v[j][2] = v[i][2]; v[j][2] = v[i][2];
mumag[j] = mumag[i];
sp[j][0] = sp[i][0]; sp[j][0] = sp[i][0];
sp[j][1] = sp[i][1]; sp[j][1] = sp[i][1];
sp[j][2] = sp[i][2]; sp[j][2] = sp[i][2];
@ -381,7 +379,6 @@ int AtomVecSpin::pack_border(int n, int *list, double *buf,
buf[m++] = ubuf(tag[j]).d; buf[m++] = ubuf(tag[j]).d;
buf[m++] = ubuf(type[j]).d; buf[m++] = ubuf(type[j]).d;
buf[m++] = ubuf(mask[j]).d; buf[m++] = ubuf(mask[j]).d;
buf[m++] = mumag[j];
buf[m++] = sp[j][0]; buf[m++] = sp[j][0];
buf[m++] = sp[j][1]; buf[m++] = sp[j][1];
buf[m++] = sp[j][2]; buf[m++] = sp[j][2];
@ -405,7 +402,6 @@ int AtomVecSpin::pack_border(int n, int *list, double *buf,
buf[m++] = ubuf(tag[j]).d; buf[m++] = ubuf(tag[j]).d;
buf[m++] = ubuf(type[j]).d; buf[m++] = ubuf(type[j]).d;
buf[m++] = ubuf(mask[j]).d; buf[m++] = ubuf(mask[j]).d;
buf[m++] = mumag[j];
buf[m++] = sp[j][0]; buf[m++] = sp[j][0];
buf[m++] = sp[j][1]; buf[m++] = sp[j][1];
buf[m++] = sp[j][2]; buf[m++] = sp[j][2];
@ -438,7 +434,6 @@ int AtomVecSpin::pack_border_vel(int n, int *list, double *buf,
buf[m++] = ubuf(tag[j]).d; buf[m++] = ubuf(tag[j]).d;
buf[m++] = ubuf(type[j]).d; buf[m++] = ubuf(type[j]).d;
buf[m++] = ubuf(mask[j]).d; buf[m++] = ubuf(mask[j]).d;
buf[m++] = mumag[j];
buf[m++] = sp[j][0]; buf[m++] = sp[j][0];
buf[m++] = sp[j][1]; buf[m++] = sp[j][1];
buf[m++] = sp[j][2]; buf[m++] = sp[j][2];
@ -466,7 +461,6 @@ int AtomVecSpin::pack_border_vel(int n, int *list, double *buf,
buf[m++] = ubuf(tag[j]).d; buf[m++] = ubuf(tag[j]).d;
buf[m++] = ubuf(type[j]).d; buf[m++] = ubuf(type[j]).d;
buf[m++] = ubuf(mask[j]).d; buf[m++] = ubuf(mask[j]).d;
buf[m++] = mumag[j];
buf[m++] = sp[j][0]; buf[m++] = sp[j][0];
buf[m++] = sp[j][1]; buf[m++] = sp[j][1];
buf[m++] = sp[j][2]; buf[m++] = sp[j][2];
@ -487,7 +481,6 @@ int AtomVecSpin::pack_border_vel(int n, int *list, double *buf,
buf[m++] = ubuf(tag[j]).d; buf[m++] = ubuf(tag[j]).d;
buf[m++] = ubuf(type[j]).d; buf[m++] = ubuf(type[j]).d;
buf[m++] = ubuf(mask[j]).d; buf[m++] = ubuf(mask[j]).d;
buf[m++] = mumag[j];
buf[m++] = sp[j][0]; buf[m++] = sp[j][0];
buf[m++] = sp[j][1]; buf[m++] = sp[j][1];
buf[m++] = sp[j][2]; buf[m++] = sp[j][2];
@ -521,7 +514,6 @@ int AtomVecSpin::pack_border_hybrid(int n, int *list, double *buf)
m = 0; m = 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
j = list[i]; j = list[i];
buf[m++] = mumag[j];
buf[m++] = sp[j][0]; buf[m++] = sp[j][0];
buf[m++] = sp[j][1]; buf[m++] = sp[j][1];
buf[m++] = sp[j][2]; buf[m++] = sp[j][2];
@ -547,7 +539,6 @@ void AtomVecSpin::unpack_border(int n, int first, double *buf)
tag[i] = (tagint) ubuf(buf[m++]).i; tag[i] = (tagint) ubuf(buf[m++]).i;
type[i] = (int) ubuf(buf[m++]).i; type[i] = (int) ubuf(buf[m++]).i;
mask[i] = (int) ubuf(buf[m++]).i; mask[i] = (int) ubuf(buf[m++]).i;
mumag[i] = buf[m++];
sp[i][0] = buf[m++]; sp[i][0] = buf[m++];
sp[i][1] = buf[m++]; sp[i][1] = buf[m++];
sp[i][2] = buf[m++]; sp[i][2] = buf[m++];
@ -577,7 +568,6 @@ void AtomVecSpin::unpack_border_vel(int n, int first, double *buf)
tag[i] = (tagint) ubuf(buf[m++]).i; tag[i] = (tagint) ubuf(buf[m++]).i;
type[i] = (int) ubuf(buf[m++]).i; type[i] = (int) ubuf(buf[m++]).i;
mask[i] = (int) ubuf(buf[m++]).i; mask[i] = (int) ubuf(buf[m++]).i;
mumag[i] = buf[m++];
sp[i][0] = buf[m++]; sp[i][0] = buf[m++];
sp[i][1] = buf[m++]; sp[i][1] = buf[m++];
sp[i][2] = buf[m++]; sp[i][2] = buf[m++];
@ -603,7 +593,6 @@ int AtomVecSpin::unpack_border_hybrid(int n, int first, double *buf)
m = 0; m = 0;
last = first + n; last = first + n;
for (i = first; i < last; i++) { for (i = first; i < last; i++) {
mumag[i] = buf[m++];
sp[i][0] = buf[m++]; sp[i][0] = buf[m++];
sp[i][1] = buf[m++]; sp[i][1] = buf[m++];
sp[i][2] = buf[m++]; sp[i][2] = buf[m++];
@ -632,7 +621,6 @@ int AtomVecSpin::pack_exchange(int i, double *buf)
buf[m++] = ubuf(mask[i]).d; buf[m++] = ubuf(mask[i]).d;
buf[m++] = ubuf(image[i]).d; buf[m++] = ubuf(image[i]).d;
buf[m++] = mumag[i];
buf[m++] = sp[i][0]; buf[m++] = sp[i][0];
buf[m++] = sp[i][1]; buf[m++] = sp[i][1];
buf[m++] = sp[i][2]; buf[m++] = sp[i][2];
@ -665,7 +653,6 @@ int AtomVecSpin::unpack_exchange(double *buf)
mask[nlocal] = (int) ubuf(buf[m++]).i; mask[nlocal] = (int) ubuf(buf[m++]).i;
image[nlocal] = (imageint) ubuf(buf[m++]).i; image[nlocal] = (imageint) ubuf(buf[m++]).i;
mumag[nlocal] = buf[m++];
sp[nlocal][0] = buf[m++]; sp[nlocal][0] = buf[m++];
sp[nlocal][1] = buf[m++]; sp[nlocal][1] = buf[m++];
sp[nlocal][2] = buf[m++]; sp[nlocal][2] = buf[m++];
@ -722,7 +709,6 @@ int AtomVecSpin::pack_restart(int i, double *buf)
buf[m++] = v[i][1]; buf[m++] = v[i][1];
buf[m++] = v[i][2]; buf[m++] = v[i][2];
buf[m++] = mumag[i];
buf[m++] = sp[i][0]; buf[m++] = sp[i][0];
buf[m++] = sp[i][1]; buf[m++] = sp[i][1];
buf[m++] = sp[i][2]; buf[m++] = sp[i][2];
@ -761,7 +747,6 @@ int AtomVecSpin::unpack_restart(double *buf)
v[nlocal][1] = buf[m++]; v[nlocal][1] = buf[m++];
v[nlocal][2] = buf[m++]; v[nlocal][2] = buf[m++];
mumag[nlocal] = buf[m++];
sp[nlocal][0] = buf[m++]; sp[nlocal][0] = buf[m++];
sp[nlocal][1] = buf[m++]; sp[nlocal][1] = buf[m++];
sp[nlocal][2] = buf[m++]; sp[nlocal][2] = buf[m++];
@ -800,7 +785,6 @@ void AtomVecSpin::create_atom(int itype, double *coord)
v[nlocal][1] = 0.0; v[nlocal][1] = 0.0;
v[nlocal][2] = 0.0; v[nlocal][2] = 0.0;
mumag[nlocal] = 0.0;
sp[nlocal][0] = 0.0; sp[nlocal][0] = 0.0;
sp[nlocal][1] = 0.0; sp[nlocal][1] = 0.0;
sp[nlocal][2] = 0.0; sp[nlocal][2] = 0.0;
@ -824,18 +808,20 @@ void AtomVecSpin::data_atom(double *coord, imageint imagetmp, char **values)
if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes) if (type[nlocal] <= 0 || type[nlocal] > atom->ntypes)
error->one(FLERR,"Invalid atom type in Atoms section of data file"); error->one(FLERR,"Invalid atom type in Atoms section of data file");
mumag[nlocal] = atof(values[2]);
x[nlocal][0] = coord[0]; x[nlocal][0] = coord[0];
x[nlocal][1] = coord[1]; x[nlocal][1] = coord[1];
x[nlocal][2] = coord[2]; x[nlocal][2] = coord[2];
sp[nlocal][0] = atof(values[6]); sp[nlocal][3] = atof(values[2]);
sp[nlocal][1] = atof(values[7]); sp[nlocal][0] = atof(values[5]);
sp[nlocal][2] = atof(values[8]); sp[nlocal][1] = atof(values[6]);
sp[nlocal][3] = sqrt(sp[nlocal][0]*sp[nlocal][0] + sp[nlocal][2] = atof(values[7]);
double inorm = 1.0/sqrt(sp[nlocal][0]*sp[nlocal][0] +
sp[nlocal][1]*sp[nlocal][1] + sp[nlocal][1]*sp[nlocal][1] +
sp[nlocal][2]*sp[nlocal][2]); sp[nlocal][2]*sp[nlocal][2]);
sp[nlocal][0] *= inorm;
sp[nlocal][1] *= inorm;
sp[nlocal][2] *= inorm;
image[nlocal] = imagetmp; image[nlocal] = imagetmp;
@ -854,13 +840,17 @@ void AtomVecSpin::data_atom(double *coord, imageint imagetmp, char **values)
int AtomVecSpin::data_atom_hybrid(int nlocal, char **values) int AtomVecSpin::data_atom_hybrid(int nlocal, char **values)
{ {
mumag[nlocal] = atof(values[0]);
sp[nlocal][0] = atof(values[1]); sp[nlocal][0] = atof(values[0]);
sp[nlocal][1] = atof(values[2]); sp[nlocal][1] = atof(values[1]);
sp[nlocal][2] = atof(values[3]); sp[nlocal][2] = atof(values[2]);
sp[nlocal][3] = sqrt(sp[nlocal][0]*sp[nlocal][0] + double inorm = 1.0/sqrt(sp[nlocal][0]*sp[nlocal][0] +
sp[nlocal][1]*sp[nlocal][1] + sp[nlocal][1]*sp[nlocal][1] +
sp[nlocal][2]*sp[nlocal][2]); sp[nlocal][2]*sp[nlocal][2]);
sp[nlocal][0] *= inorm;
sp[nlocal][1] *= inorm;
sp[nlocal][2] *= inorm;
sp[nlocal][3] = atof(values[3]);
return 4; return 4;
} }
@ -875,17 +865,16 @@ void AtomVecSpin::pack_data(double **buf)
for (int i = 0; i < nlocal; i++) { for (int i = 0; i < nlocal; i++) {
buf[i][0] = ubuf(tag[i]).d; buf[i][0] = ubuf(tag[i]).d;
buf[i][1] = ubuf(type[i]).d; buf[i][1] = ubuf(type[i]).d;
buf[i][2] = mumag[i]; buf[i][2] = sp[i][3];
buf[i][3] = x[i][0]; buf[i][3] = x[i][0];
buf[i][4] = x[i][1]; buf[i][4] = x[i][1];
buf[i][5] = x[i][2]; buf[i][5] = x[i][2];
buf[i][6] = sp[i][0]; buf[i][6] = sp[i][0];
buf[i][7] = sp[i][1]; buf[i][7] = sp[i][1];
buf[i][8] = sp[i][2]; buf[i][8] = sp[i][2];
buf[i][9] = sp[i][3]; buf[i][9] = ubuf((image[i] & IMGMASK) - IMGMAX).d;
buf[i][10] = ubuf((image[i] & IMGMASK) - IMGMAX).d; buf[i][10] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d;
buf[i][11] = ubuf((image[i] >> IMGBITS & IMGMASK) - IMGMAX).d; buf[i][11] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d;
buf[i][12] = ubuf((image[i] >> IMG2BITS) - IMGMAX).d;
} }
} }
@ -895,13 +884,13 @@ void AtomVecSpin::pack_data(double **buf)
int AtomVecSpin::pack_data_hybrid(int i, double *buf) int AtomVecSpin::pack_data_hybrid(int i, double *buf)
{ {
buf[0] = mumag[i];
buf[1] = sp[i][0];
buf[2] = sp[i][1];
buf[3] = sp[i][2];
buf[4] = sp[i][3];
return 5; buf[0] = sp[i][0];
buf[1] = sp[i][1];
buf[2] = sp[i][2];
buf[3] = sp[i][3];
return 4;
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -947,7 +936,6 @@ bigint AtomVecSpin::memory_usage()
if (atom->memcheck("v")) bytes += memory->usage(v,nmax,3); if (atom->memcheck("v")) bytes += memory->usage(v,nmax,3);
if (atom->memcheck("f")) bytes += memory->usage(f,nmax*comm->nthreads,3); if (atom->memcheck("f")) bytes += memory->usage(f,nmax*comm->nthreads,3);
if (atom->memcheck("mumag")) bytes += memory->usage(mumag,nmax);
if (atom->memcheck("sp")) bytes += memory->usage(sp,nmax,4); if (atom->memcheck("sp")) bytes += memory->usage(sp,nmax,4);
if (atom->memcheck("fm")) bytes += memory->usage(fm,nmax*comm->nthreads,3); if (atom->memcheck("fm")) bytes += memory->usage(fm,nmax*comm->nthreads,3);

View File

@ -68,7 +68,9 @@ class AtomVecSpin : public AtomVec {
int *type,*mask; int *type,*mask;
imageint *image; imageint *image;
double **x,**v,**f; // lattice quantities double **x,**v,**f; // lattice quantities
double *mumag,**sp,**fm; // spin quantities double **sp,**fm; // spin quantities
// sp[i][0-2] direction of the spin i
// sp[i][3] atomic magnetic moment of the spin i
}; };

View File

@ -91,7 +91,6 @@ void ComputeSpin::compute_vector()
int *mask = atom->mask; int *mask = atom->mask;
int *type = atom->type; int *type = atom->type;
imageint *image = atom->image; imageint *image = atom->image;
double *mumag = atom->mumag;
double **sp = atom->sp; double **sp = atom->sp;
double **fm = atom->fm; double **fm = atom->fm;
double tx,ty,tz; double tx,ty,tz;
@ -103,7 +102,7 @@ void ComputeSpin::compute_vector()
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) { if (mask[i] & groupbit) {
if (atom->mumag_flag && atom->sp_flag) { if (atom->sp_flag) {
mag[0] += sp[i][0]; mag[0] += sp[i][0];
mag[1] += sp[i][1]; mag[1] += sp[i][1];
mag[2] += sp[i][2]; mag[2] += sp[i][2];
@ -116,7 +115,7 @@ void ComputeSpin::compute_vector()
countsp++; countsp++;
} }
} }
else error->all(FLERR,"Compute spin/compute declared magnetic quantities (sp and mumag flags)"); else error->all(FLERR,"Compute compute/spin requires atom/spin style");
} }
MPI_Allreduce(mag,magtot,4,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(mag,magtot,4,MPI_DOUBLE,MPI_SUM,world);

View File

@ -116,10 +116,10 @@ void FixLangevinSpin::init()
int flag_force = 0; int flag_force = 0;
int flag_lang = 0; int flag_lang = 0;
for (int i = 0; i < modify->nfix; i++) { for (int i = 0; i < modify->nfix; i++) {
if (strcmp("force/spin",modify->fix[i]->style)==0) flag_force = MAX(flag_force,i); if (strcmp("precession/spin",modify->fix[i]->style)==0) flag_force = MAX(flag_force,i);
if (strcmp("langevin/spin",modify->fix[i]->style)==0) flag_lang = i; if (strcmp("langevin/spin",modify->fix[i]->style)==0) flag_lang = i;
} }
if (flag_force >= flag_lang) error->all(FLERR,"Fix langevin/spin should come after all other spin fixes"); if (flag_force >= flag_lang) error->all(FLERR,"Fix langevin/spin has to come after all other spin fixes");
memory->create(spi,3,"langevin:spi"); memory->create(spi,3,"langevin:spi");
memory->create(fmi,3,"langevin:fmi"); memory->create(fmi,3,"langevin:fmi");

View File

@ -31,7 +31,6 @@ class FixLangevinSpin : public Fix {
int setmask(); int setmask();
void init(); void init();
void setup(int); void setup(int);
// virtual void post_force(int);
void post_force_respa(int, int, int); void post_force_respa(int, int, int);
void add_tdamping(double spi[3], double fmi[3]); // add transverse damping void add_tdamping(double spi[3], double fmi[3]); // add transverse damping
void add_temperature(double fmi[3]); // add temperature void add_temperature(double fmi[3]); // add temperature

View File

@ -23,8 +23,8 @@
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
#include "error.h" #include "error.h"
#include "fix_force_spin.h" #include "fix_precession_spin.h"
#include "fix_integration_spin.h" #include "fix_nve_spin.h"
#include "fix_langevin_spin.h" #include "fix_langevin_spin.h"
#include "force.h" #include "force.h"
#include "math_vector.h" #include "math_vector.h"
@ -48,63 +48,69 @@ using namespace FixConst;
using namespace MathConst; using namespace MathConst;
using namespace MathExtra; using namespace MathExtra;
enum{NONE,SPIN}; enum{NONE};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) : FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg), Fix(lmp, narg, arg),
rsec(NULL), stack_head(NULL), stack_foot(NULL), rsec(NULL), stack_head(NULL), stack_foot(NULL),
backward_stacks(NULL), forward_stacks(NULL), backward_stacks(NULL), forward_stacks(NULL),
lockpairspinexchange(NULL), lockpairspinsocneel(NULL), lockforcespin(NULL), lockpairspinexchange(NULL), lockpairspinsocneel(NULL), lockprecessionspin(NULL),
locklangevinspin(NULL) locklangevinspin(NULL)
{ {
if (narg < 4) error->all(FLERR,"Illegal fix/integration/spin command"); if (narg < 4) error->all(FLERR,"Illegal fix/NVE/spin command");
time_integrate = 1; time_integrate = 1;
extra = NONE; sector_flag = NONE;
mpi_flag = NONE;
mech_flag = 1; mech_flag = 1;
if (strcmp(arg[2],"integration/spin") == 0) { // checking if map array or hash is defined
extra = SPIN;
} else error->all(FLERR,"Illegal fix integration/spin command");
// defining mpi_flag if (atom->map_style == 0)
error->all(FLERR,"Fix NVE/spin requires an atom map, see atom_modify");
// defining sector_flag
int nprocs_tmp = comm->nprocs; int nprocs_tmp = comm->nprocs;
if (nprocs_tmp == 1) { if (nprocs_tmp == 1) {
mpi_flag = 0; sector_flag = 0;
} else if (nprocs_tmp >= 1) { } else if (nprocs_tmp >= 1) {
mpi_flag = 1; sector_flag = 1;
} else error->all(FLERR,"Illegal fix/integration/spin command"); } else error->all(FLERR,"Illegal fix/NVE/spin command");
// defining mech_flag // defining mech_flag
int iarg = 3; int iarg = 3;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"lattice") == 0) { if (strcmp(arg[iarg],"lattice") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix/integration/spin command"); if (iarg+2 > narg) error->all(FLERR,"Illegal fix/NVE/spin command");
if (strcmp(arg[iarg+1],"no") == 0) mech_flag = 0; if (strcmp(arg[iarg+1],"no") == 0) mech_flag = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) mech_flag = 1; else if (strcmp(arg[iarg+1],"yes") == 0) mech_flag = 1;
else error->all(FLERR,"Illegal fix/integration/spin command"); else error->all(FLERR,"Illegal fix/NVE/spin command");
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix/integration/spin command"); } else error->all(FLERR,"Illegal fix/NVE/spin command");
} }
if (extra == SPIN && !atom->mumag_flag) // check if the atom/spin style is defined
error->all(FLERR,"Fix integration/spin requires spin attribute mumag");
if (mpi_flag == 0 && nprocs_tmp > 1) if (!atom->sp_flag)
error->all(FLERR,"Illegal fix/integration/spin command"); error->all(FLERR,"Fix NVE/spin requires atom/spin style");
// check if sector_flag is correctly defined
if (sector_flag == 0 && nprocs_tmp > 1)
error->all(FLERR,"Illegal fix/NVE/spin command");
// initialize the magnetic interaction flags
magpair_flag = 0; magpair_flag = 0;
exch_flag = 0; exch_flag = 0;
soc_neel_flag = soc_dmi_flag = 0; soc_neel_flag = soc_dmi_flag = 0;
me_flag = 0; me_flag = 0;
magforce_flag = 0; magprecession_flag = 0;
zeeman_flag = aniso_flag = 0; zeeman_flag = aniso_flag = 0;
maglangevin_flag = 0; maglangevin_flag = 0;
tdamp_flag = temp_flag = 0; tdamp_flag = temp_flag = 0;
@ -113,7 +119,7 @@ FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) :
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixIntegrationSpin::~FixIntegrationSpin() FixNVESpin::~FixNVESpin()
{ {
memory->destroy(rsec); memory->destroy(rsec);
memory->destroy(stack_head); memory->destroy(stack_head);
@ -124,7 +130,7 @@ FixIntegrationSpin::~FixIntegrationSpin()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int FixIntegrationSpin::setmask() int FixNVESpin::setmask()
{ {
int mask = 0; int mask = 0;
mask |= INITIAL_INTEGRATE; mask |= INITIAL_INTEGRATE;
@ -135,7 +141,7 @@ int FixIntegrationSpin::setmask()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixIntegrationSpin::init() void FixNVESpin::init()
{ {
// set timesteps // set timesteps
@ -177,15 +183,15 @@ void FixIntegrationSpin::init()
lockpairspinme = (PairSpinMe *) lockhybrid->styles[ipair]; lockpairspinme = (PairSpinMe *) lockhybrid->styles[ipair];
} }
} }
} else error->all(FLERR,"Illegal fix integration/spin command"); } else error->all(FLERR,"Illegal fix NVE/spin command");
// check errors, and handle simple hybrid (not overlay), and no pair/spin interaction // check errors, and handle simple hybrid (not overlay), and no pair/spin interaction
int iforce; int iforce;
for (iforce = 0; iforce < modify->nfix; iforce++) { for (iforce = 0; iforce < modify->nfix; iforce++) {
if (strstr(modify->fix[iforce]->style,"force/spin")) { if (strstr(modify->fix[iforce]->style,"precession/spin")) {
magforce_flag = 1; magprecession_flag = 1;
lockforcespin = (FixForceSpin *) modify->fix[iforce]; lockprecessionspin = (FixPrecessionSpin *) modify->fix[iforce];
} }
} }
@ -196,9 +202,9 @@ void FixIntegrationSpin::init()
} }
} }
if (magforce_flag) { if (magprecession_flag) {
if (lockforcespin->zeeman_flag == 1) zeeman_flag = 1; if (lockprecessionspin->zeeman_flag == 1) zeeman_flag = 1;
if (lockforcespin->aniso_flag == 1) aniso_flag = 1; if (lockprecessionspin->aniso_flag == 1) aniso_flag = 1;
} }
if (maglangevin_flag) { if (maglangevin_flag) {
@ -207,24 +213,24 @@ void FixIntegrationSpin::init()
} }
nsectors = 0; nsectors = 0;
memory->create(rsec,3,"integration/spin:rsec"); memory->create(rsec,3,"NVE/spin:rsec");
// perform the sectoring if mpi integration // perform the sectoring operation
if (mpi_flag) sectoring(); if (sector_flag) sectoring();
// grow tables of stacking variables (mpi) // init. size tables of stacking variables (sectoring)
stack_head = memory->grow(stack_head,nsectors,"integration/spin:stack_head"); stack_head = memory->grow(stack_head,nsectors,"NVE/spin:stack_head");
stack_foot = memory->grow(stack_foot,nsectors,"integration/spin:stack_foot"); stack_foot = memory->grow(stack_foot,nsectors,"NVE/spin:stack_foot");
forward_stacks = memory->grow(forward_stacks,atom->nmax,"integration/spin:forward_stacks"); forward_stacks = memory->grow(forward_stacks,atom->nmax,"NVE/spin:forward_stacks");
backward_stacks = memory->grow(backward_stacks,atom->nmax,"integration/spin:backward_stacks"); backward_stacks = memory->grow(backward_stacks,atom->nmax,"NVE/spin:backward_stacks");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixIntegrationSpin::initial_integrate(int vflag) void FixNVESpin::initial_integrate(int vflag)
{ {
double dtfm,msq,scale,fm2,fmsq,sp2,spsq,energy; double dtfm,msq,scale,fm2,fmsq,sp2,spsq,energy;
double spi[3], fmi[3]; double spi[3], fmi[3];
@ -257,14 +263,13 @@ void FixIntegrationSpin::initial_integrate(int vflag)
// update half s for all atoms // update half s for all atoms
if (extra == SPIN) { if (sector_flag) { // sectoring seq. update
if (mpi_flag) { // mpi seq. update
for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal
comm->forward_comm(); comm->forward_comm();
int i = stack_foot[j]; int i = stack_foot[j];
while (i >= 0) { while (i >= 0) {
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i,dts); AdvanceSingleSpin(i);
i = forward_stacks[i]; i = forward_stacks[i];
} }
} }
@ -273,24 +278,21 @@ void FixIntegrationSpin::initial_integrate(int vflag)
int i = stack_head[j]; int i = stack_head[j];
while (i >= 0) { while (i >= 0) {
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i,dts); AdvanceSingleSpin(i);
i = backward_stacks[i]; i = backward_stacks[i];
} }
} }
} else if (mpi_flag == 0) { // serial seq. update } else if (sector_flag == 0) { // serial seq. update
comm->forward_comm(); // comm. positions of ghost atoms comm->forward_comm(); // comm. positions of ghost atoms
for (int i = 0; i < nlocal-1; i++){ // advance quarter s for nlocal-1 for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i,dts); AdvanceSingleSpin(i);
} }
ComputeInteractionsSpin(nlocal-1); for (int i = nlocal-1; i >= 0; i--){ // advance quarter s for nlocal
AdvanceSingleSpin(nlocal-1,2.0*dts); // advance half s for 1
for (int i = nlocal-2; i >= 0; i--){ // advance quarter s for nlocal-1
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i,dts); AdvanceSingleSpin(i);
}
} else error->all(FLERR,"Illegal fix integration/spin command");
} }
} else error->all(FLERR,"Illegal fix NVE/spin command");
// update x for all particles // update x for all particles
@ -306,14 +308,13 @@ void FixIntegrationSpin::initial_integrate(int vflag)
// update half s for all particles // update half s for all particles
if (extra == SPIN) { if (sector_flag) { // sectoring seq. update
if (mpi_flag) { // mpi seq. update
for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal
comm->forward_comm(); comm->forward_comm();
int i = stack_foot[j]; int i = stack_foot[j];
while (i >= 0) { while (i >= 0) {
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i,dts); AdvanceSingleSpin(i);
i = forward_stacks[i]; i = forward_stacks[i];
} }
} }
@ -322,24 +323,21 @@ void FixIntegrationSpin::initial_integrate(int vflag)
int i = stack_head[j]; int i = stack_head[j];
while (i >= 0) { while (i >= 0) {
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i,dts); AdvanceSingleSpin(i);
i = backward_stacks[i]; i = backward_stacks[i];
} }
} }
} else if (mpi_flag == 0) { // serial seq. update } else if (sector_flag == 0) { // serial seq. update
comm->forward_comm(); // comm. positions of ghost atoms comm->forward_comm(); // comm. positions of ghost atoms
for (int i = 0; i < nlocal-1; i++){ // advance quarter s for nlocal-1 for (int i = 0; i < nlocal; i++){ // advance quarter s for nlocal-1
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i,dts); AdvanceSingleSpin(i);
} }
ComputeInteractionsSpin(nlocal-1);
AdvanceSingleSpin(nlocal-1,2.0*dts); // advance half s for 1
for (int i = nlocal-2; i >= 0; i--){ // advance quarter s for nlocal-1 for (int i = nlocal-2; i >= 0; i--){ // advance quarter s for nlocal-1
ComputeInteractionsSpin(i); ComputeInteractionsSpin(i);
AdvanceSingleSpin(i,dts); AdvanceSingleSpin(i);
}
} else error->all(FLERR,"Illegal fix integration/spin command");
} }
} else error->all(FLERR,"Illegal fix NVE/spin command");
} }
@ -347,16 +345,16 @@ void FixIntegrationSpin::initial_integrate(int vflag)
setup pre_neighbor() setup pre_neighbor()
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void FixIntegrationSpin::setup_pre_neighbor() void FixNVESpin::setup_pre_neighbor()
{ {
pre_neighbor(); pre_neighbor();
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
store in two linked lists the advance order of the spins (mpi) store in two linked lists the advance order of the spins (sectoring)
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void FixIntegrationSpin::pre_neighbor() void FixNVESpin::pre_neighbor()
{ {
double **x = atom->x; double **x = atom->x;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
@ -387,10 +385,10 @@ void FixIntegrationSpin::pre_neighbor()
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
compute the magnetic force for the spin ii compute the magnetic torque for the spin ii
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void FixIntegrationSpin::ComputeInteractionsSpin(int ii) void FixNVESpin::ComputeInteractionsSpin(int ii)
{ {
const int nlocal = atom->nlocal; const int nlocal = atom->nlocal;
double xi[3], rij[3], eij[3]; double xi[3], rij[3], eij[3];
@ -480,9 +478,6 @@ void FixIntegrationSpin::ComputeInteractionsSpin(int ii)
temp_cut = lockpairspinsocdmi->cut_soc_dmi[itype][jtype]; temp_cut = lockpairspinsocdmi->cut_soc_dmi[itype][jtype];
cut_2 = temp_cut*temp_cut; cut_2 = temp_cut*temp_cut;
if (rsq <= cut_2) { if (rsq <= cut_2) {
eij[0] = rij[0]*inorm;
eij[1] = rij[1]*inorm;
eij[2] = rij[2]*inorm;
lockpairspinsocdmi->compute_soc_dmi(i,j,fmi,spi,spj); lockpairspinsocdmi->compute_soc_dmi(i,j,fmi,spi,spj);
} }
} }
@ -500,12 +495,12 @@ void FixIntegrationSpin::ComputeInteractionsSpin(int ii)
} }
if (magforce_flag) { // mag. forces if (magprecession_flag) { // magnetic precession
if (zeeman_flag) { // zeeman if (zeeman_flag) { // zeeman
lockforcespin->compute_zeeman(i,fmi); lockprecessionspin->compute_zeeman(i,fmi);
} }
if (aniso_flag) { // aniso if (aniso_flag) { // aniso
lockforcespin->compute_anisotropy(i,spi,fmi); lockprecessionspin->compute_anisotropy(i,spi,fmi);
} }
} }
@ -530,7 +525,7 @@ void FixIntegrationSpin::ComputeInteractionsSpin(int ii)
divide each domain into sectors divide each domain into sectors
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void FixIntegrationSpin::sectoring() void FixNVESpin::sectoring()
{ {
int sec[3]; int sec[3];
double sublo[3],subhi[3]; double sublo[3],subhi[3];
@ -560,7 +555,7 @@ void FixIntegrationSpin::sectoring()
nsectors = sec[0]*sec[1]*sec[2]; nsectors = sec[0]*sec[1]*sec[2];
if (mpi_flag == 1 && nsectors != 8) if (sector_flag == 1 && nsectors != 8)
error->all(FLERR,"Illegal sectoring operation"); error->all(FLERR,"Illegal sectoring operation");
rsec[0] = rsx; rsec[0] = rsx;
@ -576,7 +571,7 @@ void FixIntegrationSpin::sectoring()
define sector for an atom at a position x[i] define sector for an atom at a position x[i]
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
int FixIntegrationSpin::coords2sector(double *x) int FixNVESpin::coords2sector(double *x)
{ {
int nseci; int nseci;
int seci[3]; int seci[3];
@ -596,10 +591,10 @@ int FixIntegrationSpin::coords2sector(double *x)
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
advance the spin i of a timestep dtl advance the spin i of a timestep dts
---------------------------------------------------------------------- */ ---------------------------------------------------------------------- */
void FixIntegrationSpin::AdvanceSingleSpin(int i, double dtl) void FixNVESpin::AdvanceSingleSpin(int i)
{ {
int j=0; int j=0;
int *sametag = atom->sametag; int *sametag = atom->sametag;
@ -613,15 +608,15 @@ void FixIntegrationSpin::AdvanceSingleSpin(int i, double dtl)
fm2 = (fm[i][0]*fm[i][0])+(fm[i][1]*fm[i][1])+(fm[i][2]*fm[i][2]); fm2 = (fm[i][0]*fm[i][0])+(fm[i][1]*fm[i][1])+(fm[i][2]*fm[i][2]);
fmsq = sqrt(fm2); fmsq = sqrt(fm2);
energy = (sp[i][0]*fm[i][0])+(sp[i][1]*fm[i][1])+(sp[i][2]*fm[i][2]); energy = (sp[i][0]*fm[i][0])+(sp[i][1]*fm[i][1])+(sp[i][2]*fm[i][2]);
dts2 = dtl*dtl; dts2 = dts*dts;
cp[0] = fm[i][1]*sp[i][2]-fm[i][2]*sp[i][1]; cp[0] = fm[i][1]*sp[i][2]-fm[i][2]*sp[i][1];
cp[1] = fm[i][2]*sp[i][0]-fm[i][0]*sp[i][2]; cp[1] = fm[i][2]*sp[i][0]-fm[i][0]*sp[i][2];
cp[2] = fm[i][0]*sp[i][1]-fm[i][1]*sp[i][0]; cp[2] = fm[i][0]*sp[i][1]-fm[i][1]*sp[i][0];
g[0] = sp[i][0]+cp[0]*dtl; g[0] = sp[i][0]+cp[0]*dts;
g[1] = sp[i][1]+cp[1]*dtl; g[1] = sp[i][1]+cp[1]*dts;
g[2] = sp[i][2]+cp[2]*dtl; g[2] = sp[i][2]+cp[2]*dts;
g[0] += (fm[i][0]*energy-0.5*sp[i][0]*fm2)*0.5*dts2; 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[1] += (fm[i][1]*energy-0.5*sp[i][1]*fm2)*0.5*dts2;
@ -645,7 +640,7 @@ void FixIntegrationSpin::AdvanceSingleSpin(int i, double dtl)
// comm. sp[i] to atoms with same tag (for serial algo) // comm. sp[i] to atoms with same tag (for serial algo)
if (mpi_flag == 0) { if (sector_flag == 0) {
if (sametag[i] >= 0) { if (sametag[i] >= 0) {
j = sametag[i]; j = sametag[i];
while (j >= 0) { while (j >= 0) {
@ -661,7 +656,7 @@ void FixIntegrationSpin::AdvanceSingleSpin(int i, double dtl)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixIntegrationSpin::final_integrate() void FixNVESpin::final_integrate()
{ {
double dtfm,msq,scale,fm2,fmsq,energy; double dtfm,msq,scale,fm2,fmsq,energy;
double cp[3],g[3]; double cp[3],g[3];
@ -669,8 +664,6 @@ void FixIntegrationSpin::final_integrate()
double **x = atom->x; double **x = atom->x;
double **v = atom->v; double **v = atom->v;
double **f = atom->f; double **f = atom->f;
double **sp = atom->sp;
double **fm = atom->fm;
double *rmass = atom->rmass; double *rmass = atom->rmass;
double *mass = atom->mass; double *mass = atom->mass;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;

View File

@ -13,29 +13,29 @@
#ifdef FIX_CLASS #ifdef FIX_CLASS
FixStyle(integration/spin,FixIntegrationSpin) FixStyle(nve/spin,FixNVESpin)
#else #else
#ifndef LMP_FIX_INTEGRATION_SPIN_H #ifndef LMP_FIX_NVE_SPIN_H
#define LMP_FIX_INTEGRATION_SPIN_H #define LMP_FIX_NVE_SPIN_H
#include "fix.h" #include "fix.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class FixIntegrationSpin : public Fix { class FixNVESpin : public Fix {
public: public:
FixIntegrationSpin(class LAMMPS *, int, char **); FixNVESpin(class LAMMPS *, int, char **);
virtual ~FixIntegrationSpin(); virtual ~FixNVESpin();
int setmask(); int setmask();
void init(); void init();
virtual void initial_integrate(int); virtual void initial_integrate(int);
virtual void final_integrate(); virtual void final_integrate();
void ComputeInteractionsSpin(int); // compute and advance single spin functions void ComputeInteractionsSpin(int); // compute and advance single spin functions
void AdvanceSingleSpin(int, double); void AdvanceSingleSpin(int);
void sectoring(); // sectoring operation functions void sectoring(); // sectoring operation functions
int coords2sector(double *); int coords2sector(double *);
@ -44,19 +44,18 @@ class FixIntegrationSpin : public Fix {
void pre_neighbor(); void pre_neighbor();
protected: protected:
int extra; int sector_flag; // sector_flag = 0 if serial algorithm
int mpi_flag; // mpi_flag = 0 if serial algorithm // sector_flag = 1 if parallel algorithm
// mpi_flag = 1 if parallel algorithm
int mech_flag; // mech_flag = 0 if spins only int mech_flag; // mech_flag = 0 if spins only
// mech_flag = 1 if spin-lattice calc. // mech_flag = 1 if spin-lattice calc.
double dtv,dtf,dts; // velocity, force, and spin timesteps double dtv, dtf, dts; // velocity, force, and spin timesteps
int magpair_flag; // magnetic pair flags int magpair_flag; // magnetic pair flags
int exch_flag; int exch_flag;
int soc_neel_flag, soc_dmi_flag; int soc_neel_flag, soc_dmi_flag;
int me_flag; int me_flag;
int magforce_flag; // magnetic force flags int magprecession_flag; // magnetic precession flags
int zeeman_flag, aniso_flag; int zeeman_flag, aniso_flag;
int maglangevin_flag; // magnetic langevin flags int maglangevin_flag; // magnetic langevin flags
int tdamp_flag, temp_flag; int tdamp_flag, temp_flag;
@ -68,7 +67,7 @@ class FixIntegrationSpin : public Fix {
class PairSpinSocNeel *lockpairspinsocneel; class PairSpinSocNeel *lockpairspinsocneel;
class PairSpinSocDmi *lockpairspinsocdmi; class PairSpinSocDmi *lockpairspinsocdmi;
class PairSpinMe *lockpairspinme; class PairSpinMe *lockpairspinme;
class FixForceSpin *lockforcespin; class FixPrecessionSpin *lockprecessionspin;
class FixLangevinSpin *locklangevinspin; class FixLangevinSpin *locklangevinspin;
int nsectors; // sectoring variables int nsectors; // sectoring variables
@ -90,13 +89,13 @@ class FixIntegrationSpin : public Fix {
/* ERROR/WARNING messages: /* ERROR/WARNING messages:
E: Illegal fix integration/spin command E: Illegal fix NVE/spin command
Self-explanatory. Check the input script syntax and compare to the Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line. command-line option when running LAMMPS to see the offending line.
E: Fix integration/spin requires spin attribute mumag E: Pair spin requires atom attribute spin
An atom/spin style with this attribute is needed. An atom/spin style with this attribute is needed.

View File

@ -24,7 +24,7 @@
#include "atom.h" #include "atom.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "fix_force_spin.h" #include "fix_precession_spin.h"
#include "force.h" #include "force.h"
#include "input.h" #include "input.h"
#include "math_const.h" #include "math_const.h"
@ -43,12 +43,10 @@ enum{CONSTANT,EQUAL};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixForceSpin::FixForceSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) FixPrecessionSpin::FixPrecessionSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
{ {
if (narg < 7) error->all(FLERR,"Illegal force/spin command"); if (narg < 7) error->all(FLERR,"Illegal precession/spin command");
// 7 arguments for a force/spin fix command:
// fix ID group force/spin magnitude (T or eV) style (zeeman or anisotropy) direction (3 cartesian coordinates)
// magnetic interactions coded for cartesian coordinates // magnetic interactions coded for cartesian coordinates
@ -74,7 +72,7 @@ FixForceSpin::FixForceSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, a
zeeman_flag = aniso_flag = 0; zeeman_flag = aniso_flag = 0;
if (strcmp(arg[3],"zeeman") == 0) { if (strcmp(arg[3],"zeeman") == 0) {
if (narg != 8) error->all(FLERR,"Illegal force/spin command"); if (narg != 8) error->all(FLERR,"Illegal precession/spin command");
style = ZEEMAN; style = ZEEMAN;
zeeman_flag = 1; zeeman_flag = 1;
H_field = force->numeric(FLERR,arg[4]); H_field = force->numeric(FLERR,arg[4]);
@ -83,14 +81,14 @@ FixForceSpin::FixForceSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, a
nhz = force->numeric(FLERR,arg[7]); nhz = force->numeric(FLERR,arg[7]);
magfieldstyle = CONSTANT; magfieldstyle = CONSTANT;
} else if (strcmp(arg[3],"anisotropy") == 0) { } else if (strcmp(arg[3],"anisotropy") == 0) {
if (narg != 8) error->all(FLERR,"Illegal force/spin command"); if (narg != 8) error->all(FLERR,"Illegal precession/spin command");
style = ANISOTROPY; style = ANISOTROPY;
aniso_flag = 1; aniso_flag = 1;
Ka = force->numeric(FLERR,arg[4]); Ka = force->numeric(FLERR,arg[4]);
nax = force->numeric(FLERR,arg[5]); nax = force->numeric(FLERR,arg[5]);
nay = force->numeric(FLERR,arg[6]); nay = force->numeric(FLERR,arg[6]);
naz = force->numeric(FLERR,arg[7]); naz = force->numeric(FLERR,arg[7]);
} else error->all(FLERR,"Illegal force/spin command"); } else error->all(FLERR,"Illegal precession/spin command");
degree2rad = MY_PI/180.0; degree2rad = MY_PI/180.0;
time_origin = update->ntimestep; time_origin = update->ntimestep;
@ -101,14 +99,14 @@ FixForceSpin::FixForceSpin(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, a
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixForceSpin::~FixForceSpin() FixPrecessionSpin::~FixPrecessionSpin()
{ {
delete [] magstr; delete [] magstr;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
int FixForceSpin::setmask() int FixPrecessionSpin::setmask()
{ {
int mask = 0; int mask = 0;
mask |= POST_FORCE; mask |= POST_FORCE;
@ -120,7 +118,7 @@ int FixForceSpin::setmask()
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixForceSpin::init() void FixPrecessionSpin::init()
{ {
const double hbar = force->hplanck/MY_2PI; // eV/(rad.THz) const double hbar = force->hplanck/MY_2PI; // eV/(rad.THz)
const double mub = 5.78901e-5; // in eV/T const double mub = 5.78901e-5; // in eV/T
@ -137,9 +135,9 @@ void FixForceSpin::init()
if (magstr) { if (magstr) {
magvar = input->variable->find(magstr); magvar = input->variable->find(magstr);
if (magvar < 0) if (magvar < 0)
error->all(FLERR,"Illegal force/spin command"); error->all(FLERR,"Illegal precession/spin command");
if (!input->variable->equalstyle(magvar)) if (!input->variable->equalstyle(magvar))
error->all(FLERR,"Illegal force/spin command"); error->all(FLERR,"Illegal precession/spin command");
} }
varflag = CONSTANT; varflag = CONSTANT;
@ -147,13 +145,13 @@ void FixForceSpin::init()
// set magnetic field components // set magnetic field components
if (varflag == CONSTANT) set_magneticforce(); if (varflag == CONSTANT) set_magneticprecession();
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixForceSpin::setup(int vflag) void FixPrecessionSpin::setup(int vflag)
{ {
if (strstr(update->integrate_style,"verlet")) if (strstr(update->integrate_style,"verlet"))
post_force(vflag); post_force(vflag);
@ -166,18 +164,17 @@ void FixForceSpin::setup(int vflag)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixForceSpin::post_force(int vflag) void FixPrecessionSpin::post_force(int vflag)
{ {
// update gravity due to variables // update gravity due to variables
if (varflag != CONSTANT) { if (varflag != CONSTANT) {
modify->clearstep_compute(); modify->clearstep_compute();
modify->addstep_compute(update->ntimestep + 1); modify->addstep_compute(update->ntimestep + 1);
set_magneticforce(); // update mag. field if time-dep. set_magneticprecession(); // update mag. field if time-dep.
} }
double **sp = atom->sp; double **sp = atom->sp;
double *mumag = atom->mumag;
double **fm = atom->fm; double **fm = atom->fm;
double spi[3], fmi[3]; double spi[3], fmi[3];
const int nlocal = atom->nlocal; const int nlocal = atom->nlocal;
@ -213,17 +210,17 @@ void FixForceSpin::post_force(int vflag)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixForceSpin::compute_zeeman(int i, double fmi[3]) void FixPrecessionSpin::compute_zeeman(int i, double fmi[3])
{ {
double *mumag = atom->mumag; double **sp = atom->sp;
fmi[0] -= mumag[i]*hx; fmi[0] -= sp[i][3]*hx;
fmi[1] -= mumag[i]*hy; fmi[1] -= sp[i][3]*hy;
fmi[2] -= mumag[i]*hz; fmi[2] -= sp[i][3]*hz;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixForceSpin::compute_anisotropy(int i, double spi[3], double fmi[3]) void FixPrecessionSpin::compute_anisotropy(int i, double spi[3], double fmi[3])
{ {
double scalar = nax*spi[0] + nay*spi[1] + naz*spi[2]; double scalar = nax*spi[0] + nay*spi[1] + naz*spi[2];
fmi[0] += scalar*Kax; fmi[0] += scalar*Kax;
@ -233,14 +230,14 @@ void FixForceSpin::compute_anisotropy(int i, double spi[3], double fmi[3])
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixForceSpin::post_force_respa(int vflag, int ilevel, int iloop) void FixPrecessionSpin::post_force_respa(int vflag, int ilevel, int iloop)
{ {
if (ilevel == ilevel_respa) post_force(vflag); if (ilevel == ilevel_respa) post_force(vflag);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixForceSpin::set_magneticforce() void FixPrecessionSpin::set_magneticprecession()
{ {
if (style == ZEEMAN) { if (style == ZEEMAN) {
hx = H_field*nhx; hx = H_field*nhx;
@ -258,10 +255,9 @@ void FixForceSpin::set_magneticforce()
potential energy in magnetic field potential energy in magnetic field
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
double FixForceSpin::compute_scalar() double FixPrecessionSpin::compute_scalar()
{ {
// only sum across procs one time // only sum across procs one time
//printf("test inside compute_scalar \n");
if (eflag == 0) { if (eflag == 0) {
MPI_Allreduce(&emag,&emag_all,1,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(&emag,&emag_all,1,MPI_DOUBLE,MPI_SUM,world);

View File

@ -13,23 +13,23 @@
#ifdef FIX_CLASS #ifdef FIX_CLASS
FixStyle(force/spin,FixForceSpin) FixStyle(precession/spin,FixPrecessionSpin)
#else #else
#ifndef LMP_FIX_FORCE_SPIN_H #ifndef LMP_FIX_PRECESSION_SPIN_H
#define LMP_FIX_FORCE_SPIN_H #define LMP_FIX_PRECESSION_SPIN_H
#include "fix.h" #include "fix.h"
namespace LAMMPS_NS { namespace LAMMPS_NS {
class FixForceSpin : public Fix { class FixPrecessionSpin : public Fix {
friend class FixPour; friend class FixPour;
public: public:
FixForceSpin(class LAMMPS *, int, char **); FixPrecessionSpin(class LAMMPS *, int, char **);
~FixForceSpin(); ~FixPrecessionSpin();
int setmask(); int setmask();
void init(); void init();
void setup(int); void setup(int);
@ -42,7 +42,7 @@ class FixForceSpin : public Fix {
void compute_anisotropy(int, double [3], double [3]); void compute_anisotropy(int, double [3], double [3]);
protected: protected:
int style; // style of the magnetic force int style; // style of the magnetic precession
double degree2rad; double degree2rad;
double hbar; double hbar;
@ -68,7 +68,7 @@ class FixForceSpin : public Fix {
double nax, nay, naz; double nax, nay, naz;
double Kax, Kay, Kaz; // temp. force variables double Kax, Kay, Kaz; // temp. force variables
void set_magneticforce(); void set_magneticprecession();
}; };
@ -79,10 +79,13 @@ class FixForceSpin : public Fix {
/* ERROR/WARNING messages: /* ERROR/WARNING messages:
E: Illegal force/spin command E: Illegal precession/spin command
Self-explanatory. Check the input script syntax and compare to the Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line. command-line option when running LAMMPS to see the offending line.
precession/spin fix command has 7 arguments:
fix ID group precession/spin magnitude (T or eV) style (zeeman or anisotropy)
direction (3 cartesian coordinates)
*/ */

View File

@ -87,7 +87,6 @@ void PairSpinExchange::compute(int eflag, int vflag)
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;
double **fm = atom->fm; double **fm = atom->fm;
double *mumag = atom->mumag;
double **sp = atom->sp; double **sp = atom->sp;
int *type = atom->type; int *type = atom->type;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
@ -336,8 +335,8 @@ void PairSpinExchange::coeff(int narg, char **arg)
void PairSpinExchange::init_style() void PairSpinExchange::init_style()
{ {
if (!atom->sp_flag || !atom->mumag_flag) if (!atom->sp_flag)
error->all(FLERR,"Pair spin requires atom attributes sp, mumag"); error->all(FLERR,"Pair spin requires atom/spin style");
neighbor->request(this,instance_me); neighbor->request(this,instance_me);

View File

@ -74,7 +74,7 @@ E: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file. Self-explanatory. Check the input script or data file.
E: Pair spin requires atom attributes sp, mumag E: Pair spin requires atom attribute spin
The atom style defined does not have these attributes. The atom style defined does not have these attributes.

View File

@ -92,7 +92,6 @@ void PairSpinMe::compute(int eflag, int vflag)
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;
double **fm = atom->fm; double **fm = atom->fm;
double *mumag = atom->mumag;
double **sp = atom->sp; double **sp = atom->sp;
int *type = atom->type; int *type = atom->type;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
@ -356,8 +355,8 @@ void PairSpinMe::coeff(int narg, char **arg)
void PairSpinMe::init_style() void PairSpinMe::init_style()
{ {
if (!atom->sp_flag || !atom->mumag_flag) if (!atom->sp_flag)
error->all(FLERR,"Pair spin requires atom attributes sp, mumag"); error->all(FLERR,"Pair spin requires atom/spin style");
neighbor->request(this,instance_me); neighbor->request(this,instance_me);

View File

@ -77,7 +77,7 @@ E: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file. Self-explanatory. Check the input script or data file.
E: Pair spin requires atom attributes sp, mumag E: Pair spin requires atom attribute spin
The atom style defined does not have these attributes. The atom style defined does not have these attributes.

View File

@ -86,7 +86,6 @@ void PairSpinSocDmi::compute(int eflag, int vflag)
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;
double **fm = atom->fm; double **fm = atom->fm;
double *mumag = atom->mumag;
double **sp = atom->sp; double **sp = atom->sp;
int *type = atom->type; int *type = atom->type;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
@ -314,8 +313,8 @@ void PairSpinSocDmi::coeff(int narg, char **arg)
void PairSpinSocDmi::init_style() void PairSpinSocDmi::init_style()
{ {
if (!atom->sp_flag || !atom->mumag_flag) if (!atom->sp_flag)
error->all(FLERR,"Pair spin requires atom attributes sp, mumag"); error->all(FLERR,"Pair spin requires atom/spin style");
neighbor->request(this,instance_me); neighbor->request(this,instance_me);

View File

@ -76,7 +76,7 @@ E: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file. Self-explanatory. Check the input script or data file.
E: Pair spin requires atom attributes sp, mumag E: Pair spin requires atom attribute spin
The atom style defined does not have these attributes. The atom style defined does not have these attributes.

View File

@ -93,7 +93,6 @@ void PairSpinSocNeel::compute(int eflag, int vflag)
double **x = atom->x; double **x = atom->x;
double **f = atom->f; double **f = atom->f;
double **fm = atom->fm; double **fm = atom->fm;
double *mumag = atom->mumag;
double **sp = atom->sp; double **sp = atom->sp;
int *type = atom->type; int *type = atom->type;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
@ -502,8 +501,8 @@ void PairSpinSocNeel::coeff(int narg, char **arg)
void PairSpinSocNeel::init_style() void PairSpinSocNeel::init_style()
{ {
if (!atom->sp_flag || !atom->mumag_flag) if (!atom->sp_flag)
error->all(FLERR,"Pair spin requires atom attributes sp, mumag"); error->all(FLERR,"Pair spin requires atom/spin style");
neighbor->request(this,instance_me); neighbor->request(this,instance_me);

View File

@ -81,7 +81,7 @@ E: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file. Self-explanatory. Check the input script or data file.
E: Pair spin requires atom attributes sp, mumag E: Pair spin requires atom attribute spin
The atom style defined does not have these attributes. The atom style defined does not have these attributes.

View File

@ -100,7 +100,6 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
// SPIN package // SPIN package
mumag = NULL;
sp = fm = NULL; sp = fm = NULL;
// USER-DPD // USER-DPD
@ -175,7 +174,7 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp)
// magnetic flags // magnetic flags
sp_flag = mumag_flag = 0; sp_flag = 0;
vfrac_flag = 0; vfrac_flag = 0;
spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0; spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0;
@ -278,7 +277,6 @@ Atom::~Atom()
memory->destroy(tri); memory->destroy(tri);
memory->destroy(body); memory->destroy(body);
memory->destroy(mumag);
memory->destroy(sp); memory->destroy(sp);
memory->destroy(fm); memory->destroy(fm);
@ -436,7 +434,7 @@ void Atom::create_avec(const char *style, int narg, char **arg, int trysuffix)
// magnetic flags // magnetic flags
sp_flag = mumag_flag = 0; sp_flag = 0;
vfrac_flag = 0; vfrac_flag = 0;
spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0; spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0;

View File

@ -63,7 +63,7 @@ class Atom : protected Pointers {
// SPIN package // SPIN package
double *mumag, **sp; double **sp;
double **fm; double **fm;
// PERI package // PERI package
@ -153,7 +153,7 @@ class Atom : protected Pointers {
//USER-SPIN package //USER-SPIN package
int mumag_flag,sp_flag; int sp_flag;
// USER-SMD package // USER-SMD package

View File

@ -141,7 +141,41 @@ ComputePropertyAtom::ComputePropertyAtom(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Compute property/atom for " error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated"); "atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_mu; pack_choice[i] = &ComputePropertyAtom::pack_mu;
} else if (strcmp(arg[iarg],"spx") == 0) { // pack magnetic variables
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_spx;
} else if (strcmp(arg[iarg],"spy") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_spy;
} else if (strcmp(arg[iarg],"spz") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_spz;
} else if (strcmp(arg[iarg],"sp") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_sp;
} else if (strcmp(arg[iarg],"fmx") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_fmx;
} else if (strcmp(arg[iarg],"fmy") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_fmy;
} else if (strcmp(arg[iarg],"fmz") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Compute property/atom for "
"atom property that isn't allocated");
pack_choice[i] = &ComputePropertyAtom::pack_fmz;
} else if (strcmp(arg[iarg],"radius") == 0) { } else if (strcmp(arg[iarg],"radius") == 0) {
if (!atom->radius_flag) if (!atom->radius_flag)
error->all(FLERR,"Compute property/atom for " error->all(FLERR,"Compute property/atom for "
@ -1000,6 +1034,111 @@ void ComputePropertyAtom::pack_mu(int n)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void ComputePropertyAtom::pack_spx(int n)
{
double **sp = atom->sp;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = sp[i][0];
else buf[n] = 0.0;
n += nvalues;
}
}
/* ---------------------------------------------------------------------- */
void ComputePropertyAtom::pack_spy(int n)
{
double **sp = atom->sp;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = sp[i][1];
else buf[n] = 0.0;
n += nvalues;
}
}
/* ---------------------------------------------------------------------- */
void ComputePropertyAtom::pack_spz(int n)
{
double **sp = atom->sp;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = sp[i][2];
else buf[n] = 0.0;
n += nvalues;
}
}
/* ---------------------------------------------------------------------- */
void ComputePropertyAtom::pack_sp(int n)
{
double **sp = atom->sp;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = sp[i][3];
else buf[n] = 0.0;
n += nvalues;
}
}
/* ---------------------------------------------------------------------- */
void ComputePropertyAtom::pack_fmx(int n)
{
double **fm = atom->fm;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = fm[i][0];
else buf[n] = 0.0;
n += nvalues;
}
}
/* ---------------------------------------------------------------------- */
void ComputePropertyAtom::pack_fmy(int n)
{
double **fm = atom->fm;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = fm[i][1];
else buf[n] = 0.0;
n += nvalues;
}
}
/* ---------------------------------------------------------------------- */
void ComputePropertyAtom::pack_fmz(int n)
{
double **fm = atom->fm;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = fm[i][2];
else buf[n] = 0.0;
n += nvalues;
}
}
/* ---------------------------------------------------------------------- */
void ComputePropertyAtom::pack_radius(int n) void ComputePropertyAtom::pack_radius(int n)
{ {
double *radius = atom->radius; double *radius = atom->radius;

View File

@ -84,6 +84,14 @@ class ComputePropertyAtom : public Compute {
void pack_radius(int); void pack_radius(int);
void pack_diameter(int); void pack_diameter(int);
void pack_spx(int); // pack magnetic variables
void pack_spy(int);
void pack_spz(int);
void pack_sp(int);
void pack_fmx(int);
void pack_fmy(int);
void pack_fmz(int);
void pack_omegax(int); void pack_omegax(int);
void pack_omegay(int); void pack_omegay(int);
void pack_omegaz(int); void pack_omegaz(int);

View File

@ -854,36 +854,6 @@ int DumpCustom::count()
for (i = 0; i < nlocal; i++) dchoose[i] = 2.0*radius[i]; for (i = 0; i < nlocal; i++) dchoose[i] = 2.0*radius[i];
ptr = dchoose; ptr = dchoose;
nstride = 1; nstride = 1;
} else if (thresh_array[ithresh] == MUMAG) {//Magnetic properties
if (!atom->mumag_flag)
error->all(FLERR,
"Threshold for an atom property that isn't allocated");
ptr = atom->mumag;
nstride = 1;
} else if (thresh_array[ithresh] == SPX) {
if (!atom->sp_flag)
error->all(FLERR,
"Threshold for an atom property that isn't allocated");
ptr = &atom->sp[0][0];
nstride = 4;
} else if (thresh_array[ithresh] == SPY) {
if (!atom->sp_flag)
error->all(FLERR,
"Threshold for an atom property that isn't allocated");
ptr = &atom->sp[0][1];
nstride = 4;
} else if (thresh_array[ithresh] == SPZ) {
if (!atom->sp_flag)
error->all(FLERR,
"Threshold for an atom property that isn't allocated");
ptr = &atom->sp[0][2];
nstride = 4;
} else if (thresh_array[ithresh] == SP) {
if (!atom->sp_flag)
error->all(FLERR,
"Threshold for an atom property that isn't allocated");
ptr = &atom->sp[0][3];
nstride = 4;
} else if (thresh_array[ithresh] == OMEGAX) { } else if (thresh_array[ithresh] == OMEGAX) {
if (!atom->omega_flag) if (!atom->omega_flag)
error->all(FLERR, error->all(FLERR,
@ -1311,36 +1281,6 @@ int DumpCustom::parse_fields(int narg, char **arg)
error->all(FLERR,"Dumping an atom property that isn't allocated"); error->all(FLERR,"Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_mu; pack_choice[i] = &DumpCustom::pack_mu;
vtype[i] = DOUBLE; vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"mumag") == 0) {//Magnetic properties
if (!atom->mumag_flag)
error->all(FLERR,"Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_mumag;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"spx") == 0) {
strcpy(arg[iarg],"vx");
if (!atom->sp_flag)
error->all(FLERR,"Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_spx;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"spy") == 0) {
strcpy(arg[iarg],"vy");
if (!atom->sp_flag)
error->all(FLERR,"Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_spy;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"spz") == 0) {
strcpy(arg[iarg],"vz");
if (!atom->sp_flag)
error->all(FLERR,"Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_spz;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"sp") == 0) {
if (!atom->sp_flag)
error->all(FLERR,"Dumping an atom property that isn't allocated");
pack_choice[i] = &DumpCustom::pack_sp;
vtype[i] = DOUBLE;
} else if (strcmp(arg[iarg],"radius") == 0) { } else if (strcmp(arg[iarg],"radius") == 0) {
if (!atom->radius_flag) if (!atom->radius_flag)
error->all(FLERR,"Dumping an atom property that isn't allocated"); error->all(FLERR,"Dumping an atom property that isn't allocated");
@ -1844,13 +1784,6 @@ int DumpCustom::modify_param(int narg, char **arg)
else if (strcmp(arg[1],"muz") == 0) thresh_array[nthresh] = MUZ; else if (strcmp(arg[1],"muz") == 0) thresh_array[nthresh] = MUZ;
else if (strcmp(arg[1],"mu") == 0) thresh_array[nthresh] = MU; else if (strcmp(arg[1],"mu") == 0) thresh_array[nthresh] = MU;
//Magnetic quantities
else if (strcmp(arg[1],"mumag") == 0) thresh_array[nthresh] = MUMAG;
else if (strcmp(arg[1],"spx") == 0) thresh_array[nthresh] = SPX;
else if (strcmp(arg[1],"spy") == 0) thresh_array[nthresh] = SPY;
else if (strcmp(arg[1],"spz") == 0) thresh_array[nthresh] = SPZ;
else if (strcmp(arg[1],"sp") == 0) thresh_array[nthresh] = SP;
else if (strcmp(arg[1],"radius") == 0) thresh_array[nthresh] = RADIUS; else if (strcmp(arg[1],"radius") == 0) thresh_array[nthresh] = RADIUS;
else if (strcmp(arg[1],"diameter") == 0) thresh_array[nthresh] = DIAMETER; else if (strcmp(arg[1],"diameter") == 0) thresh_array[nthresh] = DIAMETER;
else if (strcmp(arg[1],"omegax") == 0) thresh_array[nthresh] = OMEGAX; else if (strcmp(arg[1],"omegax") == 0) thresh_array[nthresh] = OMEGAX;
@ -2764,66 +2697,6 @@ void DumpCustom::pack_mu(int n)
} }
} }
/* ---------------------------------------------------------------------- */
//Magnetic quantities
void DumpCustom::pack_mumag(int n)
{
double *mumag = atom->mumag;
for (int i = 0; i < nchoose; i++) {
buf[n] = mumag[clist[i]];
n += size_one;
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_spx(int n)
{
double **sp = atom->sp;
for (int i = 0; i < nchoose; i++) {
buf[n] = sp[clist[i]][0];
n += size_one;
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_spy(int n)
{
double **sp = atom->sp;
for (int i = 0; i < nchoose; i++) {
buf[n] = sp[clist[i]][1];
n += size_one;
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_spz(int n)
{
double **sp = atom->sp;
for (int i = 0; i < nchoose; i++) {
buf[n] = sp[clist[i]][2];
n += size_one;
}
}
/* ---------------------------------------------------------------------- */
void DumpCustom::pack_sp(int n)
{
double **sp = atom->sp;
for (int i = 0; i < nchoose; i++) {
buf[n] = sp[clist[i]][3];
n += size_one;
}
}
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void DumpCustom::pack_radius(int n) void DumpCustom::pack_radius(int n)

View File

@ -178,11 +178,6 @@ class DumpCustom : public Dump {
void pack_muy(int); void pack_muy(int);
void pack_muz(int); void pack_muz(int);
void pack_mu(int); void pack_mu(int);
void pack_mumag(int); //Magnetic quantities
void pack_spx(int);
void pack_spy(int);
void pack_spz(int);
void pack_sp(int);
void pack_radius(int); void pack_radius(int);
void pack_diameter(int); void pack_diameter(int);

View File

@ -31,7 +31,7 @@ class PairHybrid : public Pair {
friend class FixOMP; friend class FixOMP;
friend class Force; friend class Force;
friend class Respa; friend class Respa;
friend class FixIntegrationSpin; friend class FixNVESpin;
friend class Info; friend class Info;
public: public:
PairHybrid(class LAMMPS *); PairHybrid(class LAMMPS *);

View File

@ -853,14 +853,11 @@ void Set::set(int keyword)
else if (keyword == SPIN) { else if (keyword == SPIN) {
double **sp = atom->sp; double **sp = atom->sp;
double *mumag = atom->mumag; double inorm = 1.0/sqrt(xvalue*xvalue+yvalue*yvalue+zvalue*zvalue);
double sp_norm = sqrt(xvalue*xvalue+yvalue*yvalue+zvalue*zvalue); sp[i][0] = inorm*xvalue;
sp[i][0] = xvalue/sp_norm; sp[i][1] = inorm*yvalue;
sp[i][1] = yvalue/sp_norm; sp[i][2] = inorm*zvalue;
sp[i][2] = zvalue/sp_norm; sp[i][3] = dvalue;
sp[i][3] = sqrt(sp[i][0]*sp[i][0] + sp[i][1]*sp[i][1] +
sp[i][2]*sp[i][2]); //Should be 1 for atomic spins
mumag[i] = dvalue;
} }
// set quaternion orientation of ellipsoid or tri or body particle // set quaternion orientation of ellipsoid or tri or body particle
@ -1030,7 +1027,6 @@ void Set::setrandom(int keyword)
} else if (keyword == SPIN_RANDOM) { } else if (keyword == SPIN_RANDOM) {
double **sp = atom->sp; double **sp = atom->sp;
double *mumag = atom->mumag;
int nlocal = atom->nlocal; int nlocal = atom->nlocal;
double sp_sq,scale; double sp_sq,scale;
@ -1047,8 +1043,7 @@ void Set::setrandom(int keyword)
sp[i][0] *= scale; sp[i][0] *= scale;
sp[i][1] *= scale; sp[i][1] *= scale;
sp[i][2] *= scale; sp[i][2] *= scale;
sp[i][3] = sqrt(sp_sq); sp[i][3] = dvalue;
mumag[i] = dvalue;
count++; count++;
} }
@ -1063,8 +1058,7 @@ void Set::setrandom(int keyword)
scale = 1.0/sqrt(sp_sq); scale = 1.0/sqrt(sp_sq);
sp[i][0] *= scale; sp[i][0] *= scale;
sp[i][1] *= scale; sp[i][1] *= scale;
sp[i][3] = sqrt(sp_sq); sp[i][3] = dvalue;
mumag[i] = dvalue;
count++; count++;
} }
} }

View File

@ -75,7 +75,7 @@ void Verlet::init()
torqueflag = extraflag = 0; torqueflag = extraflag = 0;
if (atom->torque_flag) torqueflag = 1; if (atom->torque_flag) torqueflag = 1;
if (atom->avec->forceclearflag) extraflag = 1; if (atom->avec->forceclearflag) extraflag = 1;
if (atom->mumag_flag) extraflag = 1; if (atom->sp_flag) extraflag = 1;
// orthogonal vs triclinic simulation box // orthogonal vs triclinic simulation box