adding modifications for more than one fix langevin/spin in fix nve/spin
This commit is contained in:
@ -6,7 +6,7 @@ import matplotlib.pyplot as plt
|
||||
import mpmath as mp
|
||||
|
||||
hbar=0.658212 # Planck's constant (eV.fs/rad)
|
||||
# J0=0.05 # per-neighbor exchange interaction (eV)
|
||||
J0=0.05 # per-neighbor exchange interaction (eV)
|
||||
|
||||
# exchange interaction parameters
|
||||
J1 = 11.254 # in eV
|
||||
|
||||
@ -30,8 +30,8 @@ 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 2 all langevin 200.0 200.0 1.0 48279
|
||||
fix 3 all langevin/spin 0.0 0.00001 321
|
||||
fix 2 all langevin 200.0 200.0 0.1 48279
|
||||
fix 3 all langevin/spin 0.0 0.0 321
|
||||
fix 4 all nve/spin lattice moving
|
||||
timestep 0.001
|
||||
|
||||
|
||||
@ -21,16 +21,19 @@ mass 1 55.845
|
||||
set group all spin 2.2 0.0 0.0 1.0
|
||||
velocity all create 0 4928459 rot yes dist gaussian
|
||||
|
||||
pair_style hybrid/overlay eam/alloy spin/exchange 3.5
|
||||
# pair_style hybrid/overlay eam/alloy spin/exchange 3.5
|
||||
pair_style hybrid/overlay eam/alloy spin/exchange 4.0 spin/neel 4.0
|
||||
pair_coeff * * eam/alloy Fe_Mishin2006.eam.alloy Fe
|
||||
pair_coeff * * spin/exchange exchange 3.4 0.1 0.2171 1.841
|
||||
pair_coeff * * spin/neel neel 4.0 0.02 0.0 1.841 0.0 0.0 1.0
|
||||
|
||||
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 2 all langevin/spin 200.0 0.01 321
|
||||
fix 3 all nve/spin lattice moving
|
||||
fix 2 all langevin 0.0 0.0 0.0 48279
|
||||
fix 3 all langevin/spin 200.0 0.01 321
|
||||
fix 4 all nve/spin lattice moving
|
||||
timestep 0.001
|
||||
|
||||
# compute and output options
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
#include "fix_langevin_spin.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include "atom.h"
|
||||
#include "comm.h"
|
||||
#include "error.h"
|
||||
#include "force.h"
|
||||
@ -163,3 +164,14 @@ void FixLangevinSpin::add_temperature(double fmi[3])
|
||||
fmi[1] *= gil_factor;
|
||||
fmi[2] *= gil_factor;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void FixLangevinSpin::compute_single_langevin(int i, double spi[3], double fmi[3])
|
||||
{
|
||||
int *mask = atom->mask;
|
||||
if (mask[i] & groupbit) {
|
||||
if (tdamp_flag) add_tdamping(spi,fmi);
|
||||
if (temp_flag) add_temperature(fmi);
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ namespace LAMMPS_NS {
|
||||
|
||||
class FixLangevinSpin : public Fix {
|
||||
public:
|
||||
int tdamp_flag,ldamp_flag,temp_flag; // damping and temperature flags
|
||||
int tdamp_flag,temp_flag; // damping and temperature flags
|
||||
|
||||
FixLangevinSpin(class LAMMPS *, int, char **);
|
||||
virtual ~FixLangevinSpin();
|
||||
@ -35,6 +35,7 @@ class FixLangevinSpin : public Fix {
|
||||
void setup(int);
|
||||
void add_tdamping(double *, double *); // add transverse damping
|
||||
void add_temperature(double *); // add temperature
|
||||
void compute_single_langevin(int, double *, double *);
|
||||
|
||||
protected:
|
||||
double alpha_t; // transverse mag. damping
|
||||
|
||||
@ -60,7 +60,8 @@ enum{NONE};
|
||||
|
||||
FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
|
||||
Fix(lmp, narg, arg),
|
||||
pair(nullptr), spin_pairs(nullptr),
|
||||
pair(nullptr), spin_pairs(nullptr), locklangevinspin(nullptr),
|
||||
locksetforcespin(nullptr), lockprecessionspin(nullptr),
|
||||
rsec(nullptr), stack_head(nullptr), stack_foot(nullptr),
|
||||
backward_stacks(nullptr), forward_stacks(nullptr)
|
||||
{
|
||||
@ -76,7 +77,7 @@ FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
|
||||
npairspin = 0;
|
||||
|
||||
// test nprec
|
||||
nprecspin = 0;
|
||||
nprecspin = nlangspin = nsetspin = 0;
|
||||
|
||||
// checking if map array or hash is defined
|
||||
|
||||
@ -128,7 +129,6 @@ FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
|
||||
maglangevin_flag = 0;
|
||||
tdamp_flag = temp_flag = 0;
|
||||
setforce_spin_flag = 0;
|
||||
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -141,6 +141,8 @@ FixNVESpin::~FixNVESpin()
|
||||
memory->destroy(forward_stacks);
|
||||
memory->destroy(backward_stacks);
|
||||
delete [] spin_pairs;
|
||||
delete [] locklangevinspin;
|
||||
delete [] lockprecessionspin;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -261,19 +263,51 @@ void FixNVESpin::init()
|
||||
if (count2 != nprecspin)
|
||||
error->all(FLERR,"Incorrect number of fix precession/spin");
|
||||
|
||||
// ptrs on the FixLangevinSpin class
|
||||
|
||||
// set ptrs for fix langevin/spin styles
|
||||
|
||||
// loop 1: obtain # of fix langevin/spin styles
|
||||
|
||||
for (iforce = 0; iforce < modify->nfix; iforce++) {
|
||||
if (strstr(modify->fix[iforce]->style,"langevin/spin")) {
|
||||
maglangevin_flag = 1;
|
||||
locklangevinspin = (FixLangevinSpin *) modify->fix[iforce];
|
||||
nlangspin++;
|
||||
}
|
||||
}
|
||||
|
||||
// init length of vector of ptrs to precession/spin styles
|
||||
|
||||
if (maglangevin_flag) {
|
||||
if (locklangevinspin->tdamp_flag == 1) tdamp_flag = 1;
|
||||
if (locklangevinspin->temp_flag == 1) temp_flag = 1;
|
||||
if (nlangspin > 0) {
|
||||
locklangevinspin = new FixLangevinSpin*[nprecspin];
|
||||
}
|
||||
|
||||
// loop 2: fill vector with ptrs to precession/spin styles
|
||||
|
||||
count2 = 0;
|
||||
if (nlangspin > 0) {
|
||||
for (iforce = 0; iforce < modify->nfix; iforce++) {
|
||||
if (strstr(modify->fix[iforce]->style,"langevin/spin")) {
|
||||
maglangevin_flag = 1;
|
||||
locklangevinspin[count2] = (FixLangevinSpin *) modify->fix[iforce];
|
||||
count2++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count2 != nlangspin)
|
||||
error->all(FLERR,"Incorrect number of fix precession/spin");
|
||||
|
||||
// // ptrs on the FixLangevinSpin class
|
||||
|
||||
// for (iforce = 0; iforce < modify->nfix; iforce++) {
|
||||
// if (strstr(modify->fix[iforce]->style,"langevin/spin")) {
|
||||
// maglangevin_flag = 1;
|
||||
// locklangevinspin = (FixLangevinSpin *) modify->fix[iforce];
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (maglangevin_flag) {
|
||||
// if (locklangevinspin->tdamp_flag == 1) tdamp_flag = 1;
|
||||
// if (locklangevinspin->temp_flag == 1) temp_flag = 1;
|
||||
// }
|
||||
|
||||
// ptrs FixSetForceSpin classes
|
||||
|
||||
@ -515,12 +549,15 @@ void FixNVESpin::ComputeInteractionsSpin(int i)
|
||||
// update langevin damping and random force
|
||||
|
||||
if (maglangevin_flag) { // mag. langevin
|
||||
if (tdamp_flag) { // transverse damping
|
||||
locklangevinspin->add_tdamping(spi,fmi);
|
||||
}
|
||||
if (temp_flag) { // spin temperature
|
||||
locklangevinspin->add_temperature(fmi);
|
||||
for (int k = 0; k < nlangspin; k++) {
|
||||
locklangevinspin[k]->compute_single_langevin(i,spi,fmi);
|
||||
}
|
||||
// if (tdamp_flag) { // transverse damping
|
||||
// locklangevinspin->add_tdamping(spi,fmi);
|
||||
// }
|
||||
// if (temp_flag) { // spin temperature
|
||||
// locklangevinspin->add_temperature(fmi);
|
||||
// }
|
||||
}
|
||||
|
||||
// update setforce of magnetic interactions
|
||||
|
||||
@ -61,11 +61,15 @@ friend class PairSpin;
|
||||
int tdamp_flag, temp_flag;
|
||||
int setforce_spin_flag;
|
||||
|
||||
// pointers to magnetic fixes
|
||||
// pointers to fix langevin/spin styles
|
||||
|
||||
// class FixPrecessionSpin *lockprecessionspin;
|
||||
class FixLangevinSpin *locklangevinspin;
|
||||
class FixSetForceSpin *locksetforcespin;
|
||||
int nlangspin;
|
||||
class FixLangevinSpin **locklangevinspin;
|
||||
|
||||
// pointers to fix setforce/spin styles
|
||||
|
||||
int nsetspin;
|
||||
class FixSetForceSpin *locksetforcespin; // to be done
|
||||
|
||||
// pointers to fix precession/spin styles
|
||||
|
||||
|
||||
@ -433,7 +433,6 @@ void FixPrecessionSpin::compute_anisotropy(double spi[3], double fmi[3])
|
||||
fmi[0] += scalar*Kax;
|
||||
fmi[1] += scalar*Kay;
|
||||
fmi[2] += scalar*Kaz;
|
||||
// printf("fm pres1: %g %g %g \n",fmi[0],fmi[1],fmi[2]);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user