Film vs monolayer

This example compares a random particle monolayer created with deposit2D to films filled with the same areal amount of particles using fill3D. Increasing the film thickness redistributes that fixed amount through the layer volume and shows how the scattering evolves away from the monolayer limit.

Result

Film vs monolayer result

Sample

Film vs monolayer sample

Python script

 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
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = ["bornagain>=25,<26"]
# ///
"""
Dilute film of small spheres
"""
import bornagain as ba
ba.require_versions("bornagain>=25,<26")
from bornagain import deg, nm, nm2, nm3

particle_radius = 4*nm
particle_height = 2*particle_radius
area_density = .016/nm2


def get_sample(thickness):
    # Materials
    particle_color = (0.86, 0.24, 0.18)
    particle_mat = ba.RefractiveMaterial("Particle", particle_color, 1.5e-05, 2e-08)
    substrate_color = (0.28, 0.57, 0.82)
    substrate_mat = ba.RefractiveMaterial("Substrate", substrate_color, 1e-06, 2e-08)
    vacuum = ba.Vacuum()

    # Particles
    ff = ba.Sphere(particle_radius)
    particle = ba.Particle(particle_mat, ff)

    # Layers
    layer_1 = ba.Layer(vacuum)
    layer_3 = ba.Layer(substrate_mat)
    if thickness > 0:
        layer_2 = ba.Layer(substrate_mat, thickness)
        volume_density = area_density/thickness
        layer_2.fill3D(ba.Dilute3D(volume_density, particle))
    else:
        layer_1.deposit2D(ba.Dilute2D(area_density, particle))

    # Sample
    sample = ba.Sample()
    sample.addLayer(layer_1)
    if thickness > 0:
        sample.addLayer(layer_2)
    sample.addLayer(layer_3)

    return sample


def get_simulation(sample):
    beam = ba.Beam(1e9, 0.1*nm, 0.2*deg)
    n = 100
    # Just compute a 1d cut at phi=0
    detector = ba.SphericalDetector(1, -1*deg, 1*deg, n, 0., 2*deg)
    simulation = ba.ScatteringSimulation(beam, sample, detector)
    return simulation


if __name__ == '__main__':
    thicknesses = [
        0*nm, particle_height, 2*particle_height, 4*particle_height,
        8*particle_height
    ]
    labels = ["Monolayer"]
    labels.extend(f'{t/nm:.0f} nm' for t in thicknesses[1:])
    samples = [ get_sample(t) for t in thicknesses ]
    results = [ get_simulation(sample).simulate() for sample in samples ]
    ba.showSample3D(samples[-1], sample_size=80*nm, seed=0)
    for r in results:
        ba.plot_datafield(r, intensity_max=1e6, intensity_min=1e-4)
    ba.plt.legend(labels)
    ba.plt.show()
auto/Examples/gisas/sample/FilmVsMonolayer.py