1
|
"""
|
2
|
Cylinder formfactor in Born approximation
|
3
|
"""
|
4
|
import bornagain as ba
|
5
|
from bornagain import deg, angstrom, nm
|
6
|
|
7
|
|
8
|
def get_sample_script1():
|
9
|
"""
|
10
|
Returns a sample with cylinders in a homogeneous environment ("air"),
|
11
|
implying a simulation in plain Born approximation.
|
12
|
"""
|
13
|
|
14
|
m_ambience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
|
15
|
m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)
|
16
|
|
17
|
|
18
|
cylinder_ff = ba.FormFactorCylinder(5*nm, 5*nm)
|
19
|
cylinder = ba.Particle(m_particle, cylinder_ff)
|
20
|
particle_layout = ba.ParticleLayout()
|
21
|
particle_layout.addParticle(cylinder, 1.0)
|
22
|
|
23
|
air_layer = ba.Layer(m_ambience)
|
24
|
air_layer.addLayout(particle_layout)
|
25
|
|
26
|
multi_layer = ba.MultiLayer()
|
27
|
multi_layer.addLayer(air_layer)
|
28
|
return multi_layer
|
29
|
|
30
|
|
31
|
def get_simulation():
|
32
|
"""
|
33
|
Returns a GISAXS simulation with beam and detector defined
|
34
|
"""
|
35
|
simulation = ba.GISASSimulation()
|
36
|
simulation.setDetectorParameters(200, -2.0*deg, 2.0*deg,
|
37
|
200, 0.0*deg, 2.0*deg)
|
38
|
simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg)
|
39
|
return simulation
|
40
|
|
41
|
|
42
|
def run_simulation():
|
43
|
"""
|
44
|
Runs simulation and returns intensity map.
|
45
|
"""
|
46
|
simulation = get_simulation()
|
47
|
simulation.setSample(get_sample())
|
48
|
simulation.runSimulation()
|
49
|
return simulation.result()
|
50
|
|
51
|
|
52
|
if __name__ == '__main__':
|
53
|
result = run_simulation()
|
54
|
ba.plot_simulation_result(result)
|