def get_sample():
    """
    Returns a sample with cylinders on a substrate.
    """
    # defining materials
    m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0)
    m_layer = ba.HomogeneousMaterial("Layer", 3e-6, 2e-8)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 3e-5, 2e-8)

    # cylindrical particle
    half_sphere_ff = ba.FormFactorTruncatedSphere(sphere_radius, sphere_radius,
                                                  0)
    half_sphere = ba.Particle(m_particle, half_sphere_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(half_sphere)

    # interference function
    interference = ba.InterferenceFunction2DLattice.createSquare(
        10 * nm, 0 * deg)
    pdf = ba.FTDecayFunction2DCauchy(100 * nm, 100 * nm, 0)
    interference.setDecayFunction(pdf)
    particle_layout.setInterferenceFunction(interference)

    vacuum_layer = ba.Layer(m_vacuum)
    vacuum_layer.addLayout(particle_layout)
    vacuum_layer.setNumberOfSlices(n_slices)
    substrate_layer = ba.Layer(m_substrate)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(vacuum_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
Example #2
0
def get_sample():
    """
    Returns a sample with spherical particles on a substrate,
    forming a hexagonal 2D lattice.
    """
    m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    sphere_ff = ba.FormFactorFullSphere(10.0 * nm)
    sphere = ba.Particle(m_particle, sphere_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(sphere)

    interference = ba.InterferenceFunction2DLattice.createHexagonal(20.0 * nm)
    pdf = ba.FTDecayFunction2DCauchy(10 * nm, 10 * nm)
    interference.setDecayFunction(pdf)

    particle_layout.setInterferenceFunction(interference)

    air_layer = ba.Layer(m_air)
    air_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate, 0)
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
def get_sample():
    """
    Returns a sample with cylinders on a substrate,
    forming a 2D lattice with different disorder rotated lattice
    """
    m_ambience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    air_layer = ba.Layer(m_ambience)
    substrate_layer = ba.Layer(m_substrate)

    p_interference_function = \
        ba.InterferenceFunction2DLattice.createSquare(25.0*nm)
    pdf = ba.FTDecayFunction2DCauchy(300.0 * nm / 2.0 / numpy.pi,
                                     100.0 * nm / 2.0 / numpy.pi)
    p_interference_function.setDecayFunction(pdf)

    particle_layout = ba.ParticleLayout()
    ff_cyl = ba.FormFactorCylinder(3.0 * nm, 3.0 * nm)
    position = ba.kvector_t(0.0, 0.0, 0.0)
    cylinder = ba.Particle(m_particle, ff_cyl.clone())
    cylinder.setPosition(position)
    particle_layout.addParticle(cylinder, 1.0)
    particle_layout.setInterferenceFunction(p_interference_function)

    air_layer.addLayout(particle_layout)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
def get_sample():
    """
    Returns a sample with spheres on a substrate,
    forming two hexagonal close packed layers.
    """
    m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    radius = 10.0 * nm
    sphere_ff = ba.FormFactorFullSphere(radius)
    sphere = ba.Particle(m_particle, sphere_ff)
    particle_layout = ba.ParticleLayout()

    pos0 = ba.kvector_t(0.0, 0.0, 0.0)
    pos1 = ba.kvector_t(radius, radius, numpy.sqrt(3.0) * radius)
    basis = ba.ParticleComposition()
    basis.addParticles(sphere, [pos0, pos1])
    particle_layout.addParticle(basis)

    interference = ba.InterferenceFunction2DLattice.createHexagonal(radius *
                                                                    2.0)
    pdf = ba.FTDecayFunction2DCauchy(10 * nm, 10 * nm)
    interference.setDecayFunction(pdf)

    particle_layout.setInterferenceFunction(interference)

    air_layer = ba.Layer(m_air)
    air_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate, 0)
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
def get_sample():
    """
    Returns a sample with cylinders on a substrate, forming a rotated 2D lattice
    """
    # defining materials
    m_ambience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    # collection of particles
    interference = ba.InterferenceFunction2DLattice.createSquare(
        25.0*nm, 30.0*deg)
    pdf = ba.FTDecayFunction2DCauchy(
        300.0*nm/2.0/numpy.pi, 100.0*nm/2.0/numpy.pi)
    pdf.setGamma(30.0*deg)
    interference.setDecayFunction(pdf)

    cylinder_ff = ba.FormFactorCylinder(3.*nm, 3.*nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder)
    particle_layout.setInterferenceFunction(interference)

    # assembling the sample
    air_layer = ba.Layer(m_ambience)
    air_layer.addLayout(particle_layout)

    substrate_layer = ba.Layer(m_substrate)
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
def get_sample(cyl_height=5 * nm):
    """
    Returns a sample with cylinders on a substrate.
    """
    # defining materials
    m_ambience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_layer = ba.HomogeneousMaterial("Layer", 3e-6, 2e-8)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 3e-5, 2e-8)

    # cylindrical particle
    cylinder_ff = ba.FormFactorCylinder(5 * nm, cyl_height)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    position = ba.kvector_t(0.0, 0.0, -cyl_height)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder, 1.0, position)

    # interference function
    interference = ba.InterferenceFunction2DLattice.createSquare(15 * nm)
    pdf = ba.FTDecayFunction2DCauchy(300 * nm, 300 * nm)
    interference.setDecayFunction(pdf)
    particle_layout.setInterferenceFunction(interference)

    air_layer = ba.Layer(m_ambience)
    intermediate_layer = ba.Layer(m_layer, 5 * nm)
    intermediate_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(intermediate_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
Example #7
0
def get_sample(radius=5.0 * nm, height=5.0 * nm, lattice_constant=10.0 * nm):
    """
    Returns a sample with cylinders on a substrate,
    forming a rectangular lattice.
    """
    m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    ff = ba.FormFactorCylinder(radius, height)
    cylinder = ba.Particle(m_particle, ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder)

    interference = ba.InterferenceFunction2DLattice(lattice_constant,
                                                    lattice_constant,
                                                    90.0 * deg)
    pdf = ba.FTDecayFunction2DCauchy(50 * nm, 50 * nm)
    interference.setDecayFunction(pdf)

    particle_layout.setInterferenceFunction(interference)

    air_layer = ba.Layer(m_air)
    air_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate, 0)
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
def get_sample():
    """
    Returns a sample with cylinders on a substrate, forming a 2D square lattice.
    """
    # defining materials
    m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    # collection of particles
    interference = ba.InterferenceFunction2DLattice.createSquare(
        25.0 * nm, 0 * deg)
    pdf = ba.FTDecayFunction2DCauchy(300.0 * nm / 2.0 / numpy.pi,
                                     100.0 * nm / 2.0 / numpy.pi, 0)
    interference.setDecayFunction(pdf)

    cylinder_ff = ba.FormFactorCylinder(3. * nm, 3. * nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder)
    particle_layout.setInterferenceFunction(interference)

    # assembling the sample
    vacuum_layer = ba.Layer(m_vacuum)
    vacuum_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(vacuum_layer)
    multi_layer.addLayer(substrate_layer)
    print(multi_layer.parametersToString())
    print(multi_layer.treeToString())
    return multi_layer
