Home‎ > ‎

MATLAB Programs from EELS in the Electron Microscope, 3rd Edition

Below is a summary of the various programs as described in Appendix B. Each program is presented with sample input values and the corresponding output including any generated plots.

Feedback is welcome. General feedback/enquiries can be sent to: r...@ualberta.ca

Matlab programming related questions/comments can be sent to: m...@gmail.com

The complete set of files can be downloaded at the bottom of this page.

Contents

B.1. First-Order Spectrometer Focusing

Prism

%Prism( u, eps1, eps2, K1, g, R, phi, v )
Prism(100,0,45,0.4,10,3,30,100);
-----------------Prism---------------

Object distance u : 100
Entrance tilt epsilon1 (deg): 0
Exit tilt epsilon2 (deg): 45
Fringing-field parameter K1 (e.g. 0 or 0.4): 0.4
Polepiece gap g : 10
Bend radius R : 3
Bend angle phi (deg) : 30
Image distance v : 100
Entrance-cone semi-angle = 1 mrad.

For v = 100
x  = 1.44479
x' = 0.0135669
y  = -6.5563
y' = -0.068742

For v = -6.49395
x  = 0
x' = 0.0135669
y  = 0.764315
y' = -0.068742

Return to top.

B.2. Cross Sections for Atomic Displacement and High-Angle Elastic scattering

Sigdis

%Sigdis(Z,A,Ed,E0)
Sigdis(6,12,10,200);
-------------Sigdis------------

sigdis: Atomic-displacement cross sections:
Atomic number Z : 6
Atomic weight A : 12
Surface or bulk displacement energy Ed(eV) : 10
Incident-electron energy E0(keV) : 200
Emax(eV) = 43.7334 eV, threshold = 52.006 keV
Emin(planar potential) = 20.9125 eV
Rutherford value (spherical escape potential)= 66.9327 barn
Rutherford value (planar escape potential)= 21.6523 barn
McKinley-Feshbach-Mott (spherical potential)= 54.101 barn
McKinley-Feshbach-Mott (planar potential) = 14.863 barn

SigADF

%SigADF(Z,A,qn,qx,E0)
SigADF(6,12,20,100,100);
------------SigADF-------------

SigADF: HAADF elastic cross sections
Atomic number Z : 6
Atomic weight A : 12
Minimum scattering angle(mrad) : 20
Maximum scattering angle(mrad) : 100
Incident-electron energy E0(keV) : 100

Lenz screening angle = 20.2314 mrad
WARNING: minimum angle < Lenz screening angle!
Rutherford cross section = 667435 barn
McKinley-Feshbach-Mott cross section = 667902 barn

Return to top.

B.3. Lenz-Model Elastic and Inelastic Cross Sections

LenzPlus

%LenzPlus(e0,e,z,beta,toli)
LenzPlus(100,40,6,10,1.5);
----------------LenzPlus-------------

Incident energy E0(keV) = 100
Ebar(eV) [0 -> 6.75*Z]: 40
atomic number Z = 6
collection semi-angle Beta(mrad) = 10
E0(keV), Ebar(eV), Z, BeTa(mrad) are: 100, 40, 6, 10

Theta0 = 2.0231E-002 rad 					 ThetaE = 2.1783E-004 rad
dSe/dOmega = 3.4137E-002 nm^2/sr 			 dSi/dOmega = 5.2233E-002 nm^2/sr
dSe/dBeta = 2.1452E+000 nm^2/rad 			 dSi/dBeta = 3.2823E+000 nm^2/rad
Sigma(elastic) = 1.3337E-005 nm^2 			 Sigma(inelastic) = 1.6835E-004 nm^2
F(elastic) = 1.9634E-001 					 F(inelastic) = 8.2043E-001 
total-inelastic/total-elastic ratio = 3.0209E+000 

t/lambda(inelastic): 1.5
t/lambda(beta)= 1.2306E+000

p(unscat) = 1.3580E-001 		 P(el) = 1.7146E-002 neglecting elastic broadening
p(inel) = 3.8792E-001 			 P(in+el) = 4.8977E-002 neglecting inelastic broadening
I0/I = 1.5295E-001 				 Ii/I = 4.3690E-001 neglecting angular broadening
ln(It/I0) = 1.3498E+000 without broadening

