Specular with slicing 2Q

Result

Specular with slicing 2Q result

Sample

Specular with slicing 2Q sample

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
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["bornagain>=25,<26"]
# ///
"""
Specular reflectometry with sliced cylinders (Q-scan variant).

Same sample as SpecularWithSlicing2.py but the scan axis is q_z
instead of incident angle.
"""
from math import pi, sin
import numpy as np
import bornagain as ba
ba.require_versions("bornagain>=25,<26")
from bornagain import angstrom, deg, nm

HEIGHT = 5 * nm
RADIUS = 5 * nm
SURF_DENSITY = 0.01   # nm^-2
N_SLICES = 3
WAVELENGTH = 1.54 * angstrom


def _sld(delta, beta):
    """
    Convert refractive index (delta, beta) to SLD (Å⁻²) at WAVELENGTH.
    """
    f = pi * angstrom**2 / WAVELENGTH**2
    return (2*delta - delta**2 + beta**2) * f, (2*beta - 2*delta*beta) * f


def get_sample():
    vacuum = ba.Vacuum()
    sub_re, sub_im = _sld(6e-6, 2e-8)
    par_re, par_im = _sld(6e-4, 2e-8)

    substrate_color = (0.28, 0.57, 0.82)
    substrate_mat = ba.SLDMaterial("Substrate", substrate_color, sub_re, sub_im)
    particle_color = (0.86, 0.24, 0.18)
    particle_mat = ba.SLDMaterial("Particle", particle_color, par_re, par_im)

    cylinder = ba.Cylinder(RADIUS, HEIGHT)
    particle = ba.Particle(particle_mat, cylinder)

    top_layer = ba.Layer(vacuum)
    top_layer.deposit2D(ba.Dilute2D(SURF_DENSITY, particle))
    top_layer.setNumberOfSlices(N_SLICES)

    sample = ba.Sample()
    sample.addLayer(top_layer)
    sample.addLayer(ba.Layer(substrate_mat))
    return sample


def get_simulation(sample):
    n = 500
    lam = WAVELENGTH
    qs = [4*pi*sin(a)/lam for a in np.linspace(5*deg/n, 5*deg, n)]
    scan = ba.QzScan(qs)
    return ba.SpecularSimulation(scan, sample)


if __name__ == '__main__':
    sample = get_sample()
    ba.showSample3D(sample, sample_size=120*nm, seed=0)
    simulation = get_simulation(sample)
    result = simulation.simulate()
    ba.plot_datafield(result)
    ba.plt.show()
auto/Examples/specular/interfaces/SpecularWithSlicing2Q.py