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"]
# ///
"""
Polarized neutron reflectometry in a strong applied magnetic field.
An Fe film on Si, magnetized along x, in a field of 0.5 T applied along y
(the field is set in A/m through sample.setExternalField). The field
permeates the top layer, where it splits the kinetic energies of
the two spin states (Zeeman effect): a spin-flipped neutron leaves at an
angle different from the incident one, and below a cutoff angle one of
the spin-flip channels (MP) is closed, while the other (PM) is enhanced.
Polarizer and analyzer must be parallel or antiparallel to the field.
"""
import bornagain as ba
ba.require_versions("bornagain>=25,<26")
from bornagain import angstrom, deg, nm, R3
def get_sample():
vacuum = ba.Vacuum()
fe_color = (0.48, 0.32, 0.80)
fe_mat = ba.SLDMaterial("Fe", fe_color, 8.02e-6, 0, R3(1.7e6, 0, 0))
si_color = (0.93, 0.72, 0.25)
si_mat = ba.SLDMaterial("Si", si_color, 2.07e-6, 0)
sample = ba.Sample()
sample.addLayer(ba.Layer(vacuum))
sample.addLayer(ba.Layer(fe_mat, 20*nm))
sample.addLayer(ba.Layer(si_mat))
sample.setExternalField(R3(0, 0.5*ba.tesla, 0)) # mu_0 H = 0.5 T along y
return sample
def simulate(sample, pol, an, title):
n = 500
scan = ba.AlphaScan(n, 1.5*deg/n, 1.5*deg)
scan.setWavelength(5*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=60*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()
|