Commit JT 020618

- Documentation
- Memory leaks solved
This commit is contained in:
julient31 2018-02-06 10:42:22 -07:00
parent 642c8f9859
commit 6490ee46b7
11 changed files with 84 additions and 94 deletions

Binary file not shown.

View File

@ -0,0 +1,11 @@
\documentclass[preview]{standalone}
\usepackage{varwidth}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath,amssymb,amsthm,bm}
\begin{document}
\begin{varwidth}{50in}
\begin{equation}
\bm{H}_{aniso} = -\sum_{{ i}=1}^{N} K_{an}(\bm{r}_{i})\, \left( \vec{s}_{i} \cdot \vec{n}_{i} \right)^2, \nonumber
\end{equation}
\end{varwidth}
\end{document}

Binary file not shown.

View File

@ -0,0 +1,11 @@
\documentclass[preview]{standalone}
\usepackage{varwidth}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath,amssymb,amsthm,bm}
\begin{document}
\begin{varwidth}{50in}
\begin{equation}
\bm{H}_{zeeman} = -\mu_{B}\mu_0\sum_{i=0}^{N}g_{i} \vec{s}_{i} \cdot \vec{H}_{ext} \nonumber
\end{equation}
\end{varwidth}
\end{document}

View File

@ -20,14 +20,13 @@ style = {zeeman} or {aniso} :l
x y z = vector direction of the field
{aniso} args = K x y z
K = intensity of the magnetic anisotropy (in eV)
x y z = vector direction of the anisotropy
x y z = vector direction of the anisotropy :pre
:ule
[Examples:]
fix 1 all force/spin zeeman 0.1 0.0 0.0 1.0
fix 1 all force/spin aniso 0.001 0.0 0.0 1.0
fix 1 all force/spin aniso 0.001 0.0 0.0 1.0 :pre
[Description:]
@ -35,48 +34,40 @@ Impose a force torque to each magnetic spin in the group.
Style {zeeman} is used for the simulation of the interaction
between the magnetic spins in the defined group and an external
magnetic field.
magnetic field:
:c,image(Eqs/force_spin_zeeman.pdf)
with mu0 the vacuum permeability, muB the Bohr magneton (muB = 5.788 eV/T
in metal units),
Style {aniso} is used to simulate an easy axis or an easy plane
for the magnetic spins in the defined group.
If K>0, an easy axis is defined, and if K<0, an easy plane is
defined.
for the magnetic spins in the defined group:
In both cases, x y z impose is the vector direction for the force.
:c,image(Eqs/force_spin_aniso.pdf)
with n defining the direction of the anisotropy, and K (in eV) its intensity.
If K>0, an easy axis is defined, and if K<0, an easy plane is defined.
In both cases, the choice of (x y z) imposes the vector direction for the force.
Only the direction of the vector is important; it's length is ignored.
:line
[Restart, fix_modify, output, run start/stop, minimize info:]
No information about this fix is written to "binary restart
files"_restart.html.
The "fix_modify"_fix_modify.html {energy} option is supported by this
fix to add the gravitational potential energy of the system to the
system's potential energy as part of "thermodynamic
output"_thermo_style.html.
[Restrictions:]
The "fix_modify"_fix_modify.html {respa} option is supported by this
fix. This allows to set at which level of the "r-RESPA"_run_style.html
integrator the fix is adding its forces. Default is the outermost level.
This fix computes a global scalar which can be accessed by various
"output commands"_Section_howto.html#howto_15. This scalar is the
gravitational potential energy of the particles in the defined field,
namely mass * (g dot x) for each particles, where x and mass are the
particles position and mass, and g is the gravitational field. The
scalar value calculated by this fix is "extensive".
No parameter of this fix can be used with the {start/stop} keywords of
the "run"_run.html command. This fix is not invoked during "energy
minimization"_minimize.html.
[Restrictions:] none
The {force/spin} style is part of the SPIN package.
This style is only enabled if LAMMPS was built with this package, and
if the atom_style "spin" was declared.
See the "Making LAMMPS"_Section_start.html#start_3 section for more info.
[Related commands:]
"atom_style sphere"_atom_style.html, "fix addforce"_fix_addforce.html
"atom_style spin"_atom_style.html
[Default:] none

View File

