Skip to content

Commit

Permalink
general imfp() function added
Browse files Browse the repository at this point in the history
  • Loading branch information
c0deta1ker committed Apr 12, 2023
1 parent 84dfe49 commit 11db9df
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
% for elemental or binary materials. In this function, you can define the
% material as a string and it will look it up the relevant parameters in
% the Material Properties Database (MPD) ('MPD_PCC.mat') and determine
% the imfp using the S2 equation.
% the imfp using the S1 equation.
%
% REFERENCE:
% [1] M. P. Seah, “An accurate and simple universal curve for the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function imfp = eimfp_S2_avg_mpd(ke_dat, material)
% imfp = eimfp_S2_avg_mpd(ke_dat, material)
% Function that determines the electron inelastic mean free path (IMFP)
% based on the S2 equation described by M. P. Seah [1]. The IMFP here
% only depends on the value of Z. In this function, you can define the
% material as a string and it will look it up the relevant parameters in
% the Material Properties Database (MPD) ('MPD_PCC.mat') and determine
% the imfp using the S2 equation.
%
% REFERENCE:
% [1] M. P. Seah, “An accurate and simple universal curve for the
% energy-dependent electron inelastic mean free path,”
% Surf. Interface Anal., vol. 44, no. 4, pp. 497–503, 2012,
% doi: 10.1002/sia.4816.
%
% IN:
% - ke_dat: N×1 vector of the input electron kinetic energy (for PES; KE = BE - PHI) [eV]
% - material: string of the material whose imfp is to be determined; e.g. "Si", "SiO2", "InAs", "Al2O3"...
%
% OUT:
% - imfp: N×1 column vector of the electron IMFP values [Angstroms]

%% Default parameters (Parameters for Silicon)
if nargin < 2; material = "Si"; end
if isempty(material); material = "Si"; end
%% - 1 - Extracting the material parameters from the materials database
% - Extracting the material properties
material_props = get_mpd_props(material);
% - Extracting the material properties required for the S2 formalism
Z = material_props.ATOM_ZNUM;
%% - 2 - Determination of the IMFP TPP-2M
% If the kinetic energy is negative, assume it is zero
ke_dat(ke_dat<0) = 0;
% Evaluating the imfp
a = 2.5; % Average atomic spacing in Angstroms
% Relativistic corrected equation
imfp = a .* ((1.52 + 0.167 .* Z.^(0.5) + 0.0394 .* ke_dat.^(0.872)) ./ Z.^(0.3)); % IMFP in Angstroms
% If isnan, return zero
imfp(isnan(imfp)) = 0;
%% Ensuring the imfp is a column vector
if size(imfp, 2) >1; imfp = imfp'; end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
function imfp = imfp(formalism, ke_dat, args)
% imfp = imfp(formalism, ke_dat, args)
% Function that calculates the electron inelastic mean free path (IMFP).
% The TPP2M, S1, S2 and Universal formalisms are available. The user can
% define a scalar or vector of kinetic energies for the input.
% If the args is a string of an element / material, it will look it up
% the relevant materials parameters in the Material Properties Database
% (MPD) ('MPD_PCC.mat'). Otherwise, the args a be manually inserted as
% discussed below.
%
% IN:
% - formalism: string for imfp calculator formalism. Default:"TPP2M" ["TPP2M","S1","S2","Universal"]
% - ke_dat: N×1 column vector of the input electron kinetic energy (for PES; KE = BE - PHI) [eV]
% - args: string or vector of scalars defining the arguments of the chosen formalism;
% (1) string of element / material whose parameters are found in materials database; e.g. "Si", "SiO2", "Al2O3"...
% (2) vector with manual entry of material parameters:
% -> TPP2M: 4x1 [density(g/cc),atomicweight(amu),egap(eV),valency(valence electrons per atom)]
% -> S1: 4x1 [density(g/cc),atomicweight(amu),egap(eV),Z(atomic mass number or average for compounds)]
% -> S2: 1x1 [Z(atomic mass number or average for compounds)]
% -> Universal: no args, material independent.
%
% OUT:
% - imfp: N×1 column vector of the electron IMFP values [Angstroms]

%% Default parameters
% - Default formalism
if nargin < 3; args = []; end
if nargin < 1; formalism = "TPP2M"; end
if isempty(formalism); formalism = "TPP2M"; end
if isempty(args); args = []; end
% - Validity check on the inputs
if ischar(formalism); formalism = string(formalism); end
if ischar(args); args = string(args); end

%% - 1 - Determination of the IMFP
% If the kinetic energy is negative, assume it is zero
ke_dat(ke_dat<0) = 0;
% -- TPP2M formalism
if strcmpi(formalism, "TPP2M") || strcmpi(formalism, "TPP-2M")
if isstring(args)
material = args;
imfp = eimfp_tpp2m_mpd(ke_dat, material);
else
rho = args(1); Nv=args(4); M = args(2); Egap = args(3);
imfp = eimfp_tpp2m(ke_dat, rho, Nv, M, Egap);
end
% -- S1 formalism
elseif strcmpi(formalism, "S1")
if isstring(args)
material = args;
imfp = eimfp_S1_mpd(ke_dat, material);
else
rho = args(1); Z=args(4); M = args(2); Egap = args(3);
imfp = eimfp_S1(ke_dat, rho, M, Egap, Z);
end
% -- S2 formalism
elseif strcmpi(formalism, "S2")
if isstring(args)
material = args;
imfp = eimfp_S2_avg_mpd(ke_dat, material);
else
Z=args(1);
imfp = eimfp_S2_avg(ke_dat, Z);
end
% -- Universal formalism
elseif strcmpi(formalism, "Universal")
imfp = eimfp_universal(ke_dat);
end
%% Ensuring the imfp is a column vector
if size(imfp, 2) >1; imfp = imfp'; end
end

0 comments on commit 11db9df

Please sign in to comment.