Commit JT 011718

Correction bug in fix/integration/spin
This commit is contained in:
julient31 2018-01-17 14:24:34 -07:00
parent 5b93fc6a27
commit 3abb7f0eaf
3 changed files with 18 additions and 32 deletions

View File

@ -6,7 +6,7 @@ clear
units metal units metal
dimension 3 dimension 3
#boundary p p p #boundary p p p
boundary p p f boundary p p p
#newton off #newton off
@ -119,6 +119,6 @@ thermo_modify format float %20.15g
dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz
#Running the simulations for N timesteps #Running the simulations for N timesteps
run 10000 run 10
#run 10000 #run 10000

View File

@ -60,30 +60,7 @@ FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) :
lockpairspinexchange(NULL), lockpairspinsocneel(NULL), lockforcespin(NULL), lockpairspinexchange(NULL), lockpairspinsocneel(NULL), lockforcespin(NULL),
locklangevinspin(NULL) locklangevinspin(NULL)
{ {
//#define INIT1
#if defined INIT1
if (narg != 4) error->all(FLERR,"Illegal fix integration/spin command");
time_integrate = 1;
extra = NONE;
mpi_flag = NONE;
int iarg = 2;
if (strcmp(arg[iarg],"integration/spin") == 0) {
extra = SPIN;
if (strcmp(arg[iarg+1],"serial") == 0){
mpi_flag = 0;
} else if (strcmp(arg[iarg+1],"mpi") == 0) {
mpi_flag = 1;
} else error->all(FLERR,"Illegal fix integration/spin command");
} else error->all(FLERR,"Illegal fix integration/spin command");
#endif
#define INIT2
#if defined INIT2
if (narg < 4) error->all(FLERR,"Illegal fix/integration/spin command"); if (narg < 4) error->all(FLERR,"Illegal fix/integration/spin command");
time_integrate = 1; time_integrate = 1;
@ -97,6 +74,7 @@ FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) :
} else error->all(FLERR,"Illegal fix integration/spin command"); } else error->all(FLERR,"Illegal fix integration/spin command");
int iarg = 3; int iarg = 3;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"serial") == 0){ if (strcmp(arg[iarg],"serial") == 0){
mpi_flag = 0; mpi_flag = 0;
@ -113,12 +91,10 @@ FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) :
} else error->all(FLERR,"Illegal fix langevin command"); } else error->all(FLERR,"Illegal fix langevin command");
} }
#endif
if (extra == SPIN && !atom->mumag_flag) if (extra == SPIN && !atom->mumag_flag)
error->all(FLERR,"Fix integration/spin requires spin attribute mumag"); error->all(FLERR,"Fix integration/spin requires spin attribute mumag");
if (mpi_flag = NONE) if (mpi_flag == NONE)
error->all(FLERR,"Illegal fix/integration/spin command"); error->all(FLERR,"Illegal fix/integration/spin command");
magpair_flag = 0; magpair_flag = 0;
@ -231,15 +207,24 @@ void FixIntegrationSpin::init()
// perform the sectoring if mpi integration // perform the sectoring if mpi integration
if (mpi_flag) sectoring(); if (mpi_flag) {
sectoring();
// 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");
forward_stacks = memory->grow(forward_stacks,atom->nmax,"integration/spin:forward_stacks");
backward_stacks = memory->grow(backward_stacks,atom->nmax,"integration/spin:backward_stacks");
}
// grow tables of stacking variables // grow tables of stacking variables
/*
stack_head = memory->grow(stack_head,nsectors,"integration/spin:stack_head"); stack_head = memory->grow(stack_head,nsectors,"integration/spin:stack_head");
stack_foot = memory->grow(stack_foot,nsectors,"integration/spin:stack_foot"); stack_foot = memory->grow(stack_foot,nsectors,"integration/spin:stack_foot");
forward_stacks = memory->grow(forward_stacks,atom->nmax,"integration/spin:forward_stacks"); forward_stacks = memory->grow(forward_stacks,atom->nmax,"integration/spin:forward_stacks");
backward_stacks = memory->grow(backward_stacks,atom->nmax,"integration/spin:backward_stacks"); backward_stacks = memory->grow(backward_stacks,atom->nmax,"integration/spin:backward_stacks");
*/
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -44,7 +44,8 @@ class FixIntegrationSpin : public Fix {
void pre_neighbor(); void pre_neighbor();
protected: protected:
int extra, mpi_flag; int extra;
int mpi_flag; //mpi_flag = 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.