P(unscat) = 1.3580E-001 		 P(el only) = 1.4689E-002 with elastic broadening
P(inel only) = 3.2911E-001 		 P(in+el) = 3.5598E-002 with inelastic broadening
I0/I = 1.5049E-001 				 Ii/I = 3.6471E-001 with angular broadening
ln(It/I0) = 1.2306E+000 with angular broadening

Return to top.

B.4. Generation of a Plural-Scattering Distribution

SpecGen

%SpecGen(ep,wp,wz,ez,epc,a0,tol,nd,back,fback,cpe)
SpecGen(16.7,3.2,1,5,0.1,10000,1.5,1000,2,0.5,10);
   SpecGen(ep,wp,wz,ez,epc,a0,tol,nd,back,fback,cpe)
SpecGen: plasmon energy (eV) = 16.7
plasmon FWHM (eV) : 3.2
zero-loss FWHM (eV): 1
zero-loss offset from first channel (eV): 5
eV/channel: 0.1
zero-loss counts: 10000
t/lambda: 1.5
number of channels: 1000
instrumental background level (counts/channel): 2
instrumental noise/background (e.g. 0.1): 0.5
spectral counts per beam electron (e.g. 0.1): 10
-------------------------------

Return to top.

B.5. Fourier-Log Deconvolution

Flog

%SpecGen(ep,wp,wz,ez,epc,a0,tol,nd,back,fback,cpe)
SpecGen(20,2,3,6,0.1,10000,0.5,1000,20,0.1,0.1);

%Flog(infile,fwhm2)
Flog('SpecGen.psd',0);
   SpecGen(ep,wp,wz,ez,epc,a0,tol,nd,back,fback,cpe)
SpecGen: plasmon energy (eV) = 20
plasmon FWHM (eV) : 2
zero-loss FWHM (eV): 3
zero-loss offset from first channel (eV): 6
eV/channel: 0.1
zero-loss counts: 10000
t/lambda: 0.5
number of channels: 1000
instrumental background level (counts/channel): 20
instrumental noise/background (e.g. 0.1): 0.1
spectral counts per beam electron (e.g. 0.1): 0.1
-------------------------------

----------------Flog---------------

Name of input file = SpecGen.psd
Data file 'SpecGen.psd' is assumed to have 2 columns
NreaD,NZ,NSEP,BACK = 1000 60 117 21.92 
eV/channel = 0.1,  zero-loss intensity = 1.008e+005 
 FWHM = 30.14 channels. 
New FWHM (0 to keep same ZLP): 0

 

FlogS

%SpecGen(ep,wp,wz,ez,epc,a0,tol,nd,back,fback,cpe)
SpecGen(20,2,3,6,0.1,10000,5.0,5000,20,0.1,0.1);

%FlogS(infile,fwhm2)
FlogS('SpecGen.psd',0);
   SpecGen(ep,wp,wz,ez,epc,a0,tol,nd,back,fback,cpe)
SpecGen: plasmon energy (eV) = 20
plasmon FWHM (eV) : 2
zero-loss FWHM (eV): 3
zero-loss offset from first channel (eV): 6
eV/channel: 0.1
zero-loss counts: 10000
t/lambda: 5
number of channels: 5000
instrumental background level (counts/channel): 20
instrumental noise/background (e.g. 0.1): 0.1
spectral counts per beam electron (e.g. 0.1): 0.1
-------------------------------

----------------FlogS---------------

Name of input file = SpecGen.psd
Data file 'SpecGen.psd' is assumed to have 2 columns
NreaD,NZ,NSEP,BACK = 5000 60 117 21.92 
eV/channel = 0.1,  zero-loss intensity = 1.008e+005 
 FWHM = 30.14 channels. 
New FWHM (0 to keep same ZLP): 0

 

Return to top.

B.6. Maximum-Likelihood Deconvolution

RLucy

%SpecGen(ep,wp,wz,ez,epc,a0,tol,nd,back,fback,cpe)
SpecGen(20,2,3,6,0.1,10000,0.5,1000,20,0.1,0.1);

%RLucy(specFile, kernelFile, niter)
RLucy('SpecGen.psd','',10);
   SpecGen(ep,wp,wz,ez,epc,a0,tol,nd,back,fback,cpe)
