Debian Codegraph @

rawEx/specular/PolarizedFeNiBilayerSpinFlipNC.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 """
3 Polarized neutron reflectometry of a 4x Fe/Ni bilayer on Au substrate
4 with ErfTransient (Nevot-Croce) interface roughness.
5
6 Four-channel (PP, PM, MP, MM) angle-scan. The Fe magnetization is
7 rotated 38 deg from the Y axis, enabling spin-flip scattering (PM, MP
8 non-zero).
9 See PolarizedFeNiBilayerNC.py for the two-channel variant
10 (0 deg tilt, PM=MP=0).
11
12 Compare PolarizedFeNiBilayerSpinFlipNCQ.py for the Q-space
13 equivalent.
14 """
15 from math import cos, sin
16 import bornagain as ba
17 from bornagain import angstrom, ba_plot as bp, deg, nm, R3
18
19
20 def get_sample():
21 vacuum = ba.Vacuum()
22 mag_vec = R3(sin(38*deg), cos(38*deg), 0) * 1e7
23 fe_color = (0.48, 0.32, 0.80)
24 fe_mat = ba.SLDMaterial("Fe", fe_color, 8.02e-6, 0, mag_vec)
25 ni_color = (0.93, 0.48, 0.14)
26 ni_mat = ba.SLDMaterial("Ni", ni_color, 9.4245e-6, 0)
27 substrate_color = (0.93, 0.72, 0.25)
28 substrate_mat = ba.SLDMaterial("Au", substrate_color, 4.6665e-6, 0)
29
30 autocorr = ba.SelfAffineFractalModel(0.2*nm, 0.7, 25*nm)
31 roughness = ba.Roughness(autocorr, ba.ErfTransient())
32
33 stack = ba.LayerStack(4)
34 stack.addLayer(ba.Layer(fe_mat, 10*nm, roughness))
35 stack.addLayer(ba.Layer(ni_mat, 4*nm, roughness))
36
37 sample = ba.Sample()
38 sample.addLayer(ba.Layer(vacuum))
39 sample.addStack(stack)
40 sample.addLayer(ba.Layer(substrate_mat, roughness))
41 return sample
42
43
44 def simulate(sample, pol, an, title):
45 n = <%= test_mode ? 50 : 500 %>
46 scan = ba.AlphaScan(n, 5*deg/n, 5*deg)
47 scan.setWavelength(1.54*angstrom)
48 scan.setPolarization(pol)
49 scan.setAnalyzer(an)
50 result = ba.SpecularSimulation(scan, sample).simulate()
51 result.setTitle(title)
52 return result
53
54
55 if __name__ == '__main__':
56 sample = get_sample()
57 <%- unless test_mode || figure_mode -%>
58 ba.showSample3D(sample, sample_size=120*nm, seed=0)
59 <%- end -%>
60 results = [
61 simulate(sample, R3(0, +1, 0), R3(0, +1, 0), "PP"),
62 simulate(sample, R3(0, +1, 0), R3(0, -1, 0), "PM"),
63 simulate(sample, R3(0, -1, 0), R3(0, +1, 0), "MP"),
64 simulate(sample, R3(0, -1, 0), R3(0, -1, 0), "MM"),
65 ]
66 <%= include_partial("template/main/plot_multicurve.py") -%>