Polarized neutron reflectometry with a magnetic layer

This is the introductory example for specular reflectometry with polarized neutrons.

The sample consists of a single magnetic layer on top of a substrate. The magnetic field vector B lies in the xy plane. The field direction forms an angle of Bang = 30 * deg with the x axis. The field magnitude Bmag=1e8 is in units of A/m. The field is passed as an optional function argument to the constructor ba.MaterialBySLD.

The neutron polarizer and analyzer directions are set through

    scan.setPolarization(polarizer_dir)
    scan.setAnalyzer(analyzer_dir, 1, 0.5)

The resulting reflectivities are shown in this plot:

Reflectivity

As expected, we find the birefringent behavior. The critical angles also depends on the polarization.

The curve for polarizer settings -+ is not shown because it coincides with the +- curve.

Here is the complete example:

 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
"""
Introductory example for polarized neutron reflectivity.
Sample is a magnetic layer.
"""
import bornagain as ba
from bornagain import angstrom, ba_plot as bp, deg, nm, R3
from math import sin, cos


def get_sample():
    # Magnetic field
    Bmag = 1e8
    Bangle = 60*deg
    B = R3(Bmag*cos(Bangle), Bmag*sin(Bangle), 0)

    # Materials
    vacuum = ba.MaterialBySLD("Vacuum", 0, 0)
    material_layer = ba.MaterialBySLD("Layer", 0.0001, 1e-08, B)
    material_substrate = ba.MaterialBySLD("Substrate", 7e-05, 2e-06)

    # Layers
    layer_1 = ba.Layer(vacuum)
    layer_2 = ba.Layer(material_layer, 10*nm)
    layer_3 = ba.Layer(material_substrate)

    # Sample
    sample = ba.MultiLayer()
    sample.addLayer(layer_1)
    sample.addLayer(layer_2)
    sample.addLayer(layer_3)

    return sample


def simulate(sample, polarizer_dir, analyzer_dir, title):
    n = 500
    scan = ba.AlphaScan(n, 5*deg/n, 5*deg)
    scan.setWavelength(1.54*angstrom)
    scan.setPolarization(polarizer_dir)
    scan.setAnalyzer(analyzer_dir)

    simulation = ba.SpecularSimulation(scan, sample)

    result = simulation.simulate()
    result.setTitle(title)
    return result


if __name__ == '__main__':
    sample = get_sample()
    results = [
        simulate(sample, R3(0, +1, 0), R3(0, +1, 0), "$++$"),
        simulate(sample, R3(0, +1, 0), R3(0, -1, 0), "$+-$"),
        simulate(sample, R3(0, -1, 0), R3(0, -1, 0), "$--$"),
    ]

    bp.plot_multicurve_specular(results)
auto/Examples/specular/MagneticLayer.py