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
|
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["bornagain>=25,<26"]
# ///
"""
Polarized neutron reflectometry of a 4x Fe/Ni bilayer on Au substrate
with TanhTransient interface roughness.
Four-channel (PP, PM, MP, MM) angle-scan. The Fe magnetization is
rotated 38 deg from the Y axis, enabling spin-flip scattering (PM, MP
non-zero).
See PolarizedFeNiBilayerTanh.py for the two-channel variant
(0 deg tilt, PM=MP=0).
Compare PolarizedFeNiBilayerSpinFlipTanhQ.py for the Q-space equivalent.
"""
from math import cos, sin
import bornagain as ba
ba.require_versions("bornagain>=25,<26")
from bornagain import angstrom, deg, nm, R3
def get_sample():
vacuum = ba.Vacuum()
mag_vec = R3(sin(38*deg), cos(38*deg), 0) * 1e7
fe_color = (0.48, 0.32, 0.80)
fe_mat = ba.SLDMaterial("Fe", fe_color, 8.02e-6, 0, mag_vec)
ni_color = (0.93, 0.48, 0.14)
ni_mat = ba.SLDMaterial("Ni", ni_color, 9.4245e-6, 0)
substrate_color = (0.93, 0.72, 0.25)
substrate_mat = ba.SLDMaterial("Au", substrate_color, 4.6665e-6, 0)
autocorr = ba.SelfAffineFractalModel(0.2*nm, 0.7, 25*nm)
roughness = ba.Roughness(autocorr, ba.TanhTransient())
stack = ba.LayerStack(4)
stack.addLayer(ba.Layer(fe_mat, 10*nm, roughness))
stack.addLayer(ba.Layer(ni_mat, 4*nm, roughness))
sample = ba.Sample()
sample.addLayer(ba.Layer(vacuum))
sample.addStack(stack)
sample.addLayer(ba.Layer(substrate_mat, roughness))
return sample
def simulate(sample, pol, an, title):
n = 500
scan = ba.AlphaScan(n, 5*deg/n, 5*deg)
scan.setWavelength(1.54*angstrom)
scan.setPolarization(pol)
scan.setAnalyzer(an)
result = ba.SpecularSimulation(scan, sample).simulate()
result.setTitle(title)
return result
if __name__ == '__main__':
sample = get_sample()
ba.showSample3D(sample, sample_size=120*nm, seed=0)
results = [
simulate(sample, R3(0, +1, 0), R3(0, +1, 0), "PP"),
simulate(sample, R3(0, +1, 0), R3(0, -1, 0), "PM"),
simulate(sample, R3(0, -1, 0), R3(0, +1, 0), "MP"),
simulate(sample, R3(0, -1, 0), R3(0, -1, 0), "MM"),
]
ba.plot_multicurve(results)
ba.plt.show()
|