Simulation types: Small-angle scattering

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.

Basic example

To simulate conventional small-angle scattering with BornAgain, we turn source and detector by 90 degrees with respect to grazing-incidence geometry.

The following basic example simulates scattering from a dilute random assembly of monodisperse, oriented dodecahedra.

Intensity image

 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
#!/usr/bin/env python3
"""
Basic example for regular small-angle scattering (SAS).
Sample is a dilute assembly of ordered dodecahedra.
"""

import bornagain as ba
from bornagain import ba_plot as bp, deg, nm


def get_sample():
    m_vacuum = ba.RefractiveMaterial("Vacuum", 0, 0)
    m_solution = ba.RefractiveMaterial("Solution", 6e-6, 2e-8)
    m_particle = ba.RefractiveMaterial("Particle", 6e-4, 2e-8)

    # Finite sample layer, contains particles in solution:
    ff = ba.Dodecahedron(12*nm)
    particle = ba.Particle(m_particle, ff)
    layout = ba.ParticleLayout()
    layout.addParticle(particle)
    solution_layer = ba.Layer(m_solution, 1000*nm)
    # TODO: make intensity proportional to thickness,
    #       https://github.com/scgmlz/BornAgain/issues/1222
    solution_layer.addLayout(layout)

    # Flat sample layer sandwiched between semi-infinite vacuum layers:
    sample = ba.MultiLayer()
    sample.addLayer(ba.Layer(m_vacuum))
    sample.addLayer(solution_layer)
    sample.addLayer(ba.Layer(m_vacuum))
    return sample


def get_simulation(sample):
    # Beam from above (perpendicular to sample):
    beam = ba.Beam(1, 0.4*nm, ba.Direction(90*deg, 0))

    # Detector opposite to source:
    detPos = 2000  # distance from sample center to detector in mm
    detWid = 500  # detector width in mm
    detPix = 200  # number of pixels per direction
    det = ba.RectangularDetector(detPix, detWid, detPix, detWid)
    det.setPerpendicularToDirectBeam(detPos, detWid/2, detWid/2)

    return ba.ScatteringSimulation(beam, sample, det)


if __name__ == '__main__':
    bp.parse_args(sim_n=0)
    sample = get_sample()
    simulation = get_simulation(sample)
    result = simulation.simulate()
    bp.plot_simulation_result(result)
Examples/scatter2d/DodecahedraSAS.py