Polarized SANS

This example shows how to simulate polarized SANS with BornAgain, using the Born Approximation.

While BornAgain is designed for GISAS experiments (using the Distorted Wave Born Approximation), it naturally also contains the regular (plane wave) Born Approximation. Accordingly, BornAgain can also simulate standard small-angle scattering (SAS).

However, there exist several other specialized SAS softwares. Therefore we do not advertise BornAgain for analysing SAS experiments, and in general we do not provide user support for this application domain. We rather recommend SASView, which is institutionally supported by the European Spallation Source, and was designated as standard SAS software in the European SINE2020 project.

Yet BornAgain can be an appropriate choice in cases where the sample structure or the experimental conditions are not covered by other software. For example, other softwares provide no, or limited, support for polarized SANS. Here, we show how such experiments can be simulated with BornAgain.

The main difference between simulating GISAS and SAS in BornAgain is the presence of only a single layer in the multilayer object. This triggers the software to calculate the differential scattering cross section in the Born Approximation:

multiLayer = ba.MultiLayer()
multiLayer.addLayer(solvent_layer)

The rest of the example script hereafter contains nothing new compared to the previous examples. A sample with a magnetic core-shell particle is constructed. Beam and detector are setup to detect the spin-flip scattering channel and the result of this simulation is plotted as usual.

Intensity images

 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
#!/usr/bin/env python3
"""
Simple example demonstrating how polarized SANS experiments can be
simulated with BornAgain.
"""

import bornagain as ba
from bornagain import angstrom, deg, nm, nm2, kvector_t

# Magnetization of the particle's core material (A/m)
magnetization_core = kvector_t(0.0, 0.0, 1e7)


def get_sample():
    """
    Returns a sample with a magnetic core-shell particle in a solvent.
    """

    # Define materials
    magnetic_field = kvector_t(0, 0, 10000000)
    material_Core = ba.HomogeneousMaterial("Core", 6e-06, 2e-08, magnetic_field)
    material_Shell = ba.HomogeneousMaterial("Shell", 1e-07, 2e-08)
    material_Solvent = ba.HomogeneousMaterial("Solvent", 5e-06, 0.0)

    # Define form factors
    ff_1 = ba.FormFactorFullSphere(10.0*nm)
    ff_2 = ba.FormFactorFullSphere(12.0*nm)

    # Define particles
    particle_1 = ba.Particle(material_Core, ff_1)
    particle_1_position = kvector_t(0.0*nm, 0.0*nm, 2.0*nm)
    particle_1.setPosition(particle_1_position)
    particle_2 = ba.Particle(material_Shell, ff_2)

    # Define core shell particles
    particle_3 = ba.ParticleCoreShell(particle_2, particle_1)

    # Define particle layouts
    layout = ba.ParticleLayout()
    layout.addParticle(particle_3, 1.0)
    layout.setWeight(1)
    layout.setTotalParticleSurfaceDensity(0.01)

    # Define layers
    layer = ba.Layer(material_Solvent)
    layer.addLayout(layout)

    # Define sample
    sample = ba.MultiLayer()
    sample.addLayer(layer)

    return sample


def get_simulation(sample):
    """
    Returns a polarized SANS simulation
    """
    simulation = ba.GISASSimulation()

    # Defining detector
    simulation.setDetectorParameters(200, -3.0*deg, 3.0*deg, 200, -3.0*deg,
                                     3.0*deg)

    # Defining beam parameters
    simulation.setBeamParameters(0.5*nm, 0.0*deg, 0.0*deg)
    simulation.beam().setIntensity(1e12)

    # Defining beam polarization and polarization analysis for spin-flip channel
    analyzer_dir = kvector_t(0.0, 0.0, -1.0)
    beampol = kvector_t(0.0, 0.0, 1.0)
    simulation.beam().setPolarization(beampol)
    simulation.setAnalyzerProperties(analyzer_dir, 1.0, 0.5)
    simulation.setSample(sample)
    return simulation


if __name__ == '__main__':
    import ba_plot
    sample = get_sample()
    simulation = get_simulation(sample)
    ba_plot.run_and_plot(simulation, units=ba.Axes.QSPACE)
PolarizedSANS.py