diff --git a/examples/SPIN/bfo/in.spin.bfo b/examples/SPIN/bfo/in.spin.bfo index 55cc53446d6e6cf191725ca29fa7b2663c6badcc..2442b12b72294d2b138831565a868a65c5395af5 100644 --- a/examples/SPIN/bfo/in.spin.bfo +++ b/examples/SPIN/bfo/in.spin.bfo @@ -21,9 +21,9 @@ mass 1 1.0 set group all spin/random 11 2.50 -pair_style hybrid/overlay spin/exchange 6.0 spin/me 4.5 +pair_style hybrid/overlay spin/exchange 6.0 spin/magelec 4.5 pair_coeff * * spin/exchange exchange 6.0 -0.01575 0.0 1.965 -pair_coeff * * spin/me me 4.5 0.000109 1.0 1.0 1.0 +pair_coeff * * spin/magelec magelec 4.5 0.000109 1.0 1.0 1.0 neighbor 0.1 bin neigh_modify every 10 check yes delay 20 @@ -51,4 +51,3 @@ 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 - diff --git a/examples/SPIN/cobalt_hcp/in.spin.cobalt_hcp b/examples/SPIN/cobalt_hcp/in.spin.cobalt_hcp index 127e24bf2b296ee9b3d3aa1138ee8de47a91202e..e712e511be48a40257ef59d9a762a4dc68e27327 100644 --- a/examples/SPIN/cobalt_hcp/in.spin.cobalt_hcp +++ b/examples/SPIN/cobalt_hcp/in.spin.cobalt_hcp @@ -28,13 +28,14 @@ pair_coeff * * eam/alloy ../examples/SPIN/cobalt_hcp/Co_PurjaPun_2012.eam.alloy pair_coeff * * spin/exchange exchange 4.0 0.3593 1.135028015e-05 1.064568567 #pair_coeff * * spin/neel neel 4.0 0.0048 0.234 1.168 2.6905 0.705 0.652 + 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 1 all precession/spin zeeman 1.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 diff --git a/src/SPIN/pair_spin.cpp b/src/SPIN/pair_spin.cpp index d0df3868df0ba61b5aab98dba6ac5f7938480729..e8a4c126dace98485c6bf8dc0f40d8abb992f871 100755 --- a/src/SPIN/pair_spin.cpp +++ b/src/SPIN/pair_spin.cpp @@ -41,10 +41,6 @@ #include "pair_hybrid.h" #include "pair_hybrid_overlay.h" #include "pair_spin.h" -#include "pair_spin_dmi.h" -#include "pair_spin_exchange.h" -#include "pair_spin_neel.h" -#include "pair_spin_me.h" #include "update.h" using namespace LAMMPS_NS; diff --git a/src/SPIN/pair_spin_exchange.cpp b/src/SPIN/pair_spin_exchange.cpp index 08476ccecd102d204145b2e40e52161c02684771..36708293f7568c22b143e721f893e6e6b7c171d8 100755 --- a/src/SPIN/pair_spin_exchange.cpp +++ b/src/SPIN/pair_spin_exchange.cpp @@ -173,8 +173,6 @@ void PairSpinExchange::init_style() } } - printf("test lattice flag: %d \n",lattice_flag); - } /* ---------------------------------------------------------------------- diff --git a/src/SPIN/pair_spin_me.cpp b/src/SPIN/pair_spin_magelec.cpp similarity index 85% rename from src/SPIN/pair_spin_me.cpp rename to src/SPIN/pair_spin_magelec.cpp index cbc8ae3cd14b04a01de7eced7907d3606cadea3c..a4a17bd1db28b385b6559c3ecdbe0bddd0a9164e 100755 --- a/src/SPIN/pair_spin_me.cpp +++ b/src/SPIN/pair_spin_magelec.cpp @@ -38,7 +38,7 @@ #include "math_const.h" #include "memory.h" #include "modify.h" -#include "pair_spin_me.h" +#include "pair_spin_magelec.h" #include "update.h" using namespace LAMMPS_NS; @@ -46,8 +46,9 @@ using namespace MathConst; /* ---------------------------------------------------------------------- */ -PairSpinMe::PairSpinMe(LAMMPS *lmp) : PairSpin(lmp) +PairSpinMagelec::PairSpinMagelec(LAMMPS *lmp) : PairSpin(lmp) { + hbar = force->hplanck/MY_2PI; single_enable = 0; no_virial_fdotr_compute = 1; lattice_flag = 0; @@ -55,11 +56,11 @@ PairSpinMe::PairSpinMe(LAMMPS *lmp) : PairSpin(lmp) /* ---------------------------------------------------------------------- */ -PairSpinMe::~PairSpinMe() +PairSpinMagelec::~PairSpinMagelec() { if (allocated) { memory->destroy(setflag); - memory->destroy(cut_spin_me); + memory->destroy(cut_spin_magelec); memory->destroy(ME); memory->destroy(ME_mech); memory->destroy(v_mex); @@ -73,7 +74,7 @@ PairSpinMe::~PairSpinMe() global settings ------------------------------------------------------------------------- */ -void PairSpinMe::settings(int narg, char **arg) +void PairSpinMagelec::settings(int narg, char **arg) { if (narg < 1 || narg > 2) error->all(FLERR,"Incorrect number of args in pair_style pair/spin command"); @@ -81,7 +82,7 @@ void PairSpinMe::settings(int narg, char **arg) if (strcmp(update->unit_style,"metal") != 0) error->all(FLERR,"Spin simulations require metal unit style"); - cut_spin_me_global = force->numeric(FLERR,arg[0]); + cut_spin_magelec_global = force->numeric(FLERR,arg[0]); // reset cutoffs that have been explicitly set @@ -90,7 +91,7 @@ void PairSpinMe::settings(int narg, char **arg) for (i = 1; i <= atom->ntypes; i++) for (j = i+1; j <= atom->ntypes; j++) if (setflag[i][j]) { - cut_spin_me[i][j] = cut_spin_me_global; + cut_spin_magelec[i][j] = cut_spin_magelec_global; } } @@ -100,20 +101,20 @@ void PairSpinMe::settings(int narg, char **arg) set coeffs for one or more type spin pairs (only one for now) ------------------------------------------------------------------------- */ -void PairSpinMe::coeff(int narg, char **arg) +void PairSpinMagelec::coeff(int narg, char **arg) { const double hbar = force->hplanck/MY_2PI; if (!allocated) allocate(); - if (strcmp(arg[2],"me")==0) { + if (strcmp(arg[2],"magelec")==0) { if (narg != 8) error->all(FLERR,"Incorrect args in pair_style command"); int ilo,ihi,jlo,jhi; force->bounds(FLERR,arg[0],atom->ntypes,ilo,ihi); 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])); + const double magelec = (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]); @@ -126,9 +127,9 @@ void PairSpinMe::coeff(int narg, char **arg) int count = 0; 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/hbar; - ME_mech[i][j] = me; + cut_spin_magelec[i][j] = rij; + ME[i][j] = magelec/hbar; + ME_mech[i][j] = magelec; v_mex[i][j] = mex; v_mey[i][j] = mey; v_mez[i][j] = mez; @@ -145,7 +146,7 @@ void PairSpinMe::coeff(int narg, char **arg) init specific to this pair style ------------------------------------------------------------------------- */ -void PairSpinMe::init_style() +void PairSpinMagelec::init_style() { if (!atom->sp_flag) error->all(FLERR,"Pair spin requires atom/spin style"); @@ -181,29 +182,29 @@ void PairSpinMe::init_style() init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ -double PairSpinMe::init_one(int i, int j) +double PairSpinMagelec::init_one(int i, int j) { if (setflag[i][j] == 0) error->all(FLERR,"All pair coeffs are not set"); - return cut_spin_me_global; + return cut_spin_magelec_global; } /* ---------------------------------------------------------------------- extract the larger cutoff ------------------------------------------------------------------------- */ -void *PairSpinMe::extract(const char *str, int &dim) +void *PairSpinMagelec::extract(const char *str, int &dim) { dim = 0; - if (strcmp(str,"cut") == 0) return (void *) &cut_spin_me_global; + if (strcmp(str,"cut") == 0) return (void *) &cut_spin_magelec_global; return NULL; } /* ---------------------------------------------------------------------- */ -void PairSpinMe::compute(int eflag, int vflag) +void PairSpinMagelec::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; double evdwl, ecoul; @@ -277,14 +278,14 @@ void PairSpinMe::compute(int eflag, int vflag) jtype = type[j]; - local_cut2 = cut_spin_me[itype][jtype]*cut_spin_me[itype][jtype]; + local_cut2 = cut_spin_magelec[itype][jtype]*cut_spin_magelec[itype][jtype]; // compute me interaction if (rsq <= local_cut2) { - compute_me(i,j,rsq,eij,fmi,spj); + compute_magelec(i,j,rsq,eij,fmi,spj); if (lattice_flag) { - compute_me_mech(i,j,fi,spi,spj); + compute_magelec_mech(i,j,fi,spi,spj); } } @@ -318,7 +319,7 @@ void PairSpinMe::compute(int eflag, int vflag) /* ---------------------------------------------------------------------- */ -void PairSpinMe::compute_single_pair(int ii, double fmi[3]) +void PairSpinMagelec::compute_single_pair(int ii, double fmi[3]) { int *type = atom->type; double **x = atom->x; @@ -354,7 +355,7 @@ void PairSpinMe::compute_single_pair(int ii, double fmi[3]) j = jlist[jj]; j &= NEIGHMASK; jtype = type[j]; - local_cut2 = cut_spin_me[itype][jtype]*cut_spin_me[itype][jtype]; + local_cut2 = cut_spin_magelec[itype][jtype]*cut_spin_magelec[itype][jtype]; spj[0] = sp[j][0]; spj[1] = sp[j][1]; @@ -370,7 +371,7 @@ void PairSpinMe::compute_single_pair(int ii, double fmi[3]) eij[2] = inorm*rij[2]; if (rsq <= local_cut2) { - compute_me(i,j,rsq,eij,fmi,spj); + compute_magelec(i,j,rsq,eij,fmi,spj); } } @@ -378,14 +379,14 @@ void PairSpinMe::compute_single_pair(int ii, double fmi[3]) /* ---------------------------------------------------------------------- */ -void PairSpinMe::compute_me(int i, int j, double rsq, double eij[3], double fmi[3], double spj[3]) +void PairSpinMagelec::compute_magelec(int i, int j, double rsq, double eij[3], double fmi[3], double spj[3]) { int *type = atom->type; int itype, jtype; itype = type[i]; jtype = type[j]; - double local_cut2 = cut_spin_me[itype][jtype]*cut_spin_me[itype][jtype]; + double local_cut2 = cut_spin_magelec[itype][jtype]*cut_spin_magelec[itype][jtype]; if (rsq <= local_cut2) { double meix,meiy,meiz; @@ -416,7 +417,7 @@ void PairSpinMe::compute_me(int i, int j, double rsq, double eij[3], double fmi[ /* ---------------------------------------------------------------------- */ -void PairSpinMe::compute_me_mech(int i, int j, double fi[3], double spi[3], double spj[3]) +void PairSpinMagelec::compute_magelec_mech(int i, int j, double fi[3], double spi[3], double spj[3]) { int *type = atom->type; int itype, jtype; @@ -448,7 +449,7 @@ void PairSpinMe::compute_me_mech(int i, int j, double fi[3], double spi[3], doub allocate all arrays ------------------------------------------------------------------------- */ -void PairSpinMe::allocate() +void PairSpinMagelec::allocate() { allocated = 1; int n = atom->ntypes; @@ -458,7 +459,7 @@ void PairSpinMe::allocate() for (int j = i; j <= n; j++) setflag[i][j] = 0; - memory->create(cut_spin_me,n+1,n+1,"pair/spin/me:cut_spin_me"); + memory->create(cut_spin_magelec,n+1,n+1,"pair/spin/me:cut_spin_magelec"); 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"); @@ -471,7 +472,7 @@ void PairSpinMe::allocate() proc 0 writes to restart file ------------------------------------------------------------------------- */ -void PairSpinMe::write_restart(FILE *fp) +void PairSpinMagelec::write_restart(FILE *fp) { write_restart_settings(fp); @@ -484,7 +485,7 @@ void PairSpinMe::write_restart(FILE *fp) fwrite(&v_mex[i][j],sizeof(double),1,fp); fwrite(&v_mey[i][j],sizeof(double),1,fp); fwrite(&v_mez[i][j],sizeof(double),1,fp); - fwrite(&cut_spin_me[i][j],sizeof(double),1,fp); + fwrite(&cut_spin_magelec[i][j],sizeof(double),1,fp); } } } @@ -493,7 +494,7 @@ void PairSpinMe::write_restart(FILE *fp) proc 0 reads from restart file, bcasts ------------------------------------------------------------------------- */ -void PairSpinMe::read_restart(FILE *fp) +void PairSpinMagelec::read_restart(FILE *fp) { read_restart_settings(fp); @@ -511,13 +512,13 @@ void PairSpinMe::read_restart(FILE *fp) fread(&v_mex[i][j],sizeof(double),1,fp); fread(&v_mey[i][j],sizeof(double),1,fp); fread(&v_mez[i][j],sizeof(double),1,fp); - fread(&cut_spin_me[i][j],sizeof(double),1,fp); + fread(&cut_spin_magelec[i][j],sizeof(double),1,fp); } MPI_Bcast(&ME[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_mex[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_mey[i][j],1,MPI_DOUBLE,0,world); MPI_Bcast(&v_mez[i][j],1,MPI_DOUBLE,0,world); - MPI_Bcast(&cut_spin_me[i][j],1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_spin_magelec[i][j],1,MPI_DOUBLE,0,world); } } } @@ -527,9 +528,9 @@ void PairSpinMe::read_restart(FILE *fp) proc 0 writes to restart file ------------------------------------------------------------------------- */ -void PairSpinMe::write_restart_settings(FILE *fp) +void PairSpinMagelec::write_restart_settings(FILE *fp) { - fwrite(&cut_spin_me_global,sizeof(double),1,fp); + fwrite(&cut_spin_magelec_global,sizeof(double),1,fp); fwrite(&offset_flag,sizeof(int),1,fp); fwrite(&mix_flag,sizeof(int),1,fp); } @@ -538,14 +539,14 @@ void PairSpinMe::write_restart_settings(FILE *fp) proc 0 reads from restart file, bcasts ------------------------------------------------------------------------- */ -void PairSpinMe::read_restart_settings(FILE *fp) +void PairSpinMagelec::read_restart_settings(FILE *fp) { if (comm->me == 0) { - fread(&cut_spin_me_global,sizeof(double),1,fp); + fread(&cut_spin_magelec_global,sizeof(double),1,fp); fread(&offset_flag,sizeof(int),1,fp); fread(&mix_flag,sizeof(int),1,fp); } - MPI_Bcast(&cut_spin_me_global,1,MPI_DOUBLE,0,world); + MPI_Bcast(&cut_spin_magelec_global,1,MPI_DOUBLE,0,world); MPI_Bcast(&offset_flag,1,MPI_INT,0,world); MPI_Bcast(&mix_flag,1,MPI_INT,0,world); } diff --git a/src/SPIN/pair_spin_me.h b/src/SPIN/pair_spin_magelec.h similarity index 73% rename from src/SPIN/pair_spin_me.h rename to src/SPIN/pair_spin_magelec.h index bfbfe213ad2c50084f16281ba4691aef9e773a50..bc1e3a6296b05434f26c095477209f6bcfa25a32 100755 --- a/src/SPIN/pair_spin_me.h +++ b/src/SPIN/pair_spin_magelec.h @@ -13,21 +13,21 @@ #ifdef PAIR_CLASS -PairStyle(spin/me,PairSpinMe) +PairStyle(spin/magelec,PairSpinMagelec) #else -#ifndef LMP_PAIR_SPIN_ME_H -#define LMP_PAIR_SPIN_ME_H +#ifndef LMP_PAIR_SPIN_MAGELEC_H +#define LMP_PAIR_SPIN_MAGELEC_H #include "pair_spin.h" namespace LAMMPS_NS { -class PairSpinMe : public PairSpin { +class PairSpinMagelec : public PairSpin { public: - PairSpinMe(class LAMMPS *); - virtual ~PairSpinMe(); + PairSpinMagelec(class LAMMPS *); + virtual ~PairSpinMagelec(); void settings(int, char **); void coeff(int, char **); void init_style(); @@ -37,20 +37,20 @@ class PairSpinMe : public PairSpin { void compute(int, int); void compute_single_pair(int, double *); - void compute_me(int, int, double, double *, double *, double *); - void compute_me_mech(int, int, double *, double *, double *); + void compute_magelec(int, int, double, double *, double *, double *); + void compute_magelec_mech(int, int, double *, double *, double *); void write_restart(FILE *); void read_restart(FILE *); void write_restart_settings(FILE *); void read_restart_settings(FILE *); - double cut_spin_me_global; // global me cutoff + double cut_spin_magelec_global; // global me cutoff protected: - double **ME, **ME_mech; // me coeff in eV - double **v_mex, **v_mey, **v_mez; // me direction - double **cut_spin_me; // me cutoff distance + double **ME, **ME_mech; // magelec coeff in eV + double **v_mex, **v_mey, **v_mez; // magelec direction + double **cut_spin_magelec; // magelec cutoff distance int lattice_flag; // flag for mech force computation class FixNVESpin *lockfixnvespin; // ptr to FixNVESpin for setups