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.8665 0.01109
|
||||
4.0538 -0.0002176
|
||||
4.753 -0.001714
|
||||
4.965 -0.001986
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
2.495 8.3
|
||||
3.524 -3.99
|
||||
4.31 0.998
|
||||
4.99 -0.955
|
||||
5.56 0.213
|
||||
2.492 0.0028027
|
||||
3.524 0.0000816
|
||||
4.316 0.0003537
|
||||
4.984 0.0001632
|
||||
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')
|
||||
|
||||
# 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')
|
||||
|
||||
# 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
|
||||
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.legend()
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
AtomStyle(spin,AtomVecSpin)
|
||||
|
|
|
@ -11,16 +11,6 @@
|
|||
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
|
||||
|
||||
ComputeStyle(compute/spin,ComputeSpin)
|
||||
|
|
|
@ -11,16 +11,6 @@
|
|||
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
|
||||
|
||||
FixStyle(langevin/spin,FixLangevinSpin)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "citeme.h"
|
||||
#include "error.h"
|
||||
#include "fix_precession_spin.h"
|
||||
#include "fix_nve_spin.h"
|
||||
|
@ -50,6 +51,16 @@ using namespace FixConst;
|
|||
using namespace MathConst;
|
||||
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};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
@ -60,7 +71,8 @@ FixNVESpin::FixNVESpin(LAMMPS *lmp, int narg, char **arg) :
|
|||
backward_stacks(NULL), forward_stacks(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");
|
||||
|
||||
time_integrate = 1;
|
||||
|
|
|
@ -11,16 +11,6 @@
|
|||
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
|
||||
|
||||
FixStyle(nve/spin,FixNVESpin)
|
||||
|
|
|
@ -11,16 +11,6 @@
|
|||
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
|
||||
|
||||
FixStyle(precession/spin,FixPrecessionSpin)
|
||||
|
|
|
@ -11,8 +11,12 @@
|
|||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef PAIR_CLASS
|
||||
|
||||
PairStyle(pair/spin,PairSpin)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef 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)
|
||||
{
|
||||
// const double hbar = force->hplanck/MY_2PI;
|
||||
|
||||
if (!allocated) allocate();
|
||||
|
||||
|
@ -130,15 +129,16 @@ void PairSpinDmi::coeff(int narg, char **arg)
|
|||
for (int j = MAX(jlo,i); j <= jhi; j++) {
|
||||
cut_spin_dmi[i][j] = rij;
|
||||
DM[i][j] = dm;
|
||||
v_dmx[i][j] = dmx;
|
||||
v_dmy[i][j] = dmy;
|
||||
v_dmz[i][j] = dmz;
|
||||
v_dmx[i][j] = dmx * dm;
|
||||
v_dmy[i][j] = dmy * dm;
|
||||
v_dmz[i][j] = dmz * dm;
|
||||
setflag[i][j] = 1;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count == 0)
|
||||
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
|
||||
------------------------------------------------------------------------- */
|
||||
|
@ -368,13 +367,16 @@ void PairSpinDmi::compute_dmi(int i, int j, double rsq, double fmi[3], double sp
|
|||
if (rsq <= local_cut2) {
|
||||
double dmix, dmiy, dmiz;
|
||||
|
||||
dmix = DM[itype][jtype] * v_dmx[itype][jtype];
|
||||
dmiy = DM[itype][jtype] * v_dmy[itype][jtype];
|
||||
dmiz = DM[itype][jtype] * v_dmz[itype][jtype];
|
||||
//dmix = DM[itype][jtype] * v_dmx[itype][jtype];
|
||||
//dmiy = DM[itype][jtype] * v_dmy[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[1] -= (spj[2]*dmix - spj[0]*dmiz);
|
||||
fmi[2] -= (spj[0]*dmiy - spj[1]*dmix);
|
||||
fmi[0] += (spj[1]*dmiz - spj[2]*dmiy);
|
||||
fmi[1] += (spj[2]*dmix - spj[0]*dmiz);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
allocate all arrays
|
||||
------------------------------------------------------------------------- */
|
||||
|
|
|
@ -11,16 +11,6 @@
|
|||
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
|
||||
|
||||
PairStyle(spin/dmi,PairSpinDmi)
|
||||
|
|
|
@ -11,16 +11,6 @@
|
|||
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
|
||||
|
||||
PairStyle(spin/exchange,PairSpinExchange)
|
||||
|
|
|
@ -11,16 +11,6 @@
|
|||
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
|
||||
|
||||
PairStyle(spin/me,PairSpinMe)
|
||||
|
|
|
@ -11,16 +11,6 @@
|
|||
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
|
||||
|
||||
PairStyle(spin/neel,PairSpinNeel)
|
||||
|
|
Loading…
Reference in New Issue