Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:tutorials:nio_crystal_field:temperature [2016/10/08 19:12] – created Maurits W. Haverkortdocumentation:tutorials:nio_crystal_field:temperature [2016/10/10 09:41] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +{{indexmenu_n>4}}
 +====== Temperature ======
  
 +###
 +The effect of temperature can be added by calculating excited states and expectation values of excited states. The temperature dependent expectation value is then created using Boltzmann statistics.
 +###
 +
 +###
 +A small example:
 +<code Quanty Temperature.Quanty>
 +-- Sofar we calculated eigenstates and expectation values (or spectra) of these
 +-- eigenstates. At 0 K one would measure the expectation value of the lowest eigenstate
 +-- at finite temperature one would measure an average over several states weighted by
 +-- Boltzmann statistics. In this example we calculate the temperature dependent 
 +-- x-ray absorption spectra of NiO. (Ni L23 edge 2p to 3d)
 +
 +-- we set the verbosity to 0 in order to minimize the output
 +Verbosity(0)
 +
 +-- the beginning of this file is the same as example 21 where x-ray absorption is calculated
 +
 +-- In order to do crystal-field theory for NiO we need to define a Ni d-shell.
 +-- A d-shell has 10 elements and we label again the even spin-orbitals to be spin down
 +-- and the odd spin-orbitals to be spin up. In order to calculate 2p to 3d excitations we
 +-- also need a Ni 2p shell. We thus have a total of 10+6=16 fermions, 6 Ni-2p and 10 Ni-3d
 +-- spin-orbitals
 +NF=16
 +NB=0
 +IndexDn_2p={0,2,4}
 +IndexUp_2p={1,3,5}
 +IndexDn_3d={6,8,10,12,14}
 +IndexUp_3d={7,9,11,13,15}
 +
 +-- just like in the previous example we define several operators acting on the Ni -3d shell
 +
 +OppSx   =NewOperator("Sx"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppSy   =NewOperator("Sy"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppSz   =NewOperator("Sz"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppSsqr =NewOperator("Ssqr" ,NF, IndexUp_3d, IndexDn_3d)
 +OppSplus=NewOperator("Splus",NF, IndexUp_3d, IndexDn_3d)
 +OppSmin =NewOperator("Smin" ,NF, IndexUp_3d, IndexDn_3d)
 +
 +OppLx   =NewOperator("Lx"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppLy   =NewOperator("Ly"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppLz   =NewOperator("Lz"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppLsqr =NewOperator("Lsqr" ,NF, IndexUp_3d, IndexDn_3d)
 +OppLplus=NewOperator("Lplus",NF, IndexUp_3d, IndexDn_3d)
 +OppLmin =NewOperator("Lmin" ,NF, IndexUp_3d, IndexDn_3d)
 +
 +OppJx   =NewOperator("Jx"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppJy   =NewOperator("Jy"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppJz   =NewOperator("Jz"   ,NF, IndexUp_3d, IndexDn_3d)
 +OppJsqr =NewOperator("Jsqr" ,NF, IndexUp_3d, IndexDn_3d)
 +OppJplus=NewOperator("Jplus",NF, IndexUp_3d, IndexDn_3d)
 +OppJmin =NewOperator("Jmin" ,NF, IndexUp_3d, IndexDn_3d)
 +
 +Oppldots=NewOperator("ldots",NF, IndexUp_3d, IndexDn_3d)
 +
 +-- as in the previous example we define the Coulomb interaction
 +
 +OppF0 =NewOperator("U", NF, IndexUp_3d, IndexDn_3d, {1,0,0})
 +OppF2 =NewOperator("U", NF, IndexUp_3d, IndexDn_3d, {0,1,0})
 +OppF4 =NewOperator("U", NF, IndexUp_3d, IndexDn_3d, {0,0,1})
 +
 +-- as in the previous example we define the crystal-field operator
 +
 +Akm = PotentialExpandedOnClm("Oh",2,{0.6,-0.4})
 +OpptenDq = NewOperator("CF", NF, IndexUp_3d, IndexDn_3d, Akm)
 +
 +-- and as in the previous example we define operators that count the number of eg and t2g
 +-- electrons
 +
 +Akm = PotentialExpandedOnClm("Oh",2,{1,0})
 +OppNeg = NewOperator("CF", NF, IndexUp_3d, IndexDn_3d, Akm)
 +Akm = PotentialExpandedOnClm("Oh",2,{0,1})
 +OppNt2g = NewOperator("CF", NF, IndexUp_3d, IndexDn_3d, Akm)
 +
 +-- new for core level spectroscopy are operators that define the interaction acting on the
 +-- Ni-2p shell. There is actually only one of these interactions, which is the Ni-2p
 +-- spin-orbit interaction
 +
 +Oppcldots= NewOperator("ldots", NF, IndexUp_2p, IndexDn_2p)
 +
 +-- we also need to define the Coulomb interaction between the Ni 2p- and Ni 3d-shell
 +-- Again the interaction (e^2/(|r_i-r_j|)) is expanded on spherical harmonics. For the interaction
 +-- between two shells we need to consider two cases. For the direct interaction a 2p electron
 +-- scatters of a 3d electron into a 2p and 3d electron. The radial integrals involve
 +-- the square of a 2p radial wave function at coordinate 1 and the square of a 3d radial
 +-- wave function at coordinate 2. The transfer of angular momentum can either be 0 or 2.
 +-- These processes are called direct and the resulting Slater integrals are F[0] and F[2].
 +-- The second proces involves a 2p electron scattering of a 3d electron into the 3d shell
 +-- and at the same time the 3d electron scattering into a 2p shell. These exchange processes
 +-- involve radial integrals over the product of a 2p and 3d radial wave function. The transfer
 +-- of angular momentum in this case can be 1 or 3 and the Slater integrals are called G1 and G3.
 +
 +-- In Quanty you can enter these processes by labeling 4 indices for the orbitals, once
 +-- the 2p shell with spin up, 2p shell with spin down, 3d shell with spin up and 3d shell with
 +-- spin down. Followed by the direct Slater integrals (F0 and F2) and the exchange Slater 
 +-- integrals (G1 and G3)
 +
 +-- Here we define the operators separately and later sum them with appropriate prefactors
 +
 +OppUpdF0 = NewOperator("U", NF, IndexUp_2p, IndexDn_2p, IndexUp_3d, IndexDn_3d, {1,0}, {0,0})
 +OppUpdF2 = NewOperator("U", NF, IndexUp_2p, IndexDn_2p, IndexUp_3d, IndexDn_3d, {0,1}, {0,0})
 +OppUpdG1 = NewOperator("U", NF, IndexUp_2p, IndexDn_2p, IndexUp_3d, IndexDn_3d, {0,0}, {1,0})
 +OppUpdG3 = NewOperator("U", NF, IndexUp_2p, IndexDn_2p, IndexUp_3d, IndexDn_3d, {0,0}, {0,1})
 +
 +-- next we define the dipole operator. The dipole operator is given as epsilon.r
 +-- with epsilon the polarization vector of the light and r the unit position vector
 +-- We can expand the position vector on (renormalized) spherical harmonics and use
 +-- the crystal-field operator to create the dipole operator. 
 +
 +-- x polarized light is defined as x = Cos[phi]Sin[theta] = sqrt(1/2) ( C_1^{(-1)} - C_1^{(1)})
 +Akm = {{1,-1,sqrt(1/2)},{1, 1,-sqrt(1/2)}}
 +TXASx = NewOperator("CF", NF, IndexUp_3d, IndexDn_3d, IndexUp_2p, IndexDn_2p, Akm)
 +-- x polarized light is defined as y = Sin[phi]Sin[theta] = sqrt(1/2) I ( C_1^{(-1)} + C_1^{(1)})
 +Akm = {{1,-1,sqrt(1/2)*I},{1, 1,sqrt(1/2)*I}}
 +TXASy = NewOperator("CF", NF, IndexUp_3d, IndexDn_3d, IndexUp_2p, IndexDn_2p, Akm)
 +-- z polarized light is defined as z = Cos[theta] = C_1^{(0)}
 +Akm = {{1,0,1}}
 +TXASz = NewOperator("CF", NF, IndexUp_3d, IndexDn_3d, IndexUp_2p, IndexDn_2p, Akm)
 +
 +-- besides linear polarized light one can define circular polarized light as the sum of 
 +-- x and y polarizations with complex prefactors
 +TXASr = sqrt(1/2)*(TXASx - I * TXASy)
 +TXASl =-sqrt(1/2)*(TXASx + I * TXASy)
 +
 +-- once all operators are defined we can set some parameter values.
 +
 +-- the value of U drops out of a crystal-field calculation as the total number of electrons
 +-- is always the same
 +U        0.000 
 +-- F2 and F4 are often referred to in the literature as J_{Hund}. They represent the energy
 +-- differences between different multiplets. Numerical values can be found in the back of
 +-- my PhD. thesis for example. http://arxiv.org/abs/cond-mat/0505214 
 +F2dd    = 11.142 
 +F4dd    =  6.874
 +-- F0 is not the same as U, although they are related. Unimportant in crystal-field theory
 +-- the difference between U and F0 is so important that I do include it here. (U=0 so F0 is not)
 +F0dd    = U+(F2dd+F4dd)*2/63
 +-- in crystal field theory U drops out of the equation, also true for the interaction between the 
 +-- Ni 2p and Ni 3d electrons
 +Upd      0.000 
 +-- The Slater integrals between the 2p and 3d shell, again the numerical values can be found
 +-- in the back of my PhD. thesis. (http://arxiv.org/abs/cond-mat/0505214)
 +F2pd    =  6.667
 +G1pd    =  4.922
 +G3pd    =  2.796
 +-- F0 is not the same as U, although they are related. Unimportant in crystal-field theory
 +-- the difference between U and F0 is so important that I do include it here. (U=0 so F0 is not)
 +F0pd    =  Upd + G1pd*1/15 + G3pd*3/70
 +-- tenDq in NiO is 1.1 eV as can be seen in optics or using IXS to measure d-d excitations
 +tenDq    1.100
 +-- the Ni 3d spin-orbit is small but finite
 +zeta_3d =  0.081
 +-- the Ni 2p spin-orbit is very large and should not be scaled as theory is quite accurate here
 +zeta_2p = 11.498
 +-- we can add a small magnetic field, just to get nice expectation values. (units in eV... )
 +
 +-- we define a magnetic field in units of tesla EnergyUnits.Tesla.value is a constant
 +-- expressing Tesla in units of eV
 +B =  10*EnergyUnits.Tesla.value
 +
 +-- once all parameters are set we can define the Hamiltonian for both the ground-state
 +-- and the excited state as a sum of operators multiplied with the numerical interaction strength
 +Hamiltonian =  F0dd*OppF0 + F2dd*OppF2 + F4dd*OppF4 + tenDq*OpptenDq + zeta_3d*Oppldots + B*(2*OppSz + OppLz)
 +XASHamiltonian = Hamiltonian + zeta_2p * Oppcldots + F2pd * OppUpdF2 + G1pd * OppUpdG1 + G3pd * OppUpdG3
 +
 +-- we set restrictions to have 6 electrons in the p-shell and 8 electrons in the d-shell
 +StartRestrictions = {NF, NB, {"111111 0000000000",6,6}, {"000000 1111111111",8,8}}
 +-- and we calculate all 45 eigenstates
 +Npsi=45
 +psiList = Eigensystem(Hamiltonian, StartRestrictions, Npsi)
 +
 +-- Boltzmann statistics contains the exponent of the eigen energy. In order to prevent
 +-- number overflow we set later the ground-state energy to zero. Here we calculate
 +-- the ground state energy
 +Egrd = psiList[1] * Hamiltonian * psiList[1]
 +
 +-- In order to get some information on these eigenstates it is good to plot expectation values
 +-- We first define a list of all the operators we would like to calculate the expectation value of
 +oppList={Hamiltonian, OppSsqr, OppLsqr, OppJsqr, OppSz, OppLz, Oppldots, OppF2, OppF4, OppNeg, OppNt2g};
 +
 +-- next we loop over all operators and all states and print the expectation value
 +print(" <E>    <S^2>  <L^2>  <J^2>  <S_z>  <L_z>  <l.s>  <F[2]> <F[4]> <Neg>  <Nt2g>");
 +for i = 1,#psiList do
 +  for j = 1,#oppList do
 +    expectationvalue = Chop(psiList[i]*oppList[j]*psiList[i])
 +    io.write(string.format("%6.3f ",expectationvalue))
 +  end
 +  io.write("\n")
 +end
 +
 +-- now we can calculate temperature averaged expectation values
 +-- The temperature we will take here is 10 Kelvin (again we enter it in units of eV)
 +T = 10 * EnergyUnits.Kelvin.value
 +
 +-- we will calculate the partition function Z
 +Z=0
 +-- the total magnetic moment M
 +M=0
 +-- the total spin moment MS
 +MS=0
 +-- the total angular moment ML
 +ML=0
 +-- and temperature averaged spectra for z, r and l polarized light.
 +Spectra_z=0
 +Spectra_r=0
 +Spectra_l=0
 +-- the temperature averaged spectra are calculated as sums over the different states
 +-- weighted by the Boltzmann occupation. In order to make these sums we set them first to
 +-- zero (done above)
 +
 +-- and now we can make the sums
 +for j=1, 3 do
 +  Z  = Z  + exp(-(psiList[j] * Hamiltonian * psiList[j] - Egrd)/T)
 +  M  = M  + psiList[j] * (2 * OppSz + OppLz) * psiList[j] * exp(-(psiList[j] * Hamiltonian * psiList[j] - Egrd)/T)
 +  MS = MS + psiList[j] * (OppSz)             * psiList[j] * exp(-(psiList[j] * Hamiltonian * psiList[j] - Egrd)/T)
 +  ML = ML + psiList[j] * (OppLz)             * psiList[j] * exp(-(psiList[j] * Hamiltonian * psiList[j] - Egrd)/T)
 +  Spectra_z = Spectra_z + CreateSpectra(XASHamiltonian, TXASz,psiList[j], {{"Emin",-10}, {"Emax",20}, {"NE",3500}, {"Gamma",1.0}}) * exp(-(psiList[j] * Hamiltonian * psiList[j] - Egrd)/T)
 +  Spectra_r = Spectra_r + CreateSpectra(XASHamiltonian, TXASr,psiList[j], {{"Emin",-10}, {"Emax",20}, {"NE",3500}, {"Gamma",1.0}}) * exp(-(psiList[j] * Hamiltonian * psiList[j] - Egrd)/T)
 +  Spectra_l = Spectra_l + CreateSpectra(XASHamiltonian, TXASl,psiList[j], {{"Emin",-10}, {"Emax",20}, {"NE",3500}, {"Gamma",1.0}}) * exp(-(psiList[j] * Hamiltonian * psiList[j] - Egrd)/T)
 +end
 +-- In order to normalize we should device by the partition function Z
 +M  = M  / Z
 +MS = MS / Z
 +ML = ML / Z
 +Spectra_z = Spectra_z/Z
 +Spectra_r = Spectra_r/Z
 +Spectra_l = Spectra_l/Z
 +
 +-- and we can print the results to the screen
 +print("For a magnetic field of ",B/EnergyUnits.Tesla.value,"Tesla")
 +print("At temperature ",T/EnergyUnits.Kelvin.value," Kelvin the magnetic moment is",M)
 +print("The spin contribution is",MS)
 +print("The angular contribution is",ML)
 +
 +-- we can calculate the isotropic spectra and the magnetic circular dichroism
 +Spectra_iso  = (Spectra_z + Spectra_l + Spectra_r)/3
 +Spectra_XMCD = (Spectra_r - Spectra_l)
 +
 +-- and print them to file
 +Spectra_iso.Print({{"file", "TemperatureXASSpecIso.dat"}});
 +Spectra_XMCD.Print({{"file", "TemperatureXASSpecXMCD.dat"}});
 +
 +-- from here on you can use your favorite program to plot these spectra
 +-- I include a gnuplot script to make these plots
 +
 +-- a gnuplot script to make the plots
 +gnuplotInput = [[
 +set autoscale 
 +set xtic auto
 +set ytic auto 
 +set style line  1 lt 1 lw 1 lc rgb "#FF0000"
 +set style line  2 lt 1 lw 1 lc rgb "#0000FF"
 +
 +set xlabel "E (eV)" font "Times,12"
 +set ylabel "Intensity (arb. units)" font "Times,12"
 +
 +set out 'Temperature.ps'
 +set size 1.0, 1.0
 +set terminal postscript portrait enhanced color  "Times" 8
 +
 +plot "TemperatureXASSpecIso.dat"  u 1:(-$3) title 'Iso ' with lines ls  1,\
 +     "TemperatureXASSpecXMCD.dat" u 1:(-$3) title 'XMCD' with lines ls  2
 +
 +]]
 +
 +-- write the gnuplot script to a file
 +file = io.open("Temperature.gnuplot", "w")
 +file:write(gnuplotInput)
 +file:close()
 +
 +-- call gnuplot to execute the script
 +os.execute("gnuplot Temperature.gnuplot ")
 +-- change the postscript file to pdf or eps
 +os.execute("ps2pdf Temperature.ps ; ps2eps Temperature.ps ; mv Temperature.eps temp.eps ; eps2eps temp.eps Temperature.eps ; rm temp.eps")
 +</code>
 +###
 +
 +###
 +The output is:
 +<file Quanty_Output Temperature.out>
 + <E>    <S^2>  <L^2>  <J^2>  <S_z>  <L_z>  <l.s>  <F[2]> <F[4]> <Neg>  <Nt2g>
 +-2.722  1.999 12.000 15.127 -0.994 -0.290 -0.326 -1.020 -0.878  2.011  5.989 
 +-2.721  1.999 12.000 15.120 -0.000 -0.004 -0.324 -1.020 -0.878  2.011  5.989 
 +-2.720  1.999 12.000 15.113  0.994  0.281 -0.323 -1.020 -0.878  2.010  5.990 
 +-1.655  1.989 11.989 16.760 -0.178 -0.160 -0.859 -1.019 -0.877  3.008  4.992 
 +-1.655  1.989 11.988 16.766 -0.010  0.003 -0.861 -1.019 -0.877  3.008  4.992 
 +-1.637  1.999 12.000 15.802 -0.496 -0.052 -0.477 -1.020 -0.878  3.007  4.993 
 +-1.637  1.999 12.000 15.815  0.178  0.148 -0.482 -1.020 -0.878  3.007  4.993 
 +-1.636  1.999 12.000 15.815  0.482  0.062 -0.481 -1.020 -0.878  3.007  4.993 
 +-1.587  1.997 11.989 12.560 -0.488 -0.151  0.266 -1.020 -0.877  2.996  5.004 
 +-1.587  1.997 11.989 12.563 -0.060  0.006  0.265 -1.020 -0.877  2.996  5.004 
 +-1.586  1.997 11.989 12.566  0.503  0.139  0.264 -1.020 -0.877  2.996  5.004 
 +-1.567  2.000 12.000 12.000  0.070 -0.015  0.500 -1.020 -0.878  3.000  5.000 
 +-0.956  1.995 11.496 18.956 -0.036 -0.038 -1.473 -1.004 -0.886  3.588  4.412 
 +-0.890  1.999 11.439 15.343 -0.498  0.859 -0.513 -1.003 -0.887  3.573  4.427 
 +-0.890  1.999 11.439 15.351  0.025  0.039 -0.515 -1.003 -0.887  3.573  4.427 
 +-0.890  1.999 11.440 15.357  0.480 -0.877 -0.516 -1.003 -0.887  3.573  4.427 
 +-0.809  1.764 10.850  9.064 -0.014  0.026  0.004 -0.984 -0.879  3.367  4.633 
 +-0.809  1.764 10.850  9.065  0.012  0.010  0.003 -0.984 -0.879  3.367  4.633 
 +-0.782  1.997 11.307  9.989 -0.482  0.501  0.789 -0.999 -0.889  3.550  4.450 
 +-0.782  1.997 11.307  9.985  0.014 -0.019  0.790 -0.999 -0.889  3.550  4.450 
 +-0.782  1.997 11.308  9.981  0.500 -0.473  0.791 -0.999 -0.889  3.550  4.450 
 +-0.490  0.251  9.749  9.156  0.000 -0.004  1.055 -0.900 -0.806  2.269  5.731 
 +-0.490  0.251  9.749  9.156  0.000 -0.001  1.055 -0.900 -0.806  2.269  5.731 
 + 0.464  0.138  7.384  7.649 -0.033 -0.555 -0.681 -0.889 -0.803  3.132  4.868 
 + 0.464  0.137  7.388  7.653 -0.000  0.004 -0.680 -0.889 -0.803  3.132  4.868 
 + 0.465  0.137  7.393  7.657  0.033  0.553 -0.680 -0.889 -0.803  3.132  4.868 
 + 0.822  0.030 18.844 18.867 -0.000 -0.016  0.039 -0.767 -0.843  2.422  5.578 
 + 0.939  1.992  2.753  6.346 -0.109 -0.091 -0.310 -0.736 -1.035  3.441  4.559 
 + 0.939  1.992  2.751  6.345 -0.007  0.006 -0.313 -0.736 -1.035  3.441  4.559 
 + 0.966  1.865  3.179  6.537 -0.475 -0.392  0.365 -0.747 -1.019  3.426  4.574 
 + 0.967  1.866  3.177  6.537  0.109  0.092  0.361 -0.747 -1.019  3.426  4.574 
 + 0.967  1.866  3.178  6.537  0.458  0.407  0.362 -0.747 -1.019  3.425  4.575 
 + 1.001  1.994  2.614  2.880 -0.490 -0.433  0.413 -0.732 -1.038  3.417  4.583 
 + 1.002  1.994  2.613  2.879 -0.021  0.018  0.413 -0.732 -1.038  3.417  4.583 
 + 1.003  1.994  2.613  2.879  0.507  0.419  0.413 -0.732 -1.038  3.417  4.583 
 + 1.033  1.972  2.737  1.255  0.028 -0.024  0.745 -0.730 -1.037  3.398  4.602 
 + 1.280  0.008 19.948 19.962 -0.002 -0.501  0.081 -0.776 -0.855  3.003  4.997 
 + 1.280  0.008 19.948 19.961  0.000  0.007  0.081 -0.776 -0.855  3.003  4.997 
 + 1.281  0.008 19.948 19.961  0.002  0.497  0.081 -0.776 -0.855  3.003  4.997 
 + 2.042  0.004 16.663 16.669 -0.000 -0.059  0.115 -0.809 -0.836  3.915  4.085 
 + 2.042  0.004 16.662 16.669  0.000  0.011  0.115 -0.809 -0.836  3.915  4.085 
 + 2.118  0.004 18.133 18.138  0.000 -2.033  0.087 -0.794 -0.845  3.886  4.114 
 + 2.119  0.004 18.137 18.142  0.000  0.059  0.087 -0.794 -0.845  3.886  4.114 
 + 2.120  0.004 18.141 18.147 -0.000  2.039  0.086 -0.794 -0.845  3.886  4.114 
 + 5.964  0.003  0.923  0.920  0.000  0.000  0.190 -0.581 -0.585  3.592  4.408 
 +For a magnetic field of 10 Tesla
 +At temperature 10 Kelvin the magnetic moment is -1.7185713390306
 +The spin contribution is -0.74960257265827
 +The angular contribution is -0.21936619371406
 +</file>
 +###
 +
 +
 +===== Table of contents =====
 +{{indexmenu>.#1|msort}}
Print/export