Commit 392816a8 authored by julient31's avatar julient31
Browse files

Commit JT 042418

- adding the README
- some corrects pair_spin*.cpp/h
parent 1b8669c6
Loading
Loading
Loading
Loading
+5 −0
Changes for examples/SPIN/cobalt_fcc/exchange_fit_fcc_co/exchange_fcc_cobalt.dat: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
2.503 0.01476
3.54  0.001497
4.33  0.001578
5.01  -0.001224
5.597 0.000354
+32 −0
Changes for examples/SPIN/cobalt_fcc/exchange_fit_fcc_co/exchange_fit.py: 32 added lines, 0 removed lines.
Original line number Diff line number Diff line
#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")
+2 −0
Changes for examples/SPIN/iron/exchange_fit_bcc_iron/exchange_bcc_iron.dat: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
2.4824 0.01948336
2.8665 0.01109
4.0538 -0.0002176
4.753 -0.001714
4.965 -0.001986
+5 −5
Changes for examples/SPIN/nickel/exchange_fit_fcc_ni/exchange_fcc_ni.dat: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
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
+5 −0
Changes for examples/SPIN/nickel/exchange_fit_fcc_ni/exchange_fcc_ni2.dat: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
2.495 8.3
3.524 -3.99
4.31 0.998
4.99 -0.955
5.56 0.213
Loading