forked from lijiext/lammps
Commit JT 042418
- adding the README - some corrects pair_spin*.cpp/h
This commit is contained in:
parent
1b8669c620
commit
392816a807
|
@ -0,0 +1,5 @@
|
||||||
|
2.503 0.01476
|
||||||
|
3.54 0.001497
|
||||||
|
4.33 0.001578
|
||||||
|
5.01 -0.001224
|
||||||
|
5.597 0.000354
|
|
@ -0,0 +1,32 @@
|
||||||
|
#Program fitting the exchange interaction
|
||||||
|
#Model curve: Bethe-Slater function
|
||||||
|
import numpy as np, pylab, tkinter
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from scipy.optimize import curve_fit
|
||||||
|
from decimal import *
|
||||||
|
|
||||||
|
print("Loop begin")
|
||||||
|
|
||||||
|
#Definition of the Bethe-Slater function
|
||||||
|
def func(x,a,b,c):
|
||||||
|
return 4*a*((x/c)**2)*(1-b*(x/c)**2)*np.exp(-(x/c)**2)
|
||||||
|
|
||||||
|
#Exchange coeff table (data to fit)
|
||||||
|
rdata, Jdata = np.loadtxt('exchange_fcc_cobalt.dat', usecols=(0,1), unpack=True)
|
||||||
|
plt.plot(rdata, Jdata, 'b-', label='data')
|
||||||
|
|
||||||
|
#Perform the fit
|
||||||
|
popt, pcov = curve_fit(func, rdata, Jdata, bounds=(0, [500.,5.,5.]))
|
||||||
|
plt.plot(rdata, func(rdata, *popt), 'r--', label='fit')
|
||||||
|
|
||||||
|
#Print the fitted params
|
||||||
|
print("Parameters: a={:.10} (in meV), b={:.10} (adim), c={:.10} (in Ang)".format(*popt))
|
||||||
|
|
||||||
|
#Ploting the result
|
||||||
|
plt.xlabel('r_ij')
|
||||||
|
pylab.xlim([0,6.5])
|
||||||
|
plt.ylabel('J_ij')
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
print("Loop end")
|
|
@ -1,3 +1,5 @@
|
||||||
2.4824 0.01948336
|
2.4824 0.01948336
|
||||||
2.8665 0.01109
|
2.8665 0.01109
|
||||||
4.0538 -0.0002176
|
4.0538 -0.0002176
|
||||||
|
4.753 -0.001714
|
||||||
|
4.965 -0.001986
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
2.495 8.3
|
2.492 0.0028027
|
||||||
3.524 -3.99
|
3.524 0.0000816
|
||||||
4.31 0.998
|
4.316 0.0003537
|
||||||
4.99 -0.955
|
4.984 0.0001632
|
||||||
5.56 0.213
|
5.572 0.0000408
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
2.495 8.3
|
||||||
|
3.524 -3.99
|
||||||
|
4.31 0.998
|
||||||
|
4.99 -0.955
|
||||||
|
5.56 0.213
|
|
@ -16,7 +16,7 @@ rdata, Jdata = np.loadtxt('exchange_fcc_ni.dat', usecols=(0,1), unpack=True)
|
||||||
plt.plot(rdata, Jdata, 'b-', label='data')
|
plt.plot(rdata, Jdata, 'b-', label='data')
|
||||||
|
|
||||||
# perform the fit
|
# perform the fit
|
||||||
popt, pcov = curve_fit(func, rdata, Jdata, bounds=(0, [500.,5.,5.]))
|
popt, pcov = curve_fit(func, rdata, Jdata, bounds=([0.0,-1.0,0.0], [100.,5.,5.]))
|
||||||
plt.plot(rdata, func(rdata, *popt), 'r--', label='fit')
|
plt.plot(rdata, func(rdata, *popt), 'r--', label='fit')
|
||||||
|
|
||||||
# print the fitted parameters
|
# print the fitted parameters
|
||||||
|
@ -24,7 +24,8 @@ print("Parameters: a={:.10} (in meV), b={:.10} (adim), c={:.10} (in Ang)".format
|
||||||
|
|
||||||
# ploting the result
|
# ploting the result
|
||||||
plt.xlabel('r_ij')
|
plt.xlabel('r_ij')
|
||||||
pylab.xlim([0,6.5])
|
pylab.xlim([0.0,6.5])
|
||||||
|
#pylab.ylim([-2.0,10.0])
|
||||||
plt.ylabel('J_ij')
|
plt.ylabel('J_ij')
|
||||||
plt.legend()
|
plt.legend()
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
The SPIN package enables coupled spin dynamics and molecular
|
||||||
|
dynamics simulations.
|
||||||
|
|
||||||
|
The package provides the following features:
|
||||||
|
|
||||||
|
* defining a classical magnetic atomic spin associated to each magnetic
|
||||||
|
atom in the system
|
||||||
|
* integrating the equations of motion for the coupled spin-lattice system
|
||||||
|
* implementing magnetic pair interactions and magnetic forces
|
||||||
|
* thermostating and applying a transverse damping to the magnetic spins
|
||||||
|
* computing and outputing magnetic quantities
|
||||||
|
|
||||||
|
The different options provided by this package are explained in the
|
||||||
|
LAMMPS documentation.
|
||||||
|
|
||||||
|
Once you have successfully built LAMMPS with this package, you can test
|
||||||
|
it using one of the input files provided from the examples/SPIN dir:
|
||||||
|
|
||||||
|
./lmp_serial < lammps/examples/SPIN/cobalt_hcp/in.spin.cobalt_hcp
|
||||||
|
|
||||||
|
|
||||||
|
== Credits and license ==
|
||||||
|
|
||||||
|
The person who created this package is Julien Tranchida (jtranch at
|
||||||
|
sandia.gov). You can contact him if you have questions.
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef ATOM_CLASS
|
#ifdef ATOM_CLASS
|
||||||
|
|
||||||
AtomStyle(spin,AtomVecSpin)
|
AtomStyle(spin,AtomVecSpin)
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef COMPUTE_CLASS
|
#ifdef COMPUTE_CLASS
|
||||||
|
|
||||||
ComputeStyle(compute/spin,ComputeSpin)
|
ComputeStyle(compute/spin,ComputeSpin)
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
FixStyle(langevin/spin,FixLangevinSpin)
|
FixStyle(langevin/spin,FixLangevinSpin)
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "atom_vec.h"
|
#include "atom_vec.h"
|
||||||
|
#include "citeme.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "fix_precession_spin.h"
|
#include "fix_precession_spin.h"
|
||||||
#include "fix_nve_spin.h"
|
#include "fix_nve_spin.h"
|
||||||
|
@ -50,6 +51,16 @@ using namespace FixConst;
|
||||||
using namespace MathConst;
|
using namespace MathConst;
|
||||||
using namespace MathExtra;
|
using namespace MathExtra;
|
||||||
|
|
||||||
|
static const char cite_fix_nve_spin[] =
|
||||||
|
"fix nve/spin command:\n\n"
|
||||||
|
"@article{tranchida2018massively,\n"
|
||||||
|
"title={Massively parallel symplectic algorithm for coupled magnetic spin "
|
||||||
|
"dynamics and molecular dynamics},\n"
|
||||||
|
"author={Tranchida, J and Plimpton, SJ and Thibaudeau, P and Thompson, AP},\n"
|
||||||
|
"journal={arXiv preprint arXiv:1801.10233},\n"
|
||||||
|
"year={2018}\n"
|
||||||
|
"}\n\n";
|
||||||
|
|
||||||
enum{NONE};
|
enum{NONE};
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
@ -60,6 +71,7 @@ FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
|
||||||
backward_stacks(NULL), forward_stacks(NULL),
|
backward_stacks(NULL), forward_stacks(NULL),
|
||||||
pair(NULL), spin_pairs(NULL)
|
pair(NULL), spin_pairs(NULL)
|
||||||
{
|
{
|
||||||
|
if (lmp->citeme) lmp->citeme->add(cite_fix_nve_spin);
|
||||||
|
|
||||||
if (narg < 4) error->all(FLERR,"Illegal fix/NVE/spin command");
|
if (narg < 4) error->all(FLERR,"Illegal fix/NVE/spin command");
|
||||||
|
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
FixStyle(nve/spin,FixNVESpin)
|
FixStyle(nve/spin,FixNVESpin)
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
FixStyle(precession/spin,FixPrecessionSpin)
|
FixStyle(precession/spin,FixPrecessionSpin)
|
||||||
|
|
|
@ -11,8 +11,12 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef PAIR_CLASS
|
||||||
|
|
||||||
PairStyle(pair/spin,PairSpin)
|
PairStyle(pair/spin,PairSpin)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
#ifndef LMP_PAIR_SPIN_H
|
#ifndef LMP_PAIR_SPIN_H
|
||||||
#define LMP_PAIR_SPIN_H
|
#define LMP_PAIR_SPIN_H
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,6 @@ void PairSpinDmi::settings(int narg, char **arg)
|
||||||
|
|
||||||
void PairSpinDmi::coeff(int narg, char **arg)
|
void PairSpinDmi::coeff(int narg, char **arg)
|
||||||
{
|
{
|
||||||
// const double hbar = force->hplanck/MY_2PI;
|
|
||||||
|
|
||||||
if (!allocated) allocate();
|
if (!allocated) allocate();
|
||||||
|
|
||||||
|
@ -130,15 +129,16 @@ void PairSpinDmi::coeff(int narg, char **arg)
|
||||||
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
||||||
cut_spin_dmi[i][j] = rij;
|
cut_spin_dmi[i][j] = rij;
|
||||||
DM[i][j] = dm;
|
DM[i][j] = dm;
|
||||||
v_dmx[i][j] = dmx;
|
v_dmx[i][j] = dmx * dm;
|
||||||
v_dmy[i][j] = dmy;
|
v_dmy[i][j] = dmy * dm;
|
||||||
v_dmz[i][j] = dmz;
|
v_dmz[i][j] = dmz * dm;
|
||||||
setflag[i][j] = 1;
|
setflag[i][j] = 1;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
error->all(FLERR,"Incorrect args in pair_style command");
|
error->all(FLERR,"Incorrect args in pair_style command");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
@ -351,7 +351,6 @@ void PairSpinDmi::compute_single_pair(int ii, double fmi[3])
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
compute the dmi interaction between spin i and spin j
|
compute the dmi interaction between spin i and spin j
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
@ -368,13 +367,16 @@ void PairSpinDmi::compute_dmi(int i, int j, double rsq, double fmi[3], double sp
|
||||||
if (rsq <= local_cut2) {
|
if (rsq <= local_cut2) {
|
||||||
double dmix, dmiy, dmiz;
|
double dmix, dmiy, dmiz;
|
||||||
|
|
||||||
dmix = DM[itype][jtype] * v_dmx[itype][jtype];
|
//dmix = DM[itype][jtype] * v_dmx[itype][jtype];
|
||||||
dmiy = DM[itype][jtype] * v_dmy[itype][jtype];
|
//dmiy = DM[itype][jtype] * v_dmy[itype][jtype];
|
||||||
dmiz = DM[itype][jtype] * v_dmz[itype][jtype];
|
//dmiz = DM[itype][jtype] * v_dmz[itype][jtype];
|
||||||
|
dmix = v_dmx[itype][jtype];
|
||||||
|
dmiy = v_dmy[itype][jtype];
|
||||||
|
dmiz = v_dmz[itype][jtype];
|
||||||
|
|
||||||
fmi[0] -= (spj[1]*dmiz - spj[2]*dmiy);
|
fmi[0] += (spj[1]*dmiz - spj[2]*dmiy);
|
||||||
fmi[1] -= (spj[2]*dmix - spj[0]*dmiz);
|
fmi[1] += (spj[2]*dmix - spj[0]*dmiz);
|
||||||
fmi[2] -= (spj[0]*dmiy - spj[1]*dmix);
|
fmi[2] += (spj[0]*dmiy - spj[1]*dmix);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,7 +392,6 @@ void PairSpinDmi::compute_dmi_mech(int i, int j, double fi[3], double spi[3], do
|
||||||
fi[2] += 0.0;
|
fi[2] += 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
allocate all arrays
|
allocate all arrays
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef PAIR_CLASS
|
#ifdef PAIR_CLASS
|
||||||
|
|
||||||
PairStyle(spin/dmi,PairSpinDmi)
|
PairStyle(spin/dmi,PairSpinDmi)
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef PAIR_CLASS
|
#ifdef PAIR_CLASS
|
||||||
|
|
||||||
PairStyle(spin/exchange,PairSpinExchange)
|
PairStyle(spin/exchange,PairSpinExchange)
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef PAIR_CLASS
|
#ifdef PAIR_CLASS
|
||||||
|
|
||||||
PairStyle(spin/me,PairSpinMe)
|
PairStyle(spin/me,PairSpinMe)
|
||||||
|
|
|
@ -11,16 +11,6 @@
|
||||||
See the README file in the top-level LAMMPS directory.
|
See the README file in the top-level LAMMPS directory.
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------
|
|
||||||
Contributing authors: Julien Tranchida (SNL)
|
|
||||||
Aidan Thompson (SNL)
|
|
||||||
|
|
||||||
Please cite the related publication:
|
|
||||||
Tranchida, J., Plimpton, S. J., Thibaudeau, P., & Thompson, A. P. (2018).
|
|
||||||
Massively parallel symplectic algorithm for coupled magnetic spin dynamics
|
|
||||||
and molecular dynamics. arXiv preprint arXiv:1801.10233.
|
|
||||||
------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#ifdef PAIR_CLASS
|
#ifdef PAIR_CLASS
|
||||||
|
|
||||||
PairStyle(spin/neel,PairSpinNeel)
|
PairStyle(spin/neel,PairSpinNeel)
|
||||||
|
|
Loading…
Reference in New Issue