diff --git a/examples/SPIN/in.spin.bfo b/examples/SPIN/in.spin.bfo index aee3454765..1ceeb86614 100644 --- a/examples/SPIN/in.spin.bfo +++ b/examples/SPIN/in.spin.bfo @@ -3,14 +3,9 @@ ################### clear -#setting units to metal (Ang, picosecs, eV, ...): units metal - -#setting dimension of the system (N=2 or 3): dimension 3 - -#setting boundary conditions. (p for periodic, f for fixed, ...) -boundary p p f +boundary p p p #setting atom_style to spin: atom_style spin @@ -21,8 +16,6 @@ atom_style spin #why? atom_modify map array -#newton off for pair spin in SEQNEI -#newton off off ########################### #######Create atoms######## @@ -30,49 +23,31 @@ atom_modify map array #Lattice constant of sc Iron atoms of BFO lattice sc 3.96 - -#Defining a geometric region of space. Sets ID(user's choice), style(block, sphere, ...), then, args depends on the style chosen -#(for block, one has x0, xf, y0, yf, z0, zf, in distance units) region box block 0.0 17.0 0.0 17.0 0.0 5.0 - -#Creating a simulation box based on the specified region. Entries: number of atom types and box ref. create_box 1 box - -#Creating atoms (or molecules) on a lattice, or a single atom (or molecule), ... -#Entries: atom type, create_atoms 1 box -#Replicating NxNxN the entire set of atoms -#replicate 1 1 1 - - ####################### #######Settings######## ####################### #Setting one or more properties of one or more atoms. -#Setting mass mass 1 1.0 -#set group all mass 1.0 + #Setting spins orientation and moment set group all spin/random 11 2.50 #set group all spin 2.50 1.0 0.0 0.0 -#Magnetic exchange interaction coefficient for bulk fcc Cobalt -pair_style pair/spin 5.7 -#type i and j | interaction type | cutoff | J1 (eV) | J2 (adim) | J3 (Ang) (for Exchange) -pair_coeff * * exchange 5.7 -0.01575 0.0 1.965 +#Magnetic interactions for BFO #type i and j | interaction type | cutoff | Int (eV) | [dx,dy,dz] (for DMI and ME) -#pair_coeff * * dmi 2.6 0.001 0.0 0.0 1.0 -#pair_coeff * * me 4.0 0.000109 1.0 1.0 1.0 -#Mex10 -pair_coeff * * me 4.0 0.00109 1.0 1.0 1.0 +pair_style hybrid/overlay pair/spin/exchange 6.0 pair/spin/me 4.5 +pair_coeff * * pair/spin/exchange exchange 6.0 -0.01575 0.0 1.965 +pair_coeff * * pair/spin/me me 4.5 0.00109 1.0 1.0 1.0 +#pair_coeff * * pair/spin/soc/dmi dmi 4.5 0.001 1.0 1.0 1.0 #Define a skin distance, update neigh list every -#neighbor 1.0 bin -#neigh_modify every 10 check yes delay 20 neighbor 0.0 bin -neigh_modify every 1 check no delay 0 +neigh_modify every 10 check yes delay 20 #Magnetic field fix #Type | Intensity (T or eV) | Direction @@ -81,17 +56,10 @@ fix 1 all force/spin anisotropy 0.0000035 0.0 0.0 1.0 #Fix Langevin spins (merging damping and temperature) #Temp | Alpha_trans | Alpha_long | Seed -#fix 2 all langevin/spin 0.0 0.1 0.0 21 fix 2 all langevin/spin 0.0 0.1 0.0 21 -#fix 2 all langevin/spin 0.0 0.0 0.0 21 #Magnetic integration fix -fix 3 all nve/spin mpi - -#compute real time, total magnetization, magnetic energy, and spin temperature -#Iteration | Time | Mx | My | Mz | |M| | Em | Tm -compute mag all compute/spin -fix outmag all ave/time 1 1 500 c_mag[1] c_mag[2] c_mag[3] c_mag[4] c_mag[5] c_mag[6] c_mag[7] file mag_BFO.dat format %20.16g +fix 3 all integration/spin serial #Setting the timestep for the simulation (in ps) timestep 0.0001 @@ -100,10 +68,26 @@ timestep 0.0001 #######run######## ################## +compute out_mag all compute/spin +compute out_pe all pe +compute out_ke all ke +compute out_temp all temp + +#compute real time, total magnetization, magnetic energy, and spin temperature +#Iteration | Time | Mx | My | Mz | |M| | Em | Tm +variable magz equal c_out_mag[4] +variable magnorm equal c_out_mag[5] +variable emag equal c_out_mag[6] +variable tmag equal c_out_mag[7] +variable mag_force equal f_1 + +thermo 10 +thermo_style custom step time v_magnorm v_emag temp etotal +thermo_modify format float %20.15g + #Dump the positions and spin directions of magnetic particles (vmd format) -dump 1 all custom 5000 dump_spin_BFO.lammpstrj type x y z spx spy spz +dump 1 all custom 100 dump_spin_BFO.lammpstrj type x y z spx spy spz #Running the simulations for N timesteps -run 30000 -#run 1 +run 50000 diff --git a/examples/SPIN/in.spin.cobalt b/examples/SPIN/in.spin.cobalt index cb64c65f5c..ce3008d3d4 100644 --- a/examples/SPIN/in.spin.cobalt +++ b/examples/SPIN/in.spin.cobalt @@ -5,8 +5,8 @@ clear units metal dimension 3 -boundary p p p -#boundary p p f +#boundary p p p +boundary p p f #newton off @@ -42,13 +42,14 @@ set group all spin/random 31 1.72 #set group all spin 1.72 0.0 0.0 1.0 #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 +velocity all create 10 4928459 rot yes dist gaussian #Magneto-mechanic interactions for bulk fcc Cobalt #pair_style pair/spin/exchange 4.0 #pair_style eam/alloy #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/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 * * ../Co_PurjaPun_2012.eam.alloy Co @@ -57,8 +58,9 @@ pair_coeff * * eam/alloy ../examples/SPIN/Co_PurjaPun_2012.eam.alloy Co #type i and j | interaction type | cutoff | J1 (eV) | J2 (adim) | J3 (Ang) (for Exchange) #pair_coeff * * exchange 4.0 -0.0446928 0.003496 1.4885 #pair_coeff * * exchange 4.0 0.0 0.003496 1.4885 -#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/exchange exchange 2.5 0.0446928 0.003496 1.4885 +#pair_coeff * * pair/spin/exchange exchange 4.0 0.0 0.003496 1.4885 #type i and j | interaction type | cutoff | Int (eV) | [dx,dy,dz] (for DMI and ME) #pair_coeff * * dmi 2.6 0.001 0.0 0.0 1.0 @@ -66,14 +68,13 @@ pair_coeff * * pair/spin/exchange exchange 4.0 0.0446928 0.003496 1.4885 #type i and j | interaction type | cutoff | K1 (eV) | K2 (adim) | K3 (Ang) (for SOC) #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_coeff * * pair/spin/soc/neel neel 4.0 0.0 0.864159 2.13731 #Define a skin distance, update neigh list every -#neighbor 0.1 bin -#neigh_modify every 10 check yes delay 20 neighbor 0.1 bin -neigh_modify every 1 check no delay 0 +neigh_modify every 10 check yes delay 20 +#neighbor 1.0 bin +#neigh_modify every 1 check no delay 0 #Magnetic field fix #Type | Intensity (T or eV) | Direction @@ -111,14 +112,13 @@ variable mag_force equal f_1 #variable test equal etotal-0.5*c_out_mag[6] thermo 10 -#thermo_style custom step time v_emag c_out_pe c_out_ke c_out_temp v_mag_force v_magnorm v_tmag etotal -thermo_style custom step time v_magnorm v_emag v_tmag temp etotal +thermo_style custom step time v_magnorm v_emag temp etotal thermo_modify format float %20.15g #Dump the positions and spin directions of magnetic particles (vmd format) dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz #Running the simulations for N timesteps -#run 1 run 10000 +#run 10000 diff --git a/src/SPIN/atom_vec_spin.cpp b/src/SPIN/atom_vec_spin.cpp index 3f0f9e02bc..1af3440958 100644 --- a/src/SPIN/atom_vec_spin.cpp +++ b/src/SPIN/atom_vec_spin.cpp @@ -45,7 +45,7 @@ AtomVecSpin::AtomVecSpin(LAMMPS *lmp) : AtomVec(lmp) size_reverse = 6; size_border = 11; size_velocity = 3; - size_data_atom = 9; // to check later + size_data_atom = 9; size_data_vel = 4; xcol_data = 4; diff --git a/src/SPIN/fix_integration_spin.cpp b/src/SPIN/fix_integration_spin.cpp index 69ed8ed0e8..a79d24a570 100644 --- a/src/SPIN/fix_integration_spin.cpp +++ b/src/SPIN/fix_integration_spin.cpp @@ -85,6 +85,7 @@ FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) : magpair_flag = 0; exch_flag = 0; soc_neel_flag = soc_dmi_flag = 0; + me_flag = 0; magforce_flag = 0; zeeman_flag = aniso_flag = 0; maglangevin_flag = 0; @@ -137,6 +138,9 @@ void FixIntegrationSpin::init() } else if (strstr(force->pair_style,"pair/spin/soc/dmi")) { soc_dmi_flag = 1; lockpairspinsocdmi = (PairSpinSocDmi *) force->pair; + } else if (strstr(force->pair_style,"pair/spin/me")) { + me_flag = 1; + lockpairspinme = (PairSpinMe *) force->pair; } else if (strstr(force->pair_style,"hybrid/overlay")) { PairHybrid *lockhybrid = (PairHybrid *) force->pair; int nhybrid_styles = lockhybrid->nstyles; @@ -151,6 +155,9 @@ void FixIntegrationSpin::init() } else if (strstr(lockhybrid->keywords[ipair],"pair/spin/soc/dmi")) { soc_dmi_flag = 1; lockpairspinsocdmi = (PairSpinSocDmi *) lockhybrid->styles[ipair]; + } else if (strstr(lockhybrid->keywords[ipair],"pair/spin/me")) { + me_flag = 1; + lockpairspinme = (PairSpinMe *) lockhybrid->styles[ipair]; } } } else error->all(FLERR,"Illegal fix integration/spin command"); @@ -189,7 +196,7 @@ void FixIntegrationSpin::init() if (mpi_flag) sectoring(); - // grow tables for k and adv_list + // grow tables of stacking variables stack_head = memory->grow(stack_head,nsectors,"integration/spin:stack_head"); stack_foot = memory->grow(stack_foot,nsectors,"integration/spin:stack_foot"); @@ -461,6 +468,17 @@ void FixIntegrationSpin::ComputeInteractionsSpin(int ii) } } + if (me_flag) { // me + temp_cut = lockpairspinme->cut_spin_me[itype][jtype]; + cut_2 = temp_cut*temp_cut; + if (rsq <= cut_2) { + eij[0] = rij[0]*inorm; + eij[1] = rij[1]*inorm; + eij[2] = rij[2]*inorm; + lockpairspinme->compute_me(i,j,eij,fmi,spi,spj); + } + } + } if (magforce_flag) { // mag. forces diff --git a/src/SPIN/fix_integration_spin.h b/src/SPIN/fix_integration_spin.h index 727b5c89c6..7f55368922 100644 --- a/src/SPIN/fix_integration_spin.h +++ b/src/SPIN/fix_integration_spin.h @@ -51,6 +51,7 @@ class FixIntegrationSpin : public Fix { int magpair_flag; // magnetic pair flags int exch_flag; int soc_neel_flag, soc_dmi_flag; + int me_flag; int magforce_flag; // magnetic force flags int zeeman_flag, aniso_flag; int maglangevin_flag; // magnetic langevin flags @@ -62,6 +63,7 @@ class FixIntegrationSpin : public Fix { class PairSpinExchange *lockpairspinexchange; class PairSpinSocNeel *lockpairspinsocneel; class PairSpinSocDmi *lockpairspinsocdmi; + class PairSpinMe *lockpairspinme; class FixForceSpin *lockforcespin; class FixLangevinSpin *locklangevinspin; diff --git a/src/SPIN/pair_spin_me.cpp b/src/SPIN/pair_spin_me.cpp index 3c6f4fa7ed..1fc4cc6c44 100755 --- a/src/SPIN/pair_spin_me.cpp +++ b/src/SPIN/pair_spin_me.cpp @@ -42,11 +42,12 @@ PairSpinMe::PairSpinMe(LAMMPS *lmp) : Pair(lmp) { hbar = force->hplanck/MY_2PI; - newton_pair_spin = 0; // no newton pair for now + //newton_pair_spin = 0; // no newton pair for now // newton_pair = 0; single_enable = 0; me_flag = 0; + me_mech_flag = 0; no_virial_fdotr_compute = 1; } @@ -60,6 +61,7 @@ PairSpinMe::~PairSpinMe() memory->destroy(cut_spin_me); memory->destroy(ME); + memory->destroy(ME_mech); memory->destroy(v_mex); memory->destroy(v_mey); memory->destroy(v_mez); @@ -150,7 +152,8 @@ void PairSpinMe::compute(int eflag, int vflag) if (me_flag){ cut_me_2 = cut_spin_me[itype][jtype]*cut_spin_me[itype][jtype]; if (rsq <= cut_me_2){ - compute_me(i,j,fmi,fmj,spi,spj); + compute_me(i,j,rij,fmi,spi,spj); + compute_me_mech(i,j,fi,spi,spj); } } @@ -161,14 +164,11 @@ void PairSpinMe::compute(int eflag, int vflag) fm[i][1] += fmi[1]; fm[i][2] += fmi[2]; -// if (newton_pair || j < nlocal) { => to be corrected - if (newton_pair_spin) { + if (newton_pair || j < nlocal) { // => to be corrected +// if (newton_pair_spin) { f[j][0] += fj[0]; f[j][1] += fj[1]; f[j][2] += fj[2]; - fm[j][0] += fmj[0]; - fm[j][1] += fmj[1]; - fm[j][2] += fmj[2]; } if (eflag) { @@ -189,30 +189,29 @@ void PairSpinMe::compute(int eflag, int vflag) } - /* ---------------------------------------------------------------------- */ -void PairSpinMe::compute_me(int i, int j, double fmi[3], double fmj[3], double spi[3], double spj[3]) +void PairSpinMe::compute_me(int i, int j, double eij[3], double fmi[3], double spi[3], double spj[3]) { int *type = atom->type; int itype, jtype; itype = type[i]; jtype = type[j]; - double **x = atom->x; double meix,meiy,meiz; - double rx, ry, rz, inorm; + double rx, ry, rz; + double vx, vy, vz; - rx = x[j][0] - x[i][0]; - ry = x[j][1] - x[i][1]; - rz = x[j][2] - x[i][2]; - inorm = 1.0/sqrt(rx*rx+ry*ry+rz*rz); - rx *= inorm; - ry *= inorm; - rz *= inorm; + rx = eij[0]; + ry = eij[1]; + rz = eij[2]; - meix = v_mey[itype][jtype]*rz - v_mez[itype][jtype]*ry; - meiy = v_mez[itype][jtype]*rx - v_mex[itype][jtype]*rz; - meiz = v_mex[itype][jtype]*ry - v_mey[itype][jtype]*rx; + vx = v_mex[itype][jtype]; + vy = v_mey[itype][jtype]; + vz = v_mez[itype][jtype]; + + meix = vy*rz - vz*ry; + meiy = vz*rx - vx*rz; + meiz = vx*ry - vy*rx; meix *= ME[itype][jtype]; meiy *= ME[itype][jtype]; @@ -221,13 +220,39 @@ void PairSpinMe::compute_me(int i, int j, double fmi[3], double fmj[3], double fmi[0] += spj[1]*meiz - spj[2]*meiy; fmi[1] += spj[2]*meix - spj[0]*meiz; fmi[2] += spj[0]*meiy - spj[1]*meix; - - fmj[0] -= spi[1]*meiz - spi[2]*meiy; - fmj[1] -= spi[2]*meix - spi[0]*meiz; - fmj[2] -= spi[0]*meiy - spi[1]*meix; } +/* ---------------------------------------------------------------------- */ + +void PairSpinMe::compute_me_mech(int i, int j, double fi[3], double spi[3], double spj[3]) +{ + int *type = atom->type; + int itype, jtype; + itype = type[i]; + jtype = type[j]; + + double meix,meiy,meiz; + double vx, vy, vz; + + vx = v_mex[itype][jtype]; + vy = v_mey[itype][jtype]; + vz = v_mez[itype][jtype]; + + meix = spi[1]*spi[2] - spi[2]*spj[1]; + meiy = spi[2]*spi[0] - spi[0]*spj[2]; + meiz = spi[0]*spi[1] - spi[1]*spj[0]; + + meix *= ME_mech[itype][jtype]; + meiy *= ME_mech[itype][jtype]; + meiz *= ME_mech[itype][jtype]; + + fi[0] = meiy*vz - meiz*vy; + fi[1] = meiz*vx - meix*vz; + fi[2] = meix*vy - meiy*vx; + +} + /* ---------------------------------------------------------------------- allocate all arrays ------------------------------------------------------------------------- */ @@ -242,11 +267,12 @@ void PairSpinMe::allocate() for (int j = i; j <= n; j++) setflag[i][j] = 0; - memory->create(cut_spin_me,n+1,n+1,"pair:cut_spin_me"); - memory->create(ME,n+1,n+1,"pair:ME"); - memory->create(v_mex,n+1,n+1,"pair:ME_vector_x"); - memory->create(v_mey,n+1,n+1,"pair:ME_vector_y"); - memory->create(v_mez,n+1,n+1,"pair:ME_vector_z"); + memory->create(cut_spin_me,n+1,n+1,"pair/spin/me:cut_spin_me"); + memory->create(ME,n+1,n+1,"pair/spin/me:ME"); + memory->create(ME_mech,n+1,n+1,"pair/spin/me:ME_mech"); + memory->create(v_mex,n+1,n+1,"pair/spin/me:ME_vector_x"); + memory->create(v_mey,n+1,n+1,"pair/spin/me:ME_vector_y"); + memory->create(v_mez,n+1,n+1,"pair/spin/me:ME_vector_z"); memory->create(cutsq,n+1,n+1,"pair:cutsq"); @@ -297,7 +323,7 @@ void PairSpinMe::coeff(int narg, char **arg) force->bounds(FLERR,arg[1],atom->ntypes,jlo,jhi); const double rij = force->numeric(FLERR,arg[3]); - const double me = (force->numeric(FLERR,arg[4]))/hbar; + const double me = (force->numeric(FLERR,arg[4])); double mex = force->numeric(FLERR,arg[5]); double mey = force->numeric(FLERR,arg[6]); double mez = force->numeric(FLERR,arg[7]); @@ -311,7 +337,8 @@ void PairSpinMe::coeff(int narg, char **arg) for (int i = ilo; i <= ihi; i++) { for (int j = MAX(jlo,i); j <= jhi; j++) { cut_spin_me[i][j] = rij; - ME[i][j] = me; + ME[i][j] = me/hbar; + ME_mech[i][j] = me; v_mex[i][j] = mex; v_mey[i][j] = mey; v_mez[i][j] = mez; @@ -337,12 +364,9 @@ void PairSpinMe::init_style() neighbor->request(this,instance_me); // check this half/full request => to be corrected/reviewed -#define FULLNEI -#if defined FULLNEI int irequest = neighbor->request(this,instance_me); neighbor->requests[irequest]->half = 0; neighbor->requests[irequest]->full = 1; -#endif } diff --git a/src/SPIN/pair_spin_me.h b/src/SPIN/pair_spin_me.h index 31e0d8b560..18b7ffbb00 100755 --- a/src/SPIN/pair_spin_me.h +++ b/src/SPIN/pair_spin_me.h @@ -39,9 +39,11 @@ class PairSpinMe : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); - void compute_me(int, int, double fmi[3], double fmj[3], double spi[3], double spj[3]); + void compute_me(int, int, double [3], double [3], double [3], double [3]); + void compute_me_mech(int, int, double [3], double [3], double [3]); int me_flag; // me flag + int me_mech_flag; // mech calculation flag double cut_spin_me_global; // global me cutoff double **cut_spin_me; // me cutoff distance @@ -50,7 +52,7 @@ class PairSpinMe : public Pair { int newton_pair_spin; double hbar; - double **ME; // me coeff in eV + double **ME, **ME_mech; // me coeff in eV double **v_mex, **v_mey, **v_mez; // me direction void allocate(); diff --git a/src/SPIN/pair_spin_soc_neel.h b/src/SPIN/pair_spin_soc_neel.h index ee675b36c7..b02731b214 100755 --- a/src/SPIN/pair_spin_soc_neel.h +++ b/src/SPIN/pair_spin_soc_neel.h @@ -39,8 +39,8 @@ class PairSpinSocNeel : public Pair { void write_restart_settings(FILE *); void read_restart_settings(FILE *); - void compute_soc_neel(int, int, double, double eij[3], double fmi[3], double spi[3], double spj[3]); - void compute_soc_mech_neel(int, int, double, double eij[3], double fi[3], double spi[3], double spj[3]); + void compute_soc_neel(int, int, double, double [3], double [3], double [3], double [3]); + void compute_soc_mech_neel(int, int, double, double [3], double [3], double [3], double [3]); int soc_neel_flag; // soc neel flag int soc_mech_flag; // mech calculation flag