Python/Python 그래프

[Python] #7-2 Moment versus B/T Curve

큐뮤 2020. 2. 3. 19:20
 
"""
Created on Mon Feb  3 19:03:14 2020

@author: admin
"""

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_excel('C:\\Users\\admin\\Desktop\\MPMS 1.30\\#7-2(MT).xlsx')

#Constant define
J = 9/2   #Spin of Er3+
g = 2.0023    #electron spin
e = 1.60218*10**(-19)  #electron Charge (C)
h_bar = 1.0545718*10**(-34)    #Plank Constant (m^2 kg / s)
c = 299792458      #Speed of Light (m/s)
u = 1.660*10**(-27)     #Atom mass unit (kg)
N = 6.022*10**23    #Avogadro constant (1/mol)
mol = 167.259  #Er g/mol
k_B = 1.38064852*10**(-16)     #boltzmann constant (CGS) (erg/K)
#k_B = 1.38064852*10**(-23)     #boltzmann constant (MKS) (J/K)

u_B = 9.27400968*10**(-21)   #Bohr magneton of magnitude of the magnetic dipole moment (CGS) (erg/G)
#u_B = 9.27400968*10**(-23) #Bohr magneton (MKS) (J/T) (A*m^2)
mu = 1.2566370614359*10**(-3)   #magnetic permitibility (H/cm)
u_mo = J*g*u_B #magnetic momentom
mass = 1.0086 #g
Ermass = 0.044 #g
p = J*(J+1)*g #effective Bohr magneton

def B_J(x) :
#    Brillouin function
    return (2*J+1)/(2*J*np.tanh((2*J+1)*x/(2*J)))-1/(2*J*np.tanh(x/(2*J)))

#load of Data
T=df["Temperature (K) (ZFC)"]
M=df["Moment (emu) (ZFC)"] #CGS 단위
H=df["Magnetic Field (Oe) (ZFC)"] #H=muB
B=H/mu

T2=df["Temperature (K) (FC)"]
M2=df["Moment (emu) (FC)"] #CGS 단위
H2=df["Magnetic Field (Oe) (FC)"] #H=muB
B2=H2/mu

x1=u_mo*B/(k_B*T)
x2=u_mo*B2/(k_B*T2)


#y1=(3*k_B*T)/(p*u_B)**2/(N*0.044/167)
#y2=(3*k_B*T2)/(p*u_B)**2/(N*0.044/167)


y1 = M/(0.044)
y2 = M2/(0.044)
f1 = g*J*u_B*B_J(x1)*N*0.044/167
f2 = g*J*u_B*B_J(x2)*N*0.044/167

# Drawing
plt.plot(x1,y1,'r.',label='y1')
plt.plot(x2,y2,'b.',label='y2')
#plt.plot(x1,f1,'r*',label='f1')
#plt.plot(x1,f1,'b*',label='f2')

plt.xlabel('B/T')
plt.ylabel('Magnetic moment emu/mg')
plt.title('MPMs Data')
#plt.text(100, 0.002, r'S=9/2')

plt.grid(True)
plt.legend(loc='upper left')
plt.show()

Moment versus B/T curve of Ag:Er

 

#7-2번은 100Oe 에서 MT 측정이 되었는데, Billouoin function에 맞추어 그래프를 그렸으나

Fitting이 제대로 되지 않았다.

 

가해준 H field의 세기가 약해 Magnetic saturation이 이루어지지 않은것 같다.