# Two types of cylinders with size distribution

Scattering of a polydisperse distribution of two types of cylinders.

• The simulation is performed using the Born approximation, i.e. there is no "substrate" layer.
• The sample is made of polydisperse cylinders of two different sizes: R1 = H1 and R2 = H2, where Ri and Hi are the radius and width of cylinder of type i.
• There are 95% of cylinders of type 1 and 5% of cylinders of type 2.
• The polydispersity affects the radii of the cylinders, following a normal distribution. For the small cylinders, their characteristic sizes vary around R1 = 5 nm with a standard deviation σ1 = 0.2 R1. For type 2, the average value R2 is 10 nm and σ2 = 0.02 R2.
• There is also no interference between the scattered beams.
• The incident beam is characterized by a wavelength of 1 Å.
• The incident angles αi = 0.2° and Φi = 0°.

Real-space model:
Intensity Image:
Python Script:
```"""
Mixture cylinder particles with different size distribution
"""
import bornagain as ba
from bornagain import deg, angstrom, nm

def get_sample():
"""
Returns a sample with cylinders in a homogeneous medium ("air").
The cylinders are a 95:5 mixture of two different size distributions.
"""
# defining materials
m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

# collection of particles #1

cylinder1 = ba.Particle(m_particle, cylinder_ff1)

nparticles = 150
sigma_factor = 3.0

# limits will assure, that generated Radius'es are >=0
limits = ba.RealLimits.nonnegative()

par_distr1 = ba.ParameterDistribution(
part_coll1 = ba.ParticleDistribution(cylinder1, par_distr1)

# collection of particles #2

cylinder2 = ba.Particle(m_particle, cylinder_ff2)

par_distr2 = ba.ParameterDistribution(
part_coll2 = ba.ParticleDistribution(cylinder2, par_distr2)

# assembling the sample
particle_layout = ba.ParticleLayout()

air_layer = ba.Layer(m_air)

multi_layer = ba.MultiLayer()
return multi_layer

def get_simulation():
"""
Create and return GISAXS simulation with beam and detector defined
"""
simulation = ba.GISASSimulation()
simulation.setDetectorParameters(200, 0.0*deg, 2.0*deg,
200, 0.0*deg, 2.0*deg)
simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg)
return simulation

def run_simulation():
"""
Runs simulation and returns intensity map.
"""
simulation = get_simulation()
simulation.setSample(get_sample())
simulation.runSimulation()
return simulation.getIntensityData()

if __name__ == '__main__':
result = run_simulation()
ba.plot_intensity_data(result)

```