SpecGen: plasmon energy (eV) = 20
plasmon FWHM (eV) : 2
zero-loss FWHM (eV): 3
zero-loss offset from first channel (eV): 6
eV/channel: 0.1
zero-loss counts: 10000
t/lambda: 0.5
number of channels: 1000
instrumental background level (counts/channel): 20
instrumental noise/background (e.g. 0.1): 0.1
spectral counts per beam electron (e.g. 0.1): 0.1
-------------------------------

----------------RLucy---------------

RLucy: Spectrum data file name: SpecGen.psd
Kernel file name (generate from spectrum if blank): 
Number of iterations: 10
Data file 'SpecGen.psd' is assumed to have 2 columns

  

Return to top.

B.7. Drude-Model Spectrum Simulation

Drude

%Drude(ep,ew,eb,epc,e0,beta,nn,tnm)
Drude(15,3,0,0.1,200,5,500,50);
   Drude(ep,ew,eb,epc,e0,beta,nn,tnm)
plasmon energy (eV): 15
plasmon width (eV) : 3
binding energy (eV): 0
ev/channel : 0.1
E0(kev) : 200
beta(mrad) : 5
number of data points : 500
thickness(nm) : 50
Ps(2surfaces+begrenzung terms)=0.0163826,Pv=t/lambda(beta)= 0.254905
Volume-plasmon MFP(nm) = 196.151, Free-electron MFP(nm) = 183.836505
--------------------------------

 

Return to top.

B.8. Kramers–Kronig Analysis

KraKro

%Drude(ep,ew,eb,epc,e0,beta,nn,tnm)
Drude(15,3,0,0.1,100,10,1000,50);
%KraKro(infile,a0,e0,beta,ri,nloops,delta)
KraKro('Drude.ssd',1,100,10,1000,2,0.2);
   Drude(ep,ew,eb,epc,e0,beta,nn,tnm)
plasmon energy (eV): 15
plasmon width (eV) : 3
binding energy (eV): 0
ev/channel : 0.1
E0(kev) : 100
beta(mrad) : 10
number of data points : 1000
thickness(nm) : 50
Ps(2surfaces+begrenzung terms)=0.0207823,Pv=t/lambda(beta)= 0.417258
Volume-plasmon MFP(nm) = 119.83, Free-electron MFP(nm) = 112.707057
--------------------------------

--------------KraKro-----------------

Name of input file: Drude.ssd
Data file 'Drude.ssd' is assumed to have 2 columns
Zero-loss sum (1 for Drude.ssd): 1
E0(keV): 100
BETA(mrad): 10
ref.index: 1000
no. of iterations: 2
stability parameter (0.1 - 0.5 eV): 0.2
 nlines= 999 , nn = 4096, epc = 0.100000
 LOOP 1 : t(nm) = 56.139928 , t/lambda = 0.438070 lambda(nm) = 128.152948
 LOOP 2 : t(nm) = 47.798818 , t/lambda = 0.418839 lambda(nm) = 114.122284

   

Return to top.

B.9. Kröger Simulation of Low-Loss Spectrum

Kroeger

%Drude(ep,ew,eb,epc,e0,beta,nn,tnm)
Drude(15,2,0,0.2,200,5,600,150);
%Kroeger(in, ee, thick, ang )
Kroeger('Drude.eps',200,150,5)
   Drude(ep,ew,eb,epc,e0,beta,nn,tnm)
plasmon energy (eV): 15
plasmon width (eV) : 2
binding energy (eV): 0
ev/channel : 0.2
E0(kev) : 200
beta(mrad) : 5
number of data points : 600
thickness(nm) : 150
Ps(2surfaces+begrenzung terms)=0.0163643,Pv=t/lambda(beta)= 0.783058
Volume-plasmon MFP(nm) = 191.557, Free-electron MFP(nm) = 183.836505
--------------------------------

---------------Kroeger----------------

Input data file = Drude.eps
E0 (keV): 200
thickness (nm): 150
Collection Angle (mrad): 5
Data file 'Drude.eps' is assumed to have 3 columns

P(vol+surf) = 4.14381

         

KroegerEBplots

%KroegerEBplots(in,E0,el,beta)
KroegerEBplots('KroegerEBplots_Si.dat',300,3,2.1);
---------------KroegerEBplots----------------

