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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["bornagain>=25,<26"]
# ///
"""
Off-specular polarized neutron scattering from magnetic stripe domains.
The geometry follows the domain model from Saerbeck et al.,
Nanomaterials 10, 752 (2020): a CoFe/IrMn thin-film stack with a
periodic head-to-head/tail-to-tail stripe pattern in the CoFe layer.
"""
from math import cos, sin
import bornagain as ba
ba.require_versions("bornagain>=25,<26")
from bornagain import R3, deg, micrometer, nm
colors = {
"TaOx": (0.72, 0.72, 0.72),
"Ta": (0.45, 0.45, 0.48),
"CoFe": (0.48, 0.32, 0.80),
"IrMn": (0.86, 0.24, 0.18),
"Cu": (0.94, 0.54, 0.20),
"SiO2": (0.28, 0.57, 0.82),
"Si": (0.35, 0.35, 0.35),
}
sld = {
"TaOx": (5.54e-6, 3.3e-9),
"Ta": (3.52e-6, 3.3e-9),
"CoFe": (4.17e-6, 3.7e-9),
"IrMn": (-0.74e-6, 18.2e-9),
"Cu": (5.57e-6, 0.7e-9),
"SiO2": (3.66e-6, 0.012e-9),
"Si": (2.10e-6, 0.023e-9),
}
thickness = {
"TaOx": 3.1*nm,
"Ta": 8.3*nm,
"CoFe": 6.1*nm,
"IrMn": 29.6*nm,
"Cu": 3.7*nm,
"SiO2": 1.0*nm,
"Si": None,
}
def B(Bmag, Bangle_deg):
Bangle = Bangle_deg*deg
return R3(Bmag*sin(Bangle), Bmag*cos(Bangle), 0)
def stripes_layout():
stripe_length = 1000*micrometer
Bmag = 1.71e6
width_right = 5.3*micrometer
formfactor_right = ba.Box(width_right, stripe_length, thickness["CoFe"])
m_right = ba.SLDMaterial("CoFe_right", colors["CoFe"], *sld["CoFe"], B(Bmag, 89))
stripe_right = ba.Particle(m_right, formfactor_right)
width_left = 3.7*micrometer
formfactor_left = ba.Box(width_left, stripe_length, thickness["CoFe"])
m_left = ba.SLDMaterial("CoFe_left", colors["CoFe"], *sld["CoFe"], B(Bmag, -82))
stripe_left = ba.Particle(m_left, formfactor_left)
width_wall = 0.6*micrometer
formfactor_wall = ba.Box(width_wall, stripe_length, thickness["CoFe"])
m_wall = ba.SLDMaterial("CoFe_wall", colors["CoFe"], *sld["CoFe"], B(Bmag, 0))
stripe_wall = ba.Particle(m_wall, formfactor_wall)
cell = ba.Compound()
cell.addComponent(stripe_right)
cell.addComponent(stripe_wall, R3(width_right, 0, 0))
cell.addComponent(stripe_left, R3(width_right + width_wall, 0, 0))
cell.addComponent(stripe_wall, R3(width_right + width_wall + width_left, 0, 0))
period = width_right + width_left + 2*width_wall
layout = ba.Crystal1D(cell, period, 0, (1 - 1e-9)/stripe_length)
layout.setDecayFunction(ba.Profile1DCauchy(6*period))
return layout
def get_sample():
material_taox = ba.SLDMaterial("TaOx", colors["TaOx"], *sld["TaOx"])
material_ta = ba.SLDMaterial("Ta", colors["Ta"], *sld["Ta"])
material_cofe = ba.SLDMaterial("CoFe", colors["CoFe"], *sld["CoFe"])
material_irmn = ba.SLDMaterial("IrMn_nm", colors["IrMn"], *sld["IrMn"], B(0, 0))
material_cu = ba.SLDMaterial("Cu", colors["Cu"], *sld["Cu"])
material_sio2 = ba.SLDMaterial("SiO2", colors["SiO2"], *sld["SiO2"])
material_si = ba.SLDMaterial("Si", colors["Si"], *sld["Si"])
sample = ba.Sample()
sample.addLayer(ba.Layer(ba.Vacuum()))
sample.addLayer(ba.Layer(material_taox, thickness["TaOx"]))
sample.addLayer(ba.Layer(material_ta, thickness["Ta"]))
layer_cofe = ba.Layer(material_cofe, thickness["CoFe"])
layer_cofe.deposit2D(stripes_layout())
sample.addLayer(layer_cofe)
sample.addLayer(ba.Layer(material_irmn, thickness["IrMn"]))
sample.addLayer(ba.Layer(material_cu, thickness["Cu"]))
sample.addLayer(ba.Layer(material_sio2, thickness["SiO2"]))
sample.addLayer(ba.Layer(material_si))
return sample
def get_simulation(sample, grazing_angle, alpha_f_min, alpha_f_max, polarization):
nlambda = 115
nalpha = 115
scan = ba.LambdaScan(nlambda, 0.4*nm, 2.0*nm)
scan.setIntensity(1)
scan.setGrazingAngle(grazing_angle)
scan.setPolarization(polarization)
beam_divergence = ba.DistributionLorentz(
0, 0.01*deg, 9, 5)
scan.setGrazingAngleDistribution(beam_divergence)
phi_range = 0.0001*deg
detector = ba.OffspecDetector(
nalpha, alpha_f_min, alpha_f_max, -phi_range/2, +phi_range/2)
simulation = ba.OffspecSimulation(scan, sample, detector)
simulation.options().setIncludeSpecular(True)
simulation.options().setOffspecIntegratorOptions(
"AdaptiveGaussKronrod",
{
"max_subintervals": 100,
"abs_tolerance": 1e-3,
"rel_tolerance": 1e-2,
"GK_rule": 2,
})
return simulation
def simulate(grazing_angle, alpha_f_min, alpha_f_max, polarization, title):
sample = get_sample()
simulation = get_simulation(
sample, grazing_angle, alpha_f_min, alpha_f_max, polarization)
result = simulation.simulate()
result = ba.FrameTrafo.Transpose(result)
result.setTitle(title)
return result
if __name__ == '__main__':
ba.showSample3D(get_sample(), sample_size=25*micrometer, seed=0)
pol = R3(0, +1, 0)
results = [
simulate(0.5*deg, 0.2*deg, 2.0*deg, pol, r"$R^+$, $\theta_i=0.5^\circ$"),
simulate(1.5*deg, 0.2*deg, 3.0*deg, pol, r"$R^+$, $\theta_i=1.5^\circ$"),
]
max_val = max(result.maxVal() for result in results)
intensity_max = max_val/4
intensity_min = intensity_max/10**4.5
ba.plot2d_to_row(
results,
cmap="jet",
intensity_max=intensity_max,
intensity_min=intensity_min,
frame_aspect=1)
ba.plt.show()
|