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
|
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["bornagain>=25,<26"]
# ///
"""
Off-specular scattering from a Ti/Pt resonator on Si with D2O supernatant.
Sample: Si | 3x(Ti(13nm) + Pt(32nm)) | Ti_top(10nm) | TiO2(3nm) | D2O
All interfaces share SelfAffineFractal roughness (sigma=2nm, Hurst=0.8,
corrLen=1e4nm) with TanhTransient and CommonDepthCrosscorrelation (400nm).
"""
import bornagain as ba
ba.require_versions("bornagain>=25,<26")
from bornagain import angstrom, deg, nm
def get_sample():
m_si_color = (0.30, 0.62, 0.86)
m_si = ba.RefractiveMaterial("Si", m_si_color, 8.25218379931e-06, 0)
m_ti_color = (0.05, 0.62, 0.55)
m_ti = ba.RefractiveMaterial(
"Ti", m_ti_color, -7.6593316363e-06, 3.81961616312e-09)
m_tio2_color = (0.48, 0.32, 0.80)
m_tio2 = ba.RefractiveMaterial(
"TiO2", m_tio2_color, 1.04803530026e-05, 2.03233519385e-09)
m_pt_color = (0.93, 0.72, 0.25)
m_pt = ba.RefractiveMaterial(
"Pt", m_pt_color, 2.52936993309e-05, 7.54553992473e-09)
m_d2o_color = (0.90, 0.93, 0.97)
m_d2o = ba.RefractiveMaterial(
"D2O", m_d2o_color, 2.52897204573e-05, 4.5224432814e-13)
autocorr = ba.SelfAffineFractalModel(2*nm, 0.8, 1e4*nm)
transient = ba.TanhTransient()
crosscorr = ba.CommonDepthCrosscorrelation(400*nm)
roughness = ba.Roughness(autocorr, transient, crosscorr)
ti_thickness = 13*nm
l_ti = ba.Layer(m_ti, ti_thickness, roughness)
l_pt = ba.Layer(m_pt, 32*nm, roughness)
l_ti_top = ba.Layer(m_ti, 10*nm, roughness)
l_tio2 = ba.Layer(m_tio2, 3*nm, roughness)
sample = ba.Sample()
sample.addLayer(ba.Layer(m_si))
for _ in range(3):
sample.addLayer(l_ti)
sample.addLayer(l_pt)
sample.addLayer(l_ti_top)
sample.addLayer(l_tio2)
sample.addLayer(ba.Layer(m_d2o, roughness))
return sample
def get_simulation(sample):
nscan = 100
ndet = 100
scan = ba.AlphaScan(nscan, 0.2*deg, 4*deg)
scan.setWavelength(5*angstrom)
scan.setIntensity(1e9)
detector = ba.OffspecDetector(ndet, 0.1*deg, 5.1*deg, -0.1*deg, 0.1*deg)
simulation = ba.OffspecSimulation(scan, sample, detector)
simulation.options().setIncludeSpecular(True)
return simulation
if __name__ == '__main__':
sample = get_sample()
simulation = get_simulation(sample)
result = simulation.simulate()
ba.showSample3D(sample, sample_size=250*nm, seed=0)
ba.plot_datafield(result, unit_aspect=1, intensity_min=1e-3,
intensity_max=1e9)
ba.plt.show()
|