Input data file = KroegerEBplots_Si.dat
E0 (keV): 300
Energy loss for angular distribution (eV) 3
Angular Range (mrad): 2.1
Data file 'KroegerEBplots_Si.dat' is assumed to have 3 columns
Currently processing 10000 nm
Currently processing  1000 nm
Currently processing   500 nm
Currently processing   250 nm
Currently processing   100 nm
Currently processing    50 nm
Currently processing    25 nm
Currently processing    10 nm
Currently processing     5 nm
Currently processing     1 nm

 

Return to top.

B.10. Core-Loss Simulation:

CoreGen

%CoreGen(Ek,Emin,Emax,Ep,Epc,r,TOL)
CoreGen(232,200,400,20,0.2,4,0.5);
----------------CoreGen---------------

Edge energy (eV) = 232
First coreloss channel (eV) = 200
Last coreloss channel (eV) = 400
Plasmon energy (eV) = 20
eV/channel = 0.2
Parameter r (e.g. 4) = 4
thickness/inelastic-MFP = 0.5

 

EdgeGen

%EdgeGen(Ek,Emin,Emax,Ep,Epc,r,TOL,JR)
EdgeGen(232,200,400,20,0.2,4,0.5,8);
---------------EdgeGen----------------

Edge energy (eV) = 232
First coreloss channel (eV) = 200
Last coreloss channel (eV) = 400
Plasmon energy (eV) = 20
eV/channel = 0.2
Parameter r (e.g. 4) = 4
thickness/inelastic-MFP = 0.5
Jump Ratio = 8

Calculated order n = 8

 

Return to top.

B.11. Fourier-Ratio Deconvolution

Frat

%CoreGen(Ek,Emin,Emax,Ep,Epc,r,TOL)
CoreGen(232,200,400,20,0.2,4,0.5);
%Frat(lfile,fwhm2,cfile)
Frat('CoreGen.low',0,'CoreGen.cor');
----------------CoreGen---------------

Edge energy (eV) = 232
First coreloss channel (eV) = 200
Last coreloss channel (eV) = 400
Plasmon energy (eV) = 20
eV/channel = 0.2
Parameter r (e.g. 4) = 4
thickness/inelastic-MFP = 0.5

----------------Frat---------------

Name of low-loss file = CoreGen.low
Data file 'CoreGen.low' is assumed to have 2 columns
ND,NZ,NSEP,DATA(NZ): 
1001 161 259 1
BACK,A0,DEND,EPC: 
0 1 0 0.2
 zero-loss FWHM =  0.2 eV; 

Energy resolution of coreloss SSD (FWHM) = 0
Name of coreloss file = CoreGen.cor
Data file 'CoreGen.cor' is assumed to have 2 columns
40.7763847739899 0.126720024804103 0.210403999999939 0.00521543364861857 1.062976 1.05202 

  

Return to top.

B.12. Incident-Convergence Correction

Concor2

%concor2(alpha,beta,e,e0)
Concor2(18,12,500,100);
---------------Concor2--------------

Alpha (mrad) : 18
Beta (mrad) : 12
E (eV) : 500
E0 (keV) : 100

f1 0.571137 f2 1.28506 bstar 16.0546

Return to top.

B.13. Hydrogenic K-Shell Cross Sections

Sigmak3

%Sigmak3( z,ek,delta1,e0,beta )
Sigmak3(6,284,100,100,10);
---------------Sigmak3----------------

Atomic number Z : 6
K-edge threshold energy EK(eV) : 284
Integration window Delta (eV) : 100
Incident-electron energy E0(keV) : 100
Collection semi-angle Beta(mrad) : 10

E(eV)    ds/dE(barn/eV)  Delta(eV)   Sigma(barn)     f(0)
 284        109.560377          0          0.00   0.0000
 294         95.454651         10       1023.05   0.0958
 304         83.484368         20       1916.07   0.1836
 314         73.279050         30       2698.51   0.2643
 324         64.540421         40       3386.45   0.3385
 334         57.026845         50       3993.32   0.4071
 344         50.541426         60       4530.35   0.4705
 354         44.922846         70       5006.99   0.5292
 364         40.038242         80       5431.21   0.5838
 374         35.777658         90       5809.80   0.6346
 384         32.049664        100       6148.51   0.6819
 404         25.898334        120       6725.29   0.7675
 444         17.340380        160       7575.96   0.9096
 524          8.444347        240       8555.33   1.1134
 684          2.541830        400       9321.57   1.3488
