Commit JT 042418
- adding the README - some corrects pair_spin*.cpp/h
This commit is contained in:
@ -0,0 +1,5 @@
|
||||
2.503 0.01476
|
||||
3.54 0.001497
|
||||
4.33 0.001578
|
||||
5.01 -0.001224
|
||||
5.597 0.000354
|
||||
32
examples/SPIN/cobalt_fcc/exchange_fit_fcc_co/exchange_fit.py
Normal file
32
examples/SPIN/cobalt_fcc/exchange_fit_fcc_co/exchange_fit.py
Normal file
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user