First commit for the SPIN package.

Changes to come:
-Exchange interaction computation to check (loop on neighbors),
-Temperature/random fluctuations to correct (effects too strong),
-Physical results to check,
-Add final interactions (DMI, ME, Dipolar),
-Compute spin temperature (Nurdin and Ma formslisms),
-Work on MPI parallelization,
-Ewald sums to implement (see with Stan's pakage),
-See for prefered magnetic axis (Mitchell's idea),
This commit is contained in:
julient31
2017-05-12 11:43:30 -06:00
parent d5ec76290b
commit 9b0f8a0c55
18 changed files with 2801 additions and 14 deletions

View File

@ -41,6 +41,7 @@ enum{ID,MOL,PROC,PROCP1,TYPE,ELEMENT,MASS,
IX,IY,IZ,
VX,VY,VZ,FX,FY,FZ,
Q,MUX,MUY,MUZ,MU,RADIUS,DIAMETER,
MUMAG,SPX,SPY,SPZ,SP,
OMEGAX,OMEGAY,OMEGAZ,ANGMOMX,ANGMOMY,ANGMOMZ,
TQX,TQY,TQZ,
COMPUTE,FIX,VARIABLE,INAME,DNAME};
@ -83,8 +84,8 @@ DumpCustom::DumpCustom(LAMMPS *lmp, int narg, char **arg) :
pack_choice = new FnPtrPack[nfield];
vtype = new int[nfield];
memory->create(field2index,nfield,"dump:field2index");
memory->create(argindex,nfield,"dump:argindex");
field2index = new int[nfield];
argindex = new int[nfield];
buffer_allow = 1;
buffer_flag = 1;
@ -201,8 +202,8 @@ DumpCustom::~DumpCustom()
delete [] pack_choice;
delete [] vtype;
memory->destroy(field2index);
memory->destroy(argindex);
delete [] field2index;
delete [] argindex;
delete [] idregion;
memory->destroy(thresh_array);
@ -245,15 +246,11 @@ DumpCustom::~DumpCustom()
for (int i = 1; i <= ntypes; i++) delete [] typenames[i];
delete [] typenames;
if(vformat) {
for (int i = 0; i < size_one; i++) delete [] vformat[i];
delete [] vformat;
}
for (int i = 0; i < size_one; i++) delete [] vformat[i];
delete [] vformat;
if(format_column_user) {
for (int i = 0; i < size_one; i++) delete [] format_column_user[i];
delete [] format_column_user;
}
for (int i = 0; i < size_one; i++) delete [] format_column_user[i];
delete [] format_column_user;
delete [] columns;
}
@ -857,6 +854,36 @@ int DumpCustom::count()
for (i = 0; i < nlocal; i++) dchoose[i] = 2.0*radius[i];
ptr = dchoose;
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) {
if (!atom->omega_flag)
error->all(FLERR,
@ -1285,6 +1312,35 @@ int DumpCustom::parse_fields(int narg, char **arg)
pack_choice[i] = &DumpCustom::pack_mu;
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) {
if (!atom->radius_flag)
error->all(FLERR,"Dumping an atom property that isn't allocated");
@ -1787,6 +1843,13 @@ int DumpCustom::modify_param(int narg, char **arg)
else if (strcmp(arg[1],"muy") == 0) thresh_array[nthresh] = MUY;
else if (strcmp(arg[1],"muz") == 0) thresh_array[nthresh] = MUZ;
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],"diameter") == 0) thresh_array[nthresh] = DIAMETER;
@ -2701,6 +2764,66 @@ 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)