import numpy as np
import escape as esc
esc.require("0.9.8")
wavelength = 1.540562
src = esc.xrays(wavelength, units="angstrom")
Loading material database from C:\dev\escape-core\.venv-gpu\Lib\site-packages\escape\scattering\..\data\mdb\materials.db
Off-specular reflectivity. Germanium film on silicon.¶
Off-specular reflectivity is the intensity scattered by interface roughness, away from the mirror reflection. A specular curve measures how large the roughness is. A diffuse curve also measures how wide the roughness is along the surface, and whether one interface repeats the roughness of another.
The curves in this notebook were calculated by Sergey Stepanov's X-ray Server, program TRDS, and saved under data/. The sample is the same in every section: a 200 Å germanium film on silicon, Cu Kα radiation (1.540562 Å), σ polarization. Both interfaces have an rms roughness of 5 Å, a lateral correlation length of 500 Å and a Hurst exponent of 1. Lengths are in Å, the same unit as the wavelength.
The scan is a rocking curve. The detector is held at 2θ = 1° and the sample angle θ runs from 0.08° to 0.92°. The exit angle is 1° − θ. At θ = 0.5° the incident and exit angles are equal, so the point lies on the specular rod. The server returned the diffuse intensity at that point. The diffuse cross-section stays finite there: it is the limit of the roughness scattering as the perpendicular momentum transfer of a diffuse channel goes to zero.
The server column is a calculated cross-section. Counting errors are attached with an incident scale Io chosen so that the brightest point of each curve corresponds to 10⁴ counts. The uncertainty is then √(I / Io). The calculated intensity is I0 times esc.offspecrefl. The roughness parameters stay at the values used to calculate the curve. A Levenberg-Marquardt optimizer adjusts I0, which should finish near 1.
The correlation is a property of each interface. A cross term between two interfaces is included when both interfaces carry the same correlation. The interface closer to the surface supplies the lengths that the cross term uses.
Uncorrelated roughness¶
Each interface scatters on its own. A height fluctuation on the film is unrelated to a height fluctuation on the substrate, so there is no interference term between them. The height correlation on one interface is σ² exp[−(r/ξ)^(2H)], with σ the rms height, ξ the lateral correlation length and H the Hurst exponent. This is esc.roughness and TRDS model 1. The file is data/film_uncorrelated/tds27192.dat.
The thickness, the rms roughness, the Hurst exponent and the correlation lengths are the values used to calculate the curve, and they stay fixed. The height of this rocking curve cannot separate the roughness amplitude from an overall intensity scale, so the optimizer adjusts I0 only.
thickness = esc.par("Ge thickness", 200.0, units="Å", fixed=True)
sigma = esc.par("Roughness", 5.0, units="Å", fixed=True, userlim=[2.0, 10.0])
lateral = esc.par("Lateral correlation", 500.0, units="Å", fixed=True, userlim=[150.0, 2000.0])
hurst = esc.par("Hurst", 1.0, fixed=True, userlim=[0.2, 1.0])
Germanium and silicon are taken from the material database. Their densities stay fixed. The same roughness parameters are used on both interfaces, which is how the server stores one roughness for the whole sample.
germanium = esc.crystal("Germanium", density="mdb", density_fixed=True, name="Germanium")
silicon = esc.crystal("Silicon", density="mdb", density_fixed=True, name="Silicon")
film = esc.layer(germanium, thickness, esc.roughness(sigma, lateral=lateral, hurst=hurst, name='Ge roughness'), name="Ge")
substrate = esc.substrate(silicon, esc.roughness(sigma, lateral=lateral, hurst=hurst, name='Si roughness'), name="Si")
sample = esc.multilayer(name="Ge/Si", frgr=esc.air("Air"), bkgr=substrate)
sample.add(film)
sample.show(source=src)
θ is the sample angle in degrees. The detector stays at 2θ = 1°, so the exit angle is 1° − θ. I0 scales the calculated cross-section onto the server column. It starts at 0.8 so the fit has to recover the scale.
theta = esc.var("theta")
degree = np.pi / 180.0
alpha_i = theta * degree
alpha_f = (1.0 - theta) * degree
wave = 2.0 * np.pi / src.wavelength
diffuse = esc.offspecrefl(
wave * (esc.cos(alpha_f) - esc.cos(alpha_i)),
wave * esc.sin(alpha_i),
wave * esc.sin(alpha_f),
sample,
source=src,
formalism="full",
name="Uncorrelated",
)
I0 = esc.par("I0", 0.8, userlim=[0.5, 1.5])
I = I0 * diffuse
The two columns are the sample angle and the diffuse cross-section calculated by the X-ray Server. Io is chosen so the brightest point of this curve equals 10⁴ counts. The error bar on a point of intensity I is √(I / Io).
angle, measured = np.loadtxt("data/film_uncorrelated/tds27192.dat", unpack=True)
measured = np.asarray(measured, float)
# Io puts 1e4 counts on the brightest point. The bar is the Poisson error.
Io = 1.0e4 / np.max(measured)
errors = np.sqrt(measured / Io)
data = esc.data(angle, measured, errors, copy=True, name="Uncorrelated")
model = esc.model(
I, data, residuals_scale="none", weight_type="data", name="Uncorrelated"
)
opt_uncorrelated = esc.levmar(
model,
xtol=1.0e-6,
ftol=1.0e-8,
gtol=1.0e-6,
maxiter=25,
maxfev=300,
nupdate=5,
epsfcn=1.0e-7,
)
opt_uncorrelated()
print("cost", opt_uncorrelated.best_cost)
print("roughness", sigma.value, "lateral", lateral.value, "I0", I0.value)
model.show().config(ylog=True, xlabel="theta [deg]", ylabel="Intensity [a.u.]")
cost 30.318443384218927 roughness 5.0 lateral 500.0 I0 0.9836169937207476
opt_uncorrelated
Name: Levenberg-Marquardt Parameters number: 7 Parameter Value +- Error Units Fixed I0 0.98362 +- 0.0016982 0 Germanium density 5.3244 +- 0 g/cm^3 1 Ge thickness 200 +- 0 Å 1 Roughness 5 +- 0 Å 1 Lateral correlation 500 +- 0 Å 1 Hurst 1 +- 0 1 Silicon density 2.3293 +- 0 g/cm^3 1
Conformal roughness¶
The film copies the substrate roughness. The two interfaces carry the same bumps, and the diffuse waves from the two interfaces interfere. The cross term is σ_film σ_substrate exp[−(r/ξ)^(2H)]. The lateral length, the Hurst exponent and an optional skew angle are taken from the upper interface. The skew is zero here. This is esc.conformal_roughness and TRDS model 2. The file is data/film_conformal/tds27194.dat.
The thickness, the rms roughness, the Hurst exponent and the correlation lengths are the values used to calculate the curve, and they stay fixed. The height of this rocking curve cannot separate the roughness amplitude from an overall intensity scale, so the optimizer adjusts I0 only.
thickness = esc.par("Ge thickness", 200.0, units="Å", fixed=True)
sigma = esc.par("Roughness", 5.0, units="Å", fixed=True, userlim=[2.0, 10.0])
lateral = esc.par("Lateral correlation", 500.0, units="Å", fixed=True, userlim=[150.0, 2000.0])
hurst = esc.par("Hurst", 1.0, fixed=True, userlim=[0.2, 1.0])
Germanium and silicon are taken from the material database. Their densities stay fixed. The same roughness parameters are used on both interfaces, which is how the server stores one roughness for the whole sample.
germanium = esc.crystal("Germanium", density="mdb", density_fixed=True, name="Germanium")
silicon = esc.crystal("Silicon", density="mdb", density_fixed=True, name="Silicon")
film = esc.layer(germanium, thickness, esc.conformal_roughness(sigma, lateral, hurst, name='Ge roughness'), name="Ge")
substrate = esc.substrate(silicon, esc.conformal_roughness(sigma, lateral, hurst, name='Si roughness'), name="Si")
sample = esc.multilayer(name="Ge/Si", frgr=esc.air("Air"), bkgr=substrate)
sample.add(film)
sample.show(source=src)
θ is the sample angle in degrees. The detector stays at 2θ = 1°, so the exit angle is 1° − θ. I0 scales the calculated cross-section onto the server column. It starts at 0.8 so the fit has to recover the scale.
theta = esc.var("theta")
degree = np.pi / 180.0
alpha_i = theta * degree
alpha_f = (1.0 - theta) * degree
wave = 2.0 * np.pi / src.wavelength
diffuse = esc.offspecrefl(
wave * (esc.cos(alpha_f) - esc.cos(alpha_i)),
wave * esc.sin(alpha_i),
wave * esc.sin(alpha_f),
sample,
source=src,
formalism="full",
name="Conformal",
)
I0 = esc.par("I0", 0.8, userlim=[0.5, 1.5])
I = I0 * diffuse
The two columns are the sample angle and the diffuse cross-section calculated by the X-ray Server. Io is chosen so the brightest point of this curve equals 10⁴ counts. The error bar on a point of intensity I is √(I / Io).
angle, measured = np.loadtxt("data/film_conformal/tds27194.dat", unpack=True)
measured = np.asarray(measured, float)
# Io puts 1e4 counts on the brightest point. The bar is the Poisson error.
Io = 1.0e4 / np.max(measured)
errors = np.sqrt(measured / Io)
data = esc.data(angle, measured, errors, copy=True, name="Conformal")
model = esc.model(
I, data, residuals_scale="none", weight_type="data", name="Conformal"
)
opt_conformal = esc.levmar(
model,
xtol=1.0e-6,
ftol=1.0e-8,
gtol=1.0e-6,
maxiter=25,
maxfev=300,
nupdate=5,
epsfcn=1.0e-7,
)
opt_conformal()
print("cost", opt_conformal.best_cost)
print("roughness", sigma.value, "lateral", lateral.value, "I0", I0.value)
model.show().config(ylog=True, xlabel="theta [deg]", ylabel="Intensity [a.u.]")
cost 76.50955153011643 roughness 5.0 lateral 500.0 I0 0.9768283543357312
opt_conformal
Name: Levenberg-Marquardt Parameters number: 7 Parameter Value +- Error Units Fixed I0 0.97683 +- 0.0018 0 Germanium density 5.3244 +- 0 g/cm^3 1 Ge thickness 200 +- 0 Å 1 Roughness 5 +- 0 Å 1 Lateral correlation 500 +- 0 Å 1 Hurst 1 +- 0 1 Silicon density 2.3293 +- 0 g/cm^3 1
Ming roughness¶
The copied roughness fades with depth. The conformal cross term is multiplied by exp(−|Δz| / L_v), where Δz is the distance between the interfaces and L_v is the vertical correlation length. L_v = 300 Å on this curve, and the film is 200 Å thick, so the two interfaces stay partly correlated. A very small L_v removes the cross term. A very large L_v returns to the conformal model. The upper interface supplies L_v. This is esc.ming_roughness and TRDS model 3. The file is data/film_ming/tds27195.dat.
The thickness, the rms roughness, the Hurst exponent and the correlation lengths are the values used to calculate the curve, and they stay fixed. The height of this rocking curve cannot separate the roughness amplitude from an overall intensity scale, so the optimizer adjusts I0 only.
thickness = esc.par("Ge thickness", 200.0, units="Å", fixed=True)
sigma = esc.par("Roughness", 5.0, units="Å", fixed=True, userlim=[2.0, 10.0])
lateral = esc.par("Lateral correlation", 500.0, units="Å", fixed=True, userlim=[150.0, 2000.0])
hurst = esc.par("Hurst", 1.0, fixed=True, userlim=[0.2, 1.0])
vertical = esc.par("Vertical correlation", 300.0, units="Å", fixed=True, userlim=[50.0, 2000.0])
Germanium and silicon are taken from the material database. Their densities stay fixed. The same roughness parameters are used on both interfaces, which is how the server stores one roughness for the whole sample.
germanium = esc.crystal("Germanium", density="mdb", density_fixed=True, name="Germanium")
silicon = esc.crystal("Silicon", density="mdb", density_fixed=True, name="Silicon")
film = esc.layer(germanium, thickness, esc.ming_roughness(sigma, lateral, hurst, vertical, name='Ge roughness'), name="Ge")
substrate = esc.substrate(silicon, esc.ming_roughness(sigma, lateral, hurst, vertical, name='Si roughness'), name="Si")
sample = esc.multilayer(name="Ge/Si", frgr=esc.air("Air"), bkgr=substrate)
sample.add(film)
sample.show(source=src)
θ is the sample angle in degrees. The detector stays at 2θ = 1°, so the exit angle is 1° − θ. I0 scales the calculated cross-section onto the server column. It starts at 0.8 so the fit has to recover the scale.
theta = esc.var("theta")
degree = np.pi / 180.0
alpha_i = theta * degree
alpha_f = (1.0 - theta) * degree
wave = 2.0 * np.pi / src.wavelength
diffuse = esc.offspecrefl(
wave * (esc.cos(alpha_f) - esc.cos(alpha_i)),
wave * esc.sin(alpha_i),
wave * esc.sin(alpha_f),
sample,
source=src,
formalism="full",
name="Ming",
)
I0 = esc.par("I0", 0.8, userlim=[0.5, 1.5])
I = I0 * diffuse
The two columns are the sample angle and the diffuse cross-section calculated by the X-ray Server. Io is chosen so the brightest point of this curve equals 10⁴ counts. The error bar on a point of intensity I is √(I / Io).
angle, measured = np.loadtxt("data/film_ming/tds27195.dat", unpack=True)
measured = np.asarray(measured, float)
# Io puts 1e4 counts on the brightest point. The bar is the Poisson error.
Io = 1.0e4 / np.max(measured)
errors = np.sqrt(measured / Io)
data = esc.data(angle, measured, errors, copy=True, name="Ming")
model = esc.model(
I, data, residuals_scale="none", weight_type="data", name="Ming"
)
opt_ming = esc.levmar(
model,
xtol=1.0e-6,
ftol=1.0e-8,
gtol=1.0e-6,
maxiter=25,
maxfev=300,
nupdate=5,
epsfcn=1.0e-7,
)
opt_ming()
print("cost", opt_ming.best_cost)
print("roughness", sigma.value, "lateral", lateral.value, "I0", I0.value, "vertical", vertical.value)
model.show().config(ylog=True, xlabel="theta [deg]", ylabel="Intensity [a.u.]")
cost 49.014862828216316 roughness 5.0 lateral 500.0 I0 0.9800903194929227 vertical 300.0
opt_ming
Name: Levenberg-Marquardt Parameters number: 8 Parameter Value +- Error Units Fixed I0 0.98009 +- 0.0017471 0 Germanium density 5.3244 +- 0 g/cm^3 1 Ge thickness 200 +- 0 Å 1 Roughness 5 +- 0 Å 1 Lateral correlation 500 +- 0 Å 1 Hurst 1 +- 0 1 Vertical correlation 300 +- 0 Å 1 Silicon density 2.3293 +- 0 g/cm^3 1
Lagally roughness¶
The roughness on one interface and the correlation between interfaces can have different lateral sizes. Each interface keeps its own lateral length, 500 Å, for its own scattering. The cross term uses a longer length, ξ_cross = 2000 Å, and it fades over L_v = 300 Å. Both of those lengths are taken from the upper interface. This is esc.lagally_roughness and TRDS model 4. The file is data/film_lagally/tds27196.dat.
The thickness, the rms roughness, the Hurst exponent and the correlation lengths are the values used to calculate the curve, and they stay fixed. The height of this rocking curve cannot separate the roughness amplitude from an overall intensity scale, so the optimizer adjusts I0 only.
thickness = esc.par("Ge thickness", 200.0, units="Å", fixed=True)
sigma = esc.par("Roughness", 5.0, units="Å", fixed=True, userlim=[2.0, 10.0])
lateral = esc.par("Lateral correlation", 500.0, units="Å", fixed=True, userlim=[150.0, 2000.0])
hurst = esc.par("Hurst", 1.0, fixed=True, userlim=[0.2, 1.0])
lateral_cross = esc.par("Cross correlation", 2000.0, units="Å", fixed=True, userlim=[500.0, 6000.0])
vertical = esc.par("Vertical correlation", 300.0, units="Å", fixed=True, userlim=[50.0, 2000.0])
Germanium and silicon are taken from the material database. Their densities stay fixed. The same roughness parameters are used on both interfaces, which is how the server stores one roughness for the whole sample.
germanium = esc.crystal("Germanium", density="mdb", density_fixed=True, name="Germanium")
silicon = esc.crystal("Silicon", density="mdb", density_fixed=True, name="Silicon")
film = esc.layer(germanium, thickness, esc.lagally_roughness(sigma, lateral, hurst, lateral_cross, vertical, name='Ge roughness'), name="Ge")
substrate = esc.substrate(silicon, esc.lagally_roughness(sigma, lateral, hurst, lateral_cross, vertical, name='Si roughness'), name="Si")
sample = esc.multilayer(name="Ge/Si", frgr=esc.air("Air"), bkgr=substrate)
sample.add(film)
sample.show(source=src)
θ is the sample angle in degrees. The detector stays at 2θ = 1°, so the exit angle is 1° − θ. I0 scales the calculated cross-section onto the server column. It starts at 0.8 so the fit has to recover the scale.
theta = esc.var("theta")
degree = np.pi / 180.0
alpha_i = theta * degree
alpha_f = (1.0 - theta) * degree
wave = 2.0 * np.pi / src.wavelength
diffuse = esc.offspecrefl(
wave * (esc.cos(alpha_f) - esc.cos(alpha_i)),
wave * esc.sin(alpha_i),
wave * esc.sin(alpha_f),
sample,
source=src,
formalism="full",
name="Lagally",
)
I0 = esc.par("I0", 0.8, userlim=[0.5, 1.5])
I = I0 * diffuse
The two columns are the sample angle and the diffuse cross-section calculated by the X-ray Server. Io is chosen so the brightest point of this curve equals 10⁴ counts. The error bar on a point of intensity I is √(I / Io).
angle, measured = np.loadtxt("data/film_lagally/tds27196.dat", unpack=True)
measured = np.asarray(measured, float)
# Io puts 1e4 counts on the brightest point. The bar is the Poisson error.
Io = 1.0e4 / np.max(measured)
errors = np.sqrt(measured / Io)
data = esc.data(angle, measured, errors, copy=True, name="Lagally")
model = esc.model(
I, data, residuals_scale="none", weight_type="data", name="Lagally"
)
opt_lagally = esc.levmar(
model,
xtol=1.0e-6,
ftol=1.0e-8,
gtol=1.0e-6,
maxiter=25,
maxfev=300,
nupdate=5,
epsfcn=1.0e-7,
)
opt_lagally()
print("cost", opt_lagally.best_cost)
print("roughness", sigma.value, "lateral", lateral.value, "I0", I0.value, "cross", lateral_cross.value, "vertical", vertical.value)
model.show().config(ylog=True, xlabel="theta [deg]", ylabel="Intensity [a.u.]")
cost 161.37460058359827 roughness 5.0 lateral 500.0 I0 0.9706403350660258 cross 2000.0 vertical 300.0
opt_lagally
Name: Levenberg-Marquardt Parameters number: 9 Parameter Value +- Error Units Fixed I0 0.97064 +- 0.0018878 0 Germanium density 5.3244 +- 0 g/cm^3 1 Ge thickness 200 +- 0 Å 1 Roughness 5 +- 0 Å 1 Lateral correlation 500 +- 0 Å 1 Hurst 1 +- 0 1 Vertical correlation 300 +- 0 Å 1 Cross correlation 2000 +- 0 Å 1 Silicon density 2.3293 +- 0 g/cm^3 1
Holy roughness¶
Roughness is added at an interface, and every interface above it inherits that roughness. The film surface therefore carries its own contribution and the substrate contribution. With 5 Å on each interface the surface variance is 2 × (5 Å)², which is an rms of about 7.1 Å. The substrate carries only its own 5 Å. There is no vertical-length parameter: the copy is complete. This is esc.holy_roughness and TRDS model 5. The file is data/film_holy/tds27197.dat.
The thickness, the rms roughness, the Hurst exponent and the correlation lengths are the values used to calculate the curve, and they stay fixed. The height of this rocking curve cannot separate the roughness amplitude from an overall intensity scale, so the optimizer adjusts I0 only.
thickness = esc.par("Ge thickness", 200.0, units="Å", fixed=True)
sigma = esc.par("Roughness", 5.0, units="Å", fixed=True, userlim=[2.0, 10.0])
lateral = esc.par("Lateral correlation", 500.0, units="Å", fixed=True, userlim=[150.0, 2000.0])
hurst = esc.par("Hurst", 1.0, fixed=True, userlim=[0.2, 1.0])
Germanium and silicon are taken from the material database. Their densities stay fixed. The same roughness parameters are used on both interfaces, which is how the server stores one roughness for the whole sample.
germanium = esc.crystal("Germanium", density="mdb", density_fixed=True, name="Germanium")
silicon = esc.crystal("Silicon", density="mdb", density_fixed=True, name="Silicon")
film = esc.layer(germanium, thickness, esc.holy_roughness(sigma, lateral, hurst, name='Ge roughness'), name="Ge")
substrate = esc.substrate(silicon, esc.holy_roughness(sigma, lateral, hurst, name='Si roughness'), name="Si")
sample = esc.multilayer(name="Ge/Si", frgr=esc.air("Air"), bkgr=substrate)
sample.add(film)
sample.show(source=src)
θ is the sample angle in degrees. The detector stays at 2θ = 1°, so the exit angle is 1° − θ. I0 scales the calculated cross-section onto the server column. It starts at 0.8 so the fit has to recover the scale.
theta = esc.var("theta")
degree = np.pi / 180.0
alpha_i = theta * degree
alpha_f = (1.0 - theta) * degree
wave = 2.0 * np.pi / src.wavelength
diffuse = esc.offspecrefl(
wave * (esc.cos(alpha_f) - esc.cos(alpha_i)),
wave * esc.sin(alpha_i),
wave * esc.sin(alpha_f),
sample,
source=src,
formalism="full",
name="Holy",
)
I0 = esc.par("I0", 0.8, userlim=[0.5, 1.5])
I = I0 * diffuse
The two columns are the sample angle and the diffuse cross-section calculated by the X-ray Server. Io is chosen so the brightest point of this curve equals 10⁴ counts. The error bar on a point of intensity I is √(I / Io).
angle, measured = np.loadtxt("data/film_holy/tds27197.dat", unpack=True)
measured = np.asarray(measured, float)
# Io puts 1e4 counts on the brightest point. The bar is the Poisson error.
Io = 1.0e4 / np.max(measured)
errors = np.sqrt(measured / Io)
data = esc.data(angle, measured, errors, copy=True, name="Holy")
model = esc.model(
I, data, residuals_scale="none", weight_type="data", name="Holy"
)
opt_holy = esc.levmar(
model,
xtol=1.0e-6,
ftol=1.0e-8,
gtol=1.0e-6,
maxiter=25,
maxfev=300,
nupdate=5,
epsfcn=1.0e-7,
)
opt_holy()
print("cost", opt_holy.best_cost)
print("roughness", sigma.value, "lateral", lateral.value, "I0", I0.value)
model.show().config(ylog=True, xlabel="theta [deg]", ylabel="Intensity [a.u.]")
cost 52.58719925963688 roughness 5.0 lateral 500.0 I0 0.9795944167223314
opt_holy
Name: Levenberg-Marquardt Parameters number: 7 Parameter Value +- Error Units Fixed I0 0.97959 +- 0.0017592 0 Germanium density 5.3244 +- 0 g/cm^3 1 Ge thickness 200 +- 0 Å 1 Roughness 5 +- 0 Å 1 Lateral correlation 500 +- 0 Å 1 Hurst 1 +- 0 1 Silicon density 2.3293 +- 0 g/cm^3 1
Spiller roughness¶
Each interface adds a Gaussian roughness, and the interfaces above it inherit a broader, weaker copy. The copy created at an interface is widened by the relaxation length ν: the added width grows with the distance from the interface that created the roughness. The vertical length printed by the server is L_v = ξ² / ν. This curve uses L_v = 500 Å and ξ = 500 Å, so ν = 500 Å. A very small ν copies the roughness unchanged and recovers the Holy model. A very large ν copies nothing and recovers independent interfaces. This is esc.spiller_roughness and TRDS model 6. The file is data/film_spiller_lv/tds27199.dat.
The thickness, the rms roughness, the Hurst exponent and the correlation lengths are the values used to calculate the curve, and they stay fixed. The height of this rocking curve cannot separate the roughness amplitude from an overall intensity scale, so the optimizer adjusts I0 only.
thickness = esc.par("Ge thickness", 200.0, units="Å", fixed=True)
sigma = esc.par("Roughness", 5.0, units="Å", fixed=True, userlim=[2.0, 10.0])
lateral = esc.par("Lateral correlation", 500.0, units="Å", fixed=True, userlim=[150.0, 2000.0])
hurst = esc.par("Hurst", 1.0, fixed=True, userlim=[0.2, 1.0])
relaxation = esc.par("Relaxation", 500.0, units="Å", fixed=True, userlim=[100.0, 2000.0])
Germanium and silicon are taken from the material database. Their densities stay fixed. The same roughness parameters are used on both interfaces, which is how the server stores one roughness for the whole sample.
germanium = esc.crystal("Germanium", density="mdb", density_fixed=True, name="Germanium")
silicon = esc.crystal("Silicon", density="mdb", density_fixed=True, name="Silicon")
film = esc.layer(germanium, thickness, esc.spiller_roughness(sigma, lateral, hurst, relaxation, name='Ge roughness'), name="Ge")
substrate = esc.substrate(silicon, esc.spiller_roughness(sigma, lateral, hurst, relaxation, name='Si roughness'), name="Si")
sample = esc.multilayer(name="Ge/Si", frgr=esc.air("Air"), bkgr=substrate)
sample.add(film)
sample.show(source=src)
θ is the sample angle in degrees. The detector stays at 2θ = 1°, so the exit angle is 1° − θ. I0 scales the calculated cross-section onto the server column. It starts at 0.8 so the fit has to recover the scale.
theta = esc.var("theta")
degree = np.pi / 180.0
alpha_i = theta * degree
alpha_f = (1.0 - theta) * degree
wave = 2.0 * np.pi / src.wavelength
diffuse = esc.offspecrefl(
wave * (esc.cos(alpha_f) - esc.cos(alpha_i)),
wave * esc.sin(alpha_i),
wave * esc.sin(alpha_f),
sample,
source=src,
formalism="full",
name="Spiller",
)
I0 = esc.par("I0", 0.8, userlim=[0.5, 1.5])
I = I0 * diffuse
The two columns are the sample angle and the diffuse cross-section calculated by the X-ray Server. Io is chosen so the brightest point of this curve equals 10⁴ counts. The error bar on a point of intensity I is √(I / Io).
angle, measured = np.loadtxt("data/film_spiller_lv/tds27199.dat", unpack=True)
measured = np.asarray(measured, float)
# Io puts 1e4 counts on the brightest point. The bar is the Poisson error.
Io = 1.0e4 / np.max(measured)
errors = np.sqrt(measured / Io)
data = esc.data(angle, measured, errors, copy=True, name="Spiller")
model = esc.model(
I, data, residuals_scale="none", weight_type="data", name="Spiller"
)
opt_spiller = esc.levmar(
model,
xtol=1.0e-6,
ftol=1.0e-8,
gtol=1.0e-6,
maxiter=25,
maxfev=300,
nupdate=5,
epsfcn=1.0e-7,
)
opt_spiller()
print("cost", opt_spiller.best_cost)
print("roughness", sigma.value, "lateral", lateral.value, "I0", I0.value, "relaxation", relaxation.value)
model.show().config(ylog=True, xlabel="theta [deg]", ylabel="Intensity [a.u.]")
cost 47.4340005932879 roughness 5.0 lateral 500.0 I0 0.9795178109902004 relaxation 500.0
opt_spiller
Name: Levenberg-Marquardt Parameters number: 8 Parameter Value +- Error Units Fixed I0 0.97952 +- 0.0017426 0 Germanium density 5.3244 +- 0 g/cm^3 1 Ge thickness 200 +- 0 Å 1 Roughness 5 +- 0 Å 1 Lateral correlation 500 +- 0 Å 1 Hurst 1 +- 0 1 Relaxation 500 +- 0 Å 1 Silicon density 2.3293 +- 0 g/cm^3 1