@ -1,11 +1,3 @@
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "AMS"} } });
</script>
"LAMMPS WWW Site"_lws - "LAMMPS Documentation"_ld - "LAMMPS Commands"_lc :c
:link(lws,http://lammps.sandia.gov)
@ -33,7 +25,7 @@ pair_coeff 1 2 exchange 6.0 -0.01575 0.0 1.965 :pre
[Description:]
Style {pair/spin/exchange} computes the exchange interaction between
pairs of magnetic spins.
pairs of magnetic spins:
:c,image(Eqs/pair_spin_exchange_interaction.pdf)
@ -46,18 +38,15 @@ This function is defined as:
:c,image(Eqs/pair_spin_exchange_function.pdf)
where a, b and d are the three constants defined in the associated "pair_coeff"
command.
where a, b and d are the three constant coefficients defined in the associated
"pair_coeff" command.
More explanations the {pair/spin/exchange} and its parametrization are reported
The coefficients a, b, and c need to be fitted so that the function above matches with
the value of the exchange interaction for the N neighbor shells taken into account.
Examles and more explanations about this function and its parametrization are reported
in "(Tranchida)"_#Tranchida1.
The {lj/cut} and {lj/cut/coul/long} pair styles support the use of the
{inner}, {middle}, and {outer} keywords of the "run_style
respa"_run_style.html command, meaning the pairwise forces can be
:line
[Restrictions:]
@ -69,9 +58,8 @@ See the "Making LAMMPS"_Section_start.html#start_3 section for more info.
[Related commands:]
"eam"
"pair_coeff"_pair_coeff.html
"atom_style spin"_atom_style.html, "pair_coeff"_pair_coeff.html,
"pair_eam"_pair_eam.html,
[Default:] none

View File

@ -87,8 +87,8 @@ neigh_modify every 10 check yes delay 20
#fix 2 all langevin/spin 0.0 0.0 0.0 21
#Magnetic integration fix
#fix 3 all integration/spin mpi
fix 3 all integration/spin serial lattice yes
fix 3 all integration/spin lattice yes
#fix 3 all integration/spin lattice no
#compute real time, total magnetization, magnetic energy, and spin temperature
#Iteration | Time | Mx | My | Mz | |M| | Em | Tm
@ -120,5 +120,6 @@ thermo_modify format float %20.15g
dump 1 all custom 50 dump_cobalt.lammpstrj type x y z spx spy spz
#Running the simulations for N timesteps
run 1000
run 10
#run 1000

View File

@ -54,6 +54,7 @@ ComputeSpin::ComputeSpin(LAMMPS *lmp, int narg, char **arg) :
ComputeSpin::~ComputeSpin()
{
memory->destroy(vector);
}
/* ---------------------------------------------------------------------- */

View File

@ -73,16 +73,20 @@ FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) :
extra = SPIN;
} else error->all(FLERR,"Illegal fix integration/spin command");
int iarg = 3;
// defining mpi_flag
int nprocs_tmp = comm->nprocs;
if (nprocs_tmp == 1) {
mpi_flag = 0;
} else if (nprocs_tmp >= 1) {
mpi_flag = 1;
} else error->all(FLERR,"Illegal fix/integration/spin command");
// defining mech_flag
int iarg = 3;
while (iarg < narg) {
if (strcmp(arg[iarg],"serial") == 0){
mpi_flag = 0;
iarg += 1;
} else if (strcmp(arg[iarg],"mpi") == 0) {
mpi_flag = 1;
iarg += 1;
} else if (strcmp(arg[iarg],"lattice") == 0) {
if (strcmp(arg[iarg],"lattice") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal fix/integration/spin command");
if (strcmp(arg[iarg+1],"no") == 0) mech_flag = 0;
else if (strcmp(arg[iarg+1],"yes") == 0) mech_flag = 1;
@ -94,8 +98,8 @@ FixIntegrationSpin::FixIntegrationSpin(LAMMPS *lmp, int narg, char **arg) :
if (extra == SPIN && !atom->mumag_flag)
error->all(FLERR,"Fix integration/spin requires spin attribute mumag");
//if (mpi_flag == NONE)
// error->all(FLERR,"Illegal fix/integration/spin command");
if (mpi_flag == 0 && nprocs_tmp == 1)
error->all(FLERR,"Illegal fix/integration/spin command");
magpair_flag = 0;
exch_flag = 0;
@ -134,6 +138,7 @@ int FixIntegrationSpin::setmask()
void FixIntegrationSpin::init()
{
// set timesteps
dtv = update->dt;
@ -202,29 +207,20 @@ void FixIntegrationSpin::init()
if (locklangevinspin->temp_flag == 1) temp_flag = 1;
}
nsectors = 0;
memory->create(rsec,3,"integration/spin:rsec");
// perform the sectoring if mpi integration
if (mpi_flag) {
sectoring();
if (mpi_flag) sectoring();
// grow tables of stacking variables
// grow tables of stacking variables (mpi)
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
/*
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");
*/
}
/* ---------------------------------------------------------------------- */
@ -358,7 +354,7 @@ void FixIntegrationSpin::setup_pre_neighbor()
}
/* ----------------------------------------------------------------------
store in two linked lists the advance order of the spins
store in two linked lists the advance order of the spins (mpi)
---------------------------------------------------------------------- */
void FixIntegrationSpin::pre_neighbor()
@ -591,23 +587,9 @@ int FixIntegrationSpin::coords2sector(double *x)
sublo[dim]=sublotmp[dim];
}
//#define M1
#if defined M1
double rix = (x[0] - sublo[0])/rsec[0];
double riy = (x[1] - sublo[1])/rsec[1];
double riz = (x[2] - sublo[2])/rsec[2];
seci[0] = static_cast<int>(rix);
seci[1] = static_cast<int>(riy);
seci[2] = static_cast<int>(riz);
#endif
#define M2
#if defined M2
seci[0] = x[0] > (sublo[0] + rsec[0]);
seci[1] = x[1] > (sublo[1] + rsec[1]);
seci[2] = x[2] > (sublo[2] + rsec[2]);
#endif
nseci = (seci[0] + 2*seci[1] + 4*seci[2]);

View File

@ -45,7 +45,8 @@ class FixIntegrationSpin : public Fix {
protected:
int extra;
int mpi_flag; //mpi_flag = if parallel algorithm
int mpi_flag; // mpi_flag = 0 if serial algorithm
// mpi_flag = 1 if parallel algorithm
int mech_flag; // mech_flag = 0 if spins only
// mech_flag = 1 if spin-lattice calc.

View File

@ -278,6 +278,10 @@ Atom::~Atom()
memory->destroy(tri);
memory->destroy(body);
memory->destroy(mumag);
memory->destroy(sp);
memory->destroy(fm);
memory->destroy(vfrac);
memory->destroy(s0);
memory->destroy(x0);