Specular with slicing 1

Result

Specular with slicing 1 result

Sample

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

A layer of cylinders defined with RefractiveMaterial is subdivided into
N horizontal slabs. Results must agree with SpecularWithSlicing2.py
(SLD-material variant), demonstrating the numerical equivalence of both
material representations.
"""
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 get_sample():
    vacuum = ba.Vacuum()
    substrate_color = (0.28, 0.57, 0.82)
    substrate_mat = ba.RefractiveMaterial("Substrate", substrate_color, 6e-6, 2e-8)
    particle_color = (0.86, 0.24, 0.18)
    particle_mat = ba.RefractiveMaterial("Particle", particle_color, 6e-4, 2e-8)

    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
    scan = ba.AlphaScan(n, 5*deg/n, 5*deg)
    scan.setWavelength(WAVELENGTH)
    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/SpecularWithSlicing1.py