diff --git a/examples/SPIN/in.co_magnetomech b/examples/SPIN/in.co_magnetomech index 8b71e395ab..ee83b31e6f 100644 --- a/examples/SPIN/in.co_magnetomech +++ b/examples/SPIN/in.co_magnetomech @@ -83,7 +83,7 @@ fix 1 all force/spin zeeman 0.0 0.0 0.0 1.0 fix 2 all langevin/spin 0.0 0.0 0.0 21 #Magnetic integration fix -fix 3 all integration/spin serial +fix 3 all integration/spin mpi #compute real time, total magnetization, magnetic energy, and spin temperature #Iteration | Time | Mx | My | Mz | |M| | Em | Tm @@ -115,5 +115,5 @@ dump 1 all custom 500 dump_VSRSV.lammpstrj type x y z spx spy spz #Running the simulations for N timesteps run 10000 -#run 100 +#run 2 diff --git a/src/SPIN/atom_vec_spin.cpp b/src/SPIN/atom_vec_spin.cpp index ccdaa13829..214d7752b6 100644 --- a/src/SPIN/atom_vec_spin.cpp +++ b/src/SPIN/atom_vec_spin.cpp @@ -50,7 +50,8 @@ AtomVecSpin::AtomVecSpin(LAMMPS *lmp) : AtomVec(lmp) xcol_data = 4; forceclearflag = 1; - atom->mumag_flag = atom->sp_flag = 1; + atom->mumag_flag = 1; + atom->sp_flag = 1; } diff --git a/src/SPIN/fix_integration_spin.cpp b/src/SPIN/fix_integration_spin.cpp index 772e6dcdaf..9066f75aea 100644 --- a/src/SPIN/fix_integration_spin.cpp +++ b/src/SPIN/fix_integration_spin.cpp @@ -94,7 +94,8 @@ FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) : } /* ---------------------------------------------------------------------- */ -FixIntegrationSpin::~FixIntegrationSpin(){ +FixIntegrationSpin::~FixIntegrationSpin() +{ //delete lockpairspin; //delete lockforcespin; memory->destroy(xi); @@ -124,8 +125,6 @@ int FixIntegrationSpin::setmask() void FixIntegrationSpin::init() { - //FixNVE::init(); - // set timesteps dtv = update->dt; dtf = 0.5 * update->dt * force->ftm2v; @@ -181,11 +180,6 @@ void FixIntegrationSpin::init() } } - // set flags for the different magnetic interactions -// if (magpair_flag) { -// if (lockpairspinexchange->exch_flag == 1) exch_flag = 1; -// } - if (magforce_flag) { if (lockforcespin->zeeman_flag == 1) zeeman_flag = 1; if (lockforcespin->aniso_flag == 1) aniso_flag = 1; @@ -220,11 +214,6 @@ void FixIntegrationSpin::initial_integrate(int vflag) int *type = atom->type; int *mask = atom->mask; -//#define MAG_TEST -#if defined MAG_TEST - tagint *tag = atom->tag; -#endif - // advance spin-lattice system, vsrsv // update half v for all particles for (int i = 0; i < nlocal; i++) { @@ -234,22 +223,17 @@ void FixIntegrationSpin::initial_integrate(int vflag) v[i][0] += dtfm * f[i][0]; v[i][1] += dtfm * f[i][1]; v[i][2] += dtfm * f[i][2]; - } + } } +#define MPI_TEST + // update half s for all particles if (extra == SPIN) { if (mpi_flag == 1) { // mpi seq. update int nseci; for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal comm->forward_comm(); -#if defined MAG_TEST - if (j == 0) { - //for (int i = 0; i < nlocal; i++) { - printf("L1: test atom i=%d, tagi=%d \n",0,tag[0]); - //} - } -#endif for (int i = 0; i < nlocal; i++) { xi[0] = x[i][0]; xi[1] = x[i][1]; @@ -258,7 +242,10 @@ void FixIntegrationSpin::initial_integrate(int vflag) if (j != nseci) continue; ComputeInteractionsSpin(i); AdvanceSingleSpin(i,dts,sp,fm); - } + } + #if defined MPI_TEST + MPI_Barrier(world); + #endif } for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal comm->forward_comm(); @@ -271,6 +258,9 @@ void FixIntegrationSpin::initial_integrate(int vflag) ComputeInteractionsSpin(i); AdvanceSingleSpin(i,dts,sp,fm); } + #if defined MPI_TEST + MPI_Barrier(world); + #endif } } else if (mpi_flag == 0) { // serial seq. update comm->forward_comm(); // comm. positions of ghost atoms @@ -302,13 +292,6 @@ void FixIntegrationSpin::initial_integrate(int vflag) int nseci; for (int j = 0; j < nsectors; j++) { // advance quarter s for nlocal comm->forward_comm(); -#if defined MAG_TEST - if (j == 0) { - //for (int i = 0; i < nlocal; i++) { - printf("L2 test atom i=%d, tagi=%d \n",0,tag[0]); - //} - } -#endif for (int i = 0; i < nlocal; i++) { xi[0] = x[i][0]; xi[1] = x[i][1]; @@ -318,6 +301,9 @@ void FixIntegrationSpin::initial_integrate(int vflag) ComputeInteractionsSpin(i); AdvanceSingleSpin(i,dts,sp,fm); } + #if defined MPI_TEST + MPI_Barrier(world); + #endif } for (int j = nsectors-1; j >= 0; j--) { // advance quarter s for nlocal comm->forward_comm(); @@ -330,6 +316,9 @@ void FixIntegrationSpin::initial_integrate(int vflag) ComputeInteractionsSpin(i); AdvanceSingleSpin(i,dts,sp,fm); } + #if defined MPI_TEST + MPI_Barrier(world); + #endif } } else if (mpi_flag == 0) { // serial seq. update comm->forward_comm(); // comm. positions of ghost atoms @@ -363,12 +352,6 @@ void FixIntegrationSpin::ComputeInteractionsSpin(int ii) int *type = atom->type; const int newton_pair = force->newton_pair; -//#define SERIAL2 -#if defined SERIAL2 - int num_j; - tagint *tag = atom->tag; -#endif - // add test here if (exch_flag) { inum = lockpairspinexchange->list->inum; @@ -386,13 +369,6 @@ void FixIntegrationSpin::ComputeInteractionsSpin(int ii) int vflag = 0; int pair_compute_flag = 1; -//#define SERIAL1 -#if defined SERIAL1 - if (mpi_flag == 0) { - comm->forward_comm(); - } -#endif - // force computation for spin i i = ilist[ii]; @@ -416,17 +392,6 @@ void FixIntegrationSpin::ComputeInteractionsSpin(int ii) itype = type[ii]; jtype = type[j]; -#if defined SERIAL2 - if (mpi_flag == 0) { - if (j >= nlocal) { - num_j = atom->map(tag[j]); - sp[j][0] = sp[num_j][0]; - sp[j][1] = sp[num_j][1]; - sp[j][2] = sp[num_j][2]; - } - } -#endif - spj[0] = sp[j][0]; spj[1] = sp[j][1]; spj[2] = sp[j][2]; diff --git a/src/SPIN/fix_integration_spin.h b/src/SPIN/fix_integration_spin.h index 6da740447d..1156cc576f 100644 --- a/src/SPIN/fix_integration_spin.h +++ b/src/SPIN/fix_integration_spin.h @@ -45,7 +45,7 @@ class FixIntegrationSpin : public Fix { protected: int extra, mpi_flag; - // vel., force, and spin timesteps + // velocity, force, and spin timesteps double dtv,dtf,dts; // mag. interaction flags diff --git a/src/SPIN/fix_langevin_spin.cpp b/src/SPIN/fix_langevin_spin.cpp index 84b2581a3a..1af32ff5cb 100644 --- a/src/SPIN/fix_langevin_spin.cpp +++ b/src/SPIN/fix_langevin_spin.cpp @@ -220,8 +220,6 @@ void FixLangevinSpin::add_temperature(double *fmi) double rz = sigma*(-1.0+2.0*random->uniform()); #endif -// printf("test Gaussian vals: %g \n",rx); - // adding the random field fmi[0] += rx; fmi[1] += ry; diff --git a/src/SPIN/fix_langevin_spin.h b/src/SPIN/fix_langevin_spin.h index 0afcdfbbae..3690037225 100644 --- a/src/SPIN/fix_langevin_spin.h +++ b/src/SPIN/fix_langevin_spin.h @@ -33,11 +33,9 @@ class FixLangevinSpin : public Fix { void setup(int); // virtual void post_force(int); void post_force_respa(int, int, int); - // add transverse damping and temperature - void add_tdamping(double *, double *); - void add_temperature(double *); - // associated flags - int tdamp_flag, ldamp_flag, temp_flag; + void add_tdamping(double *, double *); // add transverse damping + void add_temperature(double *); // add temperature + int tdamp_flag, ldamp_flag, temp_flag; // damping and temperature flags protected: double *spi, *fmi;