1004          0.408637        720       9674.62   1.5535
1644          0.032574       1360       9761.01   1.6816
2924          0.001333       2640       9771.92   1.7400
5484          0.000033       5200       9772.68   1.7606

Return to top.

B.14. Modified-Hydrogenic L-Shell Cross Sections

Sigmal3

%Sigmal3(z,delta1,e0,beta)
Sigmal3(22,100,80,10);
----------------Sigmal3---------------

Atomic number Z : 22
Integration window Delta(eV) : 100
Incident-electron energy E0(keV) : 80
Collection semi-angle Beta(mrad) : 10

E(eV)    ds/dE(barn/eV)  Delta(eV) Sigma(barn^2)     f(0)
 465        137.348284         10       1440.39   0.2796
 475        125.131453         20       2751.63   0.5432
 485         73.716602         30       3722.41   0.7491
 495         69.918911         40       4440.36   0.9035
 505         65.858297         50       5118.97   1.0545
 515         61.790457         60       5756.93   1.2013
 525         57.838592         70       6354.80   1.3434
 535         54.063585         80       6914.04   1.4807
 545         50.493880         90       7436.57   1.6132
 555         47.139989        100       7924.49   1.7409
 575         49.238345        120       8888.25   2.0052
 615         37.843411        160      10617.35   2.5244
 695         22.867190        240      12983.54   3.3732
 855          9.244493        400      15353.19   4.5526
1175          2.089531        720      16834.85   5.8491
1815          0.234134       1360      17338.16   6.9170
3095          0.013349       2640      17426.00   7.5684
5655          0.000465       5200      17434.47   7.8775

Return to top.

B.15. Parameterized K-, L-, M-, N- and O-Shell Cross Sections

Sigpar

%Sigpar( z, dl, shell, e0, beta)
Sigpar(5,50,'K',100,5);
---------------Sigpar----------------

Z: 5
Delta (eV): 50
Edge type (K,L,M23,M45,N or O): K
Ec = 188 eV,  f(delta) =  0.54 
E0(keV): 100
beta(mrad): 5
sigma = 6.57e-021 cm^2; 
estimated accuracy = 15 % 

Return to top.

B.16. Measurement of Absolute SpecimenThickness

tKKs

%Drude(ep,ew,eb,epc,e0,beta,nn,tnm)
Drude(15,3,0,0.2,200,5,500,100);

%tKKs( inFile, E0, n, beta, I0 )
tKKs('Drude.ssd',200,0,5,1);
   Drude(ep,ew,eb,epc,e0,beta,nn,tnm)
plasmon energy (eV): 15
plasmon width (eV) : 3
binding energy (eV): 0
ev/channel : 0.2
E0(kev) : 200
beta(mrad) : 5
number of data points : 500
thickness(nm) : 100
Ps(2surfaces+begrenzung terms)=0.0163395,Pv=t/lambda(beta)= 0.511622
Volume-plasmon MFP(nm) = 195.457, Free-electron MFP(nm) = 183.836505
--------------------------------
   tKKs( 'inFile',E0,RefIdx,Beta, I0, 'zlpMethod')
Input data file: Drude.ssd
E0 (keV): 200
Refractive Index (For metal/semimetal enter 0): 0
Collection angle (mrad): 5
Zero-loss integral (0 if spectrum has a ZLP): 1
specimen thickness(nm) = 95.8916
t/IMFP = 0.455204
IMFP(nm) = 210.656
-------------------------------

 

Return to top.

B.17. Total-Inelastic and Plasmon Mean Free Paths

IMFP

%IMFP(Z, A, prcnt, alpha, beta, rho, E0)
IMFP([6,1],[12,1],[0.33,0.67],5,10,0.9,200);
--------------IMFP-----------------


Compound Summary
Element: 1 Z: 6 A: 12 Fraction: 0.33
Element: 2 Z: 1 A: 1 Fraction: 0.67

Incident-convergence semi-angle alpha (mrad) : 5
EELS collection semi-angle beta (mrad) : 10
Specimen density rho (g/cm3) : 0.9
Incident energy E0 (keV) : 200
2.gamma.T = 343.741

