X-ray absorption edge

X-ray reflectivity of a Ni film on Si in a wavelength scan across the Ni K edge. Ni is given by a refractive-index table, Si by an SLD table. For comparison, a second simulation uses one-row tables, that is, the optical constants at a single wavelength.

See wavelength-dependent materials for the table format and interpolation options.

Result

Ni film reflectivity across the absorption edge

Python script

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["bornagain>=25,<26", "periodictable"]
# ///
"""
X-ray reflectivity of a Ni film on Si across the Ni absorption edge.
"""
import bornagain as ba
ba.require_versions("bornagain>=25,<26")
import numpy as np
import periodictable
from periodictable import xsf
from bornagain import angstrom, deg, nm


def nickel_table(wavelengths):
    rows = []
    for wavelength in wavelengths:
        # periodictable gives n = 1 - delta - i*beta; BornAgain takes delta and beta.
        index = xsf.index_of_refraction(
            "Ni", density=8.9, wavelength=wavelength/angstrom)
        rows.append((wavelength, 1 - index.real, -index.imag))
    return np.array(rows)


def xray_table(formula, density, wavelengths):
    # periodictable uses angstroms and returns SLD in 10^-6 A^-2.
    rows = []
    for wavelength in wavelengths:
        real, absorption = periodictable.xray_sld(
            formula, density=density, wavelength=wavelength/angstrom)
        rows.append((wavelength, real*1e-6, absorption*1e-6))
    return np.array(rows)


def get_sample(wavelengths):
    vacuum = ba.Vacuum()

    # Several wavelengths give tables, a single one gives constant values.
    nickel_color = (0.7, 0.5, 0.25)
    nickel = ba.RefractiveMaterial("Ni", nickel_color,
                                   nickel_table(wavelengths))
    silicon_color = (0.65, 0.75, 0.85)
    silicon = ba.SLDMaterial("Si", silicon_color,
                             xray_table("Si", 2.33, wavelengths))

    vacuum_layer = ba.Layer(vacuum)
    nickel_layer = ba.Layer(nickel, 30*nm)
    substrate = ba.Layer(silicon)

    sample = ba.Sample()
    sample.addLayer(vacuum_layer)
    sample.addLayer(nickel_layer)
    sample.addLayer(substrate)
    return sample


def simulate(sample):
    n_points = 1001
    scan = ba.LambdaScan(n_points, 0.1*nm, 0.2*nm)
    scan.setGrazingAngle(0.45*deg)
    simulation = ba.SpecularSimulation(scan, sample)
    return simulation.simulate()


if __name__ == "__main__":
    spectral_sample = get_sample(np.linspace(0.1*nm, 0.2*nm, 1001))
    fixed_sample = get_sample(np.array([0.148])*nm)
    spectral_result = simulate(spectral_sample)
    fixed_result = simulate(fixed_sample)
    spectral_result.setTitle("Refraction(λ)")
    fixed_result.setTitle("Refraction(0.148 nm)")

    results = [spectral_result, fixed_result]
    ba.plot_multicurve(results, legendloc="upper left")
    ba.plt.show()
auto/Examples/specular/instrument/SpectralRefractiveIndex.py