Example #9
0
def get_sample():
    """
    Returns a sample with boxes on a substrate.
    """
    # defining materials
    m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 3e-5, 2e-8)

    # cylindrical particle
    box_ff = ba.FormFactorBox(5 * nm, 5 * nm, 10 * nm)
    box = ba.Particle(m_particle, box_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(box)

    # interference function
    interference = ba.InterferenceFunction2DLattice.createSquare(8 * nm)
    pdf = ba.FTDecayFunction2DCauchy(100 * nm, 100 * nm)
    interference.setDecayFunction(pdf)
    particle_layout.setInterferenceFunction(interference)

    air_layer = ba.Layer(m_air)
    air_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
def get_sample(params):
    """
    Returns a sample with cylinders and pyramids on a substrate,
    forming a hexagonal lattice.
    """
    radius = params['radius']
    lattice_length = params['length']

    m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    sphere_ff = ba.FormFactorFullSphere(radius)
    sphere = ba.Particle(m_particle, sphere_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(sphere)

    interference = ba.InterferenceFunction2DLattice.createHexagonal(
        lattice_length)
    pdf = ba.FTDecayFunction2DCauchy(10 * nm, 10 * nm, 0)
    interference.setDecayFunction(pdf)

    particle_layout.setInterferenceFunction(interference)

    vacuum_layer = ba.Layer(m_vacuum)
    vacuum_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate, 0)
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(vacuum_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
def get_sample():
    """
    Returns a sample with cosine ripples on a substrate.
    The structure is modelled as a 2D Lattice.
    """
    # defining materials
    m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    # collection of particles
    ff = ba.FormFactorCosineRippleBox(100 * nm, 20 * nm, 4 * nm)
    particle = ba.Particle(m_particle, ff)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(particle, 1.0)

    interference = ba.InterferenceFunction2DLattice(200.0 * nm, 50.0 * nm,
                                                    90.0 * deg, 0.0 * deg)
    pdf = ba.FTDecayFunction2DCauchy(1000. * nm / 2. / numpy.pi,
                                     100. * nm / 2. / numpy.pi, 0)
    interference.setDecayFunction(pdf)
    particle_layout.setInterferenceFunction(interference)

    # assemble the sample
    vacuum_layer = ba.Layer(m_vacuum)
    vacuum_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate)
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(vacuum_layer)
    multi_layer.addLayer(substrate_layer)

    return multi_layer
    def get_sample():
        # Defining Materials
        material_1 = ba.HomogeneousMaterial("Air", 0.0, 0.0)
        material_2 = ba.MaterialBySLD("Au", 4.6665e-06, -1.6205e-08)
        material_3 = ba.MaterialBySLD("Si", 2.0737e-06, -2.3758e-11)

        # Defining Layers

        layer_1 = ba.Layer(material_1)
        layer_2 = ba.Layer(material_3)

        formFactor_1 = ba.FormFactorCone6(159.0 * nm, 640.0 * nm, 86.0 * deg)
        formFactor_2 = ba.FormFactorCone6(157.0 * nm, 640.0 * nm, 86.0 * deg)
        formFactor_3 = ba.FormFactorTruncatedSphere(115.0 * nm, 160.0 * nm,
                                                    0.0 * nm)

        particle_1 = ba.Particle(material_2, formFactor_1)
        particle_2 = ba.Particle(material_3, formFactor_2)
        particle_3 = ba.Particle(material_2, formFactor_3)
        particle_3_position = kvector_t(0.0 * nm, 0.0 * nm, 640.0 * nm)
        particle_3.setPosition(particle_3_position)

        # Defining Core Shell Particles

        particleCoreShell_1 = ba.ParticleCoreShell(particle_2, particle_1)
        particleCoreShell_1_rotation = ba.RotationZ(0 * deg)
        particleCoreShell_1.setRotation(particleCoreShell_1_rotation)

        # Defining composition of particles at specific positions
        particleComposition_1 = ba.ParticleComposition()
        particleComposition_1.addParticle(particleCoreShell_1)
        particleComposition_1.addParticle(particle_3)
        particleComposition_1_rotation = ba.RotationX(0.0 * deg)
        particleComposition_1.setRotation(particleComposition_1_rotation)

        # Defining Interference Functions
        interference_1 = ba.InterferenceFunction2DLattice(
            1500.0 * nm, 1500.0 * nm, 120.0 * deg, i * deg)
        interference_1_pdf = ba.FTDecayFunction2DCauchy(
            1000.0 * nm, 1000.0 * nm, 0.0 * deg)
        interference_1.setDecayFunction(interference_1_pdf)
        interference_1.setPositionVariance(500.0 * nm2)

        # Defining Particle Layouts and adding Particles
        layout_1 = ba.ParticleLayout()
        layout_1.addParticle(particleComposition_1, 1.0)
        layout_1.setInterferenceFunction(interference_1)
        layout_1.setTotalParticleSurfaceDensity(0.000001)

        # Adding layouts to layers
        layer_1.addLayout(layout_1)

        # Defining Multilayers
        multiLayer_1 = ba.MultiLayer()
        multiLayer_1.addLayer(layer_1)
        multiLayer_1.addLayer(layer_2)
        return multiLayer_1
def get_sample():
    # Defining Materials
    m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08)

    # Defining Layers
    l_air = ba.Layer(m_air)
    l_substrate = ba.Layer(m_substrate)

    # Defining Form Factors
    ff_sphere = ba.FormFactorFullSphere(particle_radius)

    # Defining composition of particles at specific positions
    particle_composition = ba.ParticleComposition()
    # compute number of particles in the vertical direction
    n = int((height - 2.0 * particle_radius) // lattice_length)
    # add particles to the particle composition
    for i in range(n + 1):
        particle = ba.Particle(m_particle, ff_sphere)
        particle_position = kvector_t(0.0 * nm, 0.0 * nm, i * lattice_length)
        particle.setPosition(particle_position)
        particle_composition.addParticle(particle)

    # Defining Interference Function
    interference = ba.InterferenceFunction2DLattice(lattice_length,
                                                    lattice_length, 90.0 * deg,
                                                    0.0 * deg)
    interference_pdf = ba.FTDecayFunction2DCauchy(500.0 * nm, 500.0 * nm,
                                                  0.0 * deg)
    interference.setDecayFunction(interference_pdf)
    # interference.setPositionVariance(0.3)     # uncomment to add position variance (2D!)
    # interference.setIntegrationOverXi(True)   # uncomment to integrate over xi. Slow!

    # Defining Particle Layout and adding Particles
    layout = ba.ParticleLayout()
    layout.addParticle(particle_composition, 1.0)
    layout.setInterferenceFunction(interference)
    layout.setWeight(1.0)

    # Adding layout to layer
    l_air.addLayout(layout)

    # Defining Multilayers
    multilayer = ba.MultiLayer()
    multilayer.addLayer(l_air)
    multilayer.addLayer(l_substrate)
    # print(multilayer.parametersToString())     # uncomment to print sample parameters
    return multilayer
Example #14
0
def get_sample(angle_distribution, par_values):
    """
    Returns a sample for given orientation distribution and parameter values.
    """
    # retrieve variable parameter values
    lattice_constant = par_values["lattice_constant"]
    peak_width = par_values["peak_width"]
    pos_variance = par_values["pos_variance"]
    radius = par_values["sphere_radius"]

    # defining materials
    m_ambience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_particle = ba.HomogeneousMaterial("CoFe2O4", 2.03e-5, 1.5e-6)
    m_layer = ba.HomogeneousMaterial("SiO2", 5.44e-6, 5.44e-8)
    m_substrate = ba.HomogeneousMaterial("Si", 5.78e-6, 1.02e-7)

    # layers
    air_layer = ba.Layer(m_ambience)
    oxide_layer = ba.Layer(m_layer, 60.0 * nm)
    substrate_layer = ba.Layer(m_substrate)

    # particle and basic layout
    formfactor = ba.FormFactorFullSphere(radius)
    particle = ba.Particle(m_particle, formfactor)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(particle)

    decay_function = ba.FTDecayFunction2DCauchy(peak_width, peak_width, 0.0)

    # interference function and different layouts with correct weights
    for i, weight in enumerate(angle_distribution):
        angle = i * 60.0 / len(angle_distribution)
        if weight > 0.0:
            interference = ba.InterferenceFunction2DLattice.createHexagonal(
                lattice_constant, angle * deg)
            interference.setDecayFunction(decay_function)
            interference.setPositionVariance(pos_variance)
            particle_layout.setInterferenceFunction(interference)
            particle_layout.setWeight(weight)
            air_layer.addLayout(particle_layout)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(oxide_layer)
    multi_layer.addLayer(substrate_layer)

    return multi_layer
def get_sample(params):
    radius = params["radius"]
    length = params["length"]

    # Defining Materials
    material_1 = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    material_2 = ba.HomogeneousMaterial("CoFe2O4", 2.0433e-05, 1.5253e-06)
    material_3 = ba.HomogeneousMaterial("SiO2", 5.43852457e-06, 5.43741763e-08)
    material_4 = ba.HomogeneousMaterial("Si", 5.78164999998e-06, 1.02295e-07)

    # Defining Layers
    layer_1 = ba.Layer(material_1)
    layer_2 = ba.Layer(material_3, 60)
    layer_3 = ba.Layer(material_4)

    # Defining Form Factors
    formFactor_1 = ba.FormFactorTruncatedSphere(radius * nm, 8.5 * nm, 0.0 * nm)
    # formFactor_1 = ba.FormFactorFullSphere(radius)

    # Defining Particles
    particle_1 = ba.Particle(material_2, formFactor_1)

    # Defining Interference Functions
    interference_1 = ba.InterferenceFunction2DLattice(length, length, 120.0 * deg, 0.0 * deg)
    interference_1_pdf = ba.FTDecayFunction2DCauchy(300.0 * nm, 100.0 * nm, 0.0 * deg)
    interference_1.setDecayFunction(interference_1_pdf)

    # Defining Particle Layouts and adding Particles
    layout_1 = ba.ParticleLayout()
    layout_1.addParticle(particle_1, 1.0)
    layout_1.setInterferenceFunction(interference_1)
    layout_1.setTotalParticleSurfaceDensity(0.000998875898252)

    # Adding layouts to layers
    layer_1.addLayout(layout_1)

    # Defining Multilayers
    multiLayer_1 = ba.MultiLayer()
    multiLayer_1.addLayer(layer_1)
    multiLayer_1.addLayer(layer_2)
    multiLayer_1.addLayer(layer_3)
    return multiLayer_1
def get_sample():
    """
    define sample with Si box nanodots in a square lattice
    :return: sample
    """
    # Defining Materials
    m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_si = ba.HomogeneousMaterial("Si", 7.6e-06, 1.7e-07)

    # Defining Layers
    l_air = ba.Layer(m_air)
    l_si = ba.Layer(m_si)

    # Defining Form Factor
    ff = ba.FormFactorBox(20.0 * nm, 20.0 * nm, 20.0 * nm)

    # Defining Particles
    particle = ba.Particle(m_si, ff)

    # Defining Interference Function
    interference = ba.InterferenceFunction2DLattice.createSquare(
        45.0 * nm, 45 * deg)
    pdf = ba.FTDecayFunction2DCauchy(1000.0 * nm, 1000.0 * nm)
    interference.setDecayFunction(pdf)

    # Defining Particle Layout and adding Particles
    layout = ba.ParticleLayout()
    layout.addParticle(particle, 1.0)
    layout.addInterferenceFunction(interference)

    # Adding layout to layer
    l_air.addLayout(layout)

    # Defining Multilayer
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(l_air)
    multi_layer.addLayer(l_si)
    return multi_layer
    def build_sample(self):
        m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
        m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
        m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

        sphere_ff = ba.FormFactorFullSphere(self.radius)
        sphere = ba.Particle(m_particle, sphere_ff)
        particle_layout = ba.ParticleLayout()
        particle_layout.addParticle(sphere)

        interference = ba.InterferenceFunction2DLattice.createHexagonal(self.lattice_length)
        pdf = ba.FTDecayFunction2DCauchy(10 * nm, 10 * nm)
        interference.setDecayFunction(pdf)

        particle_layout.setInterferenceFunction(interference)

        air_layer = ba.Layer(m_air)
        air_layer.addLayout(particle_layout)
        substrate_layer = ba.Layer(m_substrate, 0)
        multi_layer = ba.MultiLayer()
        multi_layer.addLayer(air_layer)
        multi_layer.addLayer(substrate_layer)
        return multi_layer
def get_sample():
    """
    Returns a sample with cylinders on a substrate,
    forming a 2D centered square lattice
    """
    # defining materials
    m_ambience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_substrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    # collection of particles
    interference = ba.InterferenceFunction2DLattice.createSquare(25.0*nm)
    pdf = ba.FTDecayFunction2DCauchy(300.0*nm/2.0/numpy.pi,
                                     100.0*nm/2.0/numpy.pi)
    interference.setDecayFunction(pdf)

    particle_layout = ba.ParticleLayout()
    position1 = ba.kvector_t(0.0, 0.0, 0.0)
    position2 = ba.kvector_t(12.5*nm, 12.5*nm, 0.0)
    cylinder_ff = ba.FormFactorCylinder(3.*nm, 3.*nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    basis = ba.ParticleComposition()
    basis.addParticles(cylinder, [position1, position2])
    particle_layout.addParticle(basis)
    particle_layout.setInterferenceFunction(interference)

    # assembling the sample
    air_layer = ba.Layer(m_ambience)
    air_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(m_substrate)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)

    print(multi_layer.treeToString())
    return multi_layer