Effective atomic number Z : 3.28719
Effective atomic weight A : 6.60253

IMFP(Iakoubovskii&,2008) = 217.274 nm
IMFP(Iakoubovskii revised) = 204.605 nm

F1 = 0.984264
F2 = 0.984264
beta* = 9.33829 mrad

IMFP(Malis et al.) = 194.574  nm
IMFP(Jin & Li) = 218.611  nm

PMFP

%PMFP(E0, Ep, alpha, beta)
PMFP(200,20,5,10);
PMFP: Incident-electron energy E0 (keV): 200
Plasmon energy of mean energy loss (eV): 20
Convergence semiangle (mrad) [can be 0]: 5
Collection semiangle (mrad): 10
effective semiangle beta* = 9.33818 mrad
Bethe-ridge angle(mrad) = 10 nm
Free-electron   MFP(nm) = 128.674 nm
Using Eq.(5.2), MFP(nm) = 125.181 nm

-------------------------------

Return to top.

B.18. Constrained Power-Law Background Fitting

Afit

%Afit(infile,eprestart,eprewidth,epoststart,epostwidth,outcore,outback)
Afit('CoO.dat',500,30,740,30,'Acore.dat','Aback.dat');
---------------Afit--------------

Input file: CoO.dat
Data file 'CoO.dat' is assumed to have 2 columns

Energy dispersion = 0.500000 [eV]
Pre-Edge energy window START [eV]: 500
Pre-Edge energy window WIDTH [eV]: 30
Post-Edge energy window START [eV]: 740
Post-Edge energy window WIDTH [eV]: 30

Fit coefficients I(E) = A*E^r
r = -2.82301 A = 1.85618e+014
filename for core: Acore.dat
filename for background: Aback.dat

BFit

%Bfit(infile,eprestart,eprewidth,epoststart,epostwidth,ecorestart,ecorewidth, ...
       differ,outcore,outback)
Bfit('CoO.dat',500,30,740,30,550,50,0.1,'Bcore.dat','Bback.dat');
------------Bfit-----------

Input file: CoO.dat
Data file 'CoO.dat' is assumed to have 2 columns

Energy dispersion 0.5 [eV/ch]
Pre-Edge energy window START [eV]: 500
Pre-Edge energy window WIDTH [eV]: 30
Post-Edge energy window START [eV]: 740
Post-Edge energy window WIDTH [eV]: 30
Core-loss energy window START [eV]: 550
Core-loss energy window WIDTH [eV]: 50
convergence criteria in percent difference in R in consequentive loops: 0.1

Ipre1 6.41383e+007, Ipre2 5.92506e+007, Ipre 1.23389e+008, di 0
first estimates of R = 2.72069, A = 9.80691e+013

+++++++++++++ iteration loop # 1 +++++++++++++ 
POST EDGE WINDOW IpostCore = 2599424.790445
CORE WINDOW Measured = 1.61755e+008
exponent R = 2.98944, background A = 5.25044e+014
+++++++++++++ iteration loop # 2 +++++++++++++ 
POST EDGE WINDOW IpostCore = 3583043.824135
CORE WINDOW Measured = 1.61755e+008
exponent R = 3.05567, background A = 7.93909e+014
+++++++++++++ iteration loop # 3 +++++++++++++ 
POST EDGE WINDOW IpostCore = 3796021.392385
CORE WINDOW Measured = 1.61755e+008
exponent R = 3.07023, background A = 8.69481e+014
+++++++++++++ iteration loop # 4 +++++++++++++ 
POST EDGE WINDOW IpostCore = 3841387.934495
CORE WINDOW Measured = 1.61755e+008
exponent R = 3.07334, background A = 8.86544e+014
+++++++++++++ iteration loop # 5 +++++++++++++ 
POST EDGE WINDOW IpostCore = 3851016.611258
CORE WINDOW Measured = 1.61755e+008
exponent R = 3.074, background A = 8.90211e+014
END change in R less than -0.0215127 percent in last two loopsfit coefficients I(E) = A*E^r
r = -3.074, A = 8.90211e+014
filename for core: Bcore.dat
filename for background: Bback.dat

Return to top.


Published with MATLAB® 7.13

ċ
EELS3-Matlab-12-12-18.zip
(83k)
TEM EELS,
Jul 6, 2016, 1:38 AM