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

    # collection of particles #1
    radius1 = 5.0 * nm
    height1 = radius1
    sigma1 = radius1 * 0.2

    cylinder_ff1 = ba.FormFactorCylinder(radius1, height1)
    cylinder1 = ba.Particle(m_particle, cylinder_ff1)

    gauss_distr1 = ba.DistributionGaussian(radius1, sigma1)

    nparticles = 150
    sigma_factor = 3.0

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

    par_distr1 = ba.ParameterDistribution("/Particle/Cylinder/Radius",
                                          gauss_distr1, nparticles,
                                          sigma_factor, limits)
    part_coll1 = ba.ParticleDistribution(cylinder1, par_distr1)

    # collection of particles #2
    radius2 = 10.0 * nm
    height2 = radius2
    sigma2 = radius2 * 0.02

    cylinder_ff2 = ba.FormFactorCylinder(radius2, height2)
    cylinder2 = ba.Particle(m_particle, cylinder_ff2)

    gauss_distr2 = ba.DistributionGaussian(radius2, sigma2)

    par_distr2 = ba.ParameterDistribution("/Particle/Cylinder/Radius",
                                          gauss_distr2, nparticles,
                                          sigma_factor, limits)
    part_coll2 = ba.ParticleDistribution(cylinder2, par_distr2)

    # assembling the sample
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(part_coll1, 0.95)
    particle_layout.addParticle(part_coll2, 0.05)

    vacuum_layer = ba.Layer(m_vacuum)
    vacuum_layer.addLayout(particle_layout)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(vacuum_layer)
    return multi_layer
Ejemplo n.º 2
0
def get_sample():
    """
    Returns a sample with cylinders of two different sizes on a substrate.
    The cylinder positions are modelled in Local Monodisperse Approximation.
    """
    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)

    # cylindrical particle 1
    radius1 = 5 * nm
    height1 = radius1
    cylinder_ff1 = ba.FormFactorCylinder(radius1, height1)
    cylinder1 = ba.Particle(m_particle, cylinder_ff1)

    # cylindrical particle 2
    radius2 = 8 * nm
    height2 = radius2
    cylinder_ff2 = ba.FormFactorCylinder(radius2, height2)
    cylinder2 = ba.Particle(m_particle, cylinder_ff2)

    # interference function1
    interference1 = ba.InterferenceFunctionRadialParaCrystal(
        16.8 * nm, 1e3 * nm)
    pdf = ba.FTDistribution1DGauss(3 * nm)
    interference1.setProbabilityDistribution(pdf)

    # interference function2
    interference2 = ba.InterferenceFunctionRadialParaCrystal(
        22.8 * nm, 1e3 * nm)
    interference2.setProbabilityDistribution(pdf)

    # assembling the sample
    particle_layout1 = ba.ParticleLayout()
    particle_layout1.addParticle(cylinder1, 0.8)
    particle_layout1.setInterferenceFunction(interference1)

    particle_layout2 = ba.ParticleLayout()
    particle_layout2.addParticle(cylinder2, 0.2)
    particle_layout2.setInterferenceFunction(interference2)

    air_layer = ba.Layer(m_ambience)
    air_layer.addLayout(particle_layout1)
    air_layer.addLayout(particle_layout2)
    substrate_layer = ba.Layer(m_substrate)
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)
    return multi_layer
Ejemplo n.º 3
0
    def create_meso(self):
        ff_meso = ba.FormFactorCylinder(self.m_meso_radius, self.m_meso_height)

        lattice = self.create_lattice(self.m_lattice_length_a,
                                      self.m_lattice_length_c)

        basis = self.create_basis(self.particle_material, lattice,
                                  self.m_nanoparticle_radius,
                                  self.m_sigma_nanoparticle_radius,
                                  self.m_nparticles)

        npc = ba.Crystal(basis, lattice)
        dw_factor = self.particle_pos_sigma * self.particle_pos_sigma
        npc.setPositionVariance(dw_factor)
        result = ba.MesoCrystal(npc, ff_meso)

        if self.m_rotation_z != 0.0:
            rotZ = ba.RotationZ(self.m_rotation_z * deg)
            result.setRotation(rotZ)

        if self.m_rotation_x != 0.0:
            rotX = ba.RotationX(self.m_rotation_x * deg)
            result.rotate(rotX)

        return result
Ejemplo n.º 4
0
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
Ejemplo n.º 5
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
Ejemplo n.º 6
0
    def test_parameterPoolAccess(self):
        """
        Checks values in particle's parameter pool
        """
        ff = ba.FormFactorCylinder(5 * nm, 6 * nm)
        particle = ba.Particle(ba.HomogeneousMaterial("Air", 0.0, 0.0), ff)
        particle.setAbundance(1.0)
        particle.setPosition(2.0, 3.0, 4.0)

        # print(particle.parametersToString())
        # print(particle.treeToString())

        pool = particle.parameterPool()
        self.assertEqual(pool.size(), 4)
        self.assertEqual(pool.parameterNames(),
                         ('Abundance', 'PositionX', 'PositionY', 'PositionZ'))

        expected = {
            'Abundance': 1.0,
            'PositionX': 2.0,
            'PositionY': 3.0,
            'PositionZ': 4.0
        }
        for par in pool:
            print(par.value(), par.getName(), par.limits().toString())
            self.assertEqual(par.value(), expected[par.getName()])
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(params):
    """
    Returns a sample with uncorrelated cylinders and prisms on a substrate.
    """
    cylinder_height = params["cylinder_height"]
    cylinder_radius = params["cylinder_radius"]
    prism_height = params["prism_height"]
    prism_base_edge = params["prism_base_edge"]

    # 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
    cylinder_ff = ba.FormFactorCylinder(cylinder_radius, cylinder_height)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    prism_ff = ba.FormFactorPrism3(prism_base_edge, prism_height)
    prism = ba.Particle(m_particle, prism_ff)
    layout = ba.ParticleLayout()
    layout.addParticle(cylinder, 0.5)
    layout.addParticle(prism, 0.5)
    interference = ba.InterferenceFunctionNone()
    layout.setInterferenceFunction(interference)

    # vacuum layer with particles and substrate form multi layer
    vacuum_layer = ba.Layer(m_vacuum)
    vacuum_layer.addLayout(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
Ejemplo n.º 9
0
def get_sample(params):
    """
    Returns a sample with uncorrelated cylinders and pyramids on a substrate.
    """
    radius = params["radius"]
    height = params["height"]

    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)

    cylinder_ff = ba.FormFactorCylinder(radius, height)
    cylinder = ba.Particle(m_particle, cylinder_ff)

    layout = ba.ParticleLayout()
    layout.addParticle(cylinder)

    vacuum_layer = ba.Layer(m_vacuum)
    vacuum_layer.addLayout(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 uncorrelated cylinders and prisms on a substrate.
    """
    # 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
    cylinder_ff = ba.FormFactorCylinder(5 * nm, 5 * nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    prism_ff = ba.FormFactorPrism3(10 * nm, 5 * nm)
    prism = ba.Particle(m_particle, prism_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder, 0.5)
    particle_layout.addParticle(prism, 0.5)
    interference = ba.InterferenceFunctionNone()
    particle_layout.setInterferenceFunction(interference)

    # vacuum layer with particles and substrate form multi layer
    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.treeToString())
    return multi_layer
Ejemplo n.º 11
0
def get_sample(params):
    """
    Build the sample representing cylinders on top of substrate without interference.
    """
    radius = params["radius"]
    height = params["height"]

    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)

    cylinder_ff = ba.FormFactorCylinder(radius, height)
    cylinder = ba.Particle(m_particle, cylinder_ff)

    layout = ba.ParticleLayout()
    layout.addParticle(cylinder)

    vacuum_layer = ba.Layer(m_vacuum)
    vacuum_layer.addLayout(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
Ejemplo n.º 12
0
def get_sample():
    """
    Returns a sample with uncorrelated cylinders and prisms on a substrate.
    Parameter set is fixed.
    """
    # 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", 6e-4, 2e-8)

    # collection of particles
    cylinder_ff = ba.FormFactorCylinder(5 * nm, 5 * nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    prism_ff = ba.FormFactorPrism3(5 * nm, 5 * nm)
    prism = ba.Particle(m_particle, prism_ff)

    layout = ba.ParticleLayout()
    layout.addParticle(cylinder, 0.5)
    layout.addParticle(prism, 0.5)
    interference = ba.InterferenceFunctionNone()
    layout.setInterferenceFunction(interference)

    # air layer with particles and substrate form multi layer
    air_layer = ba.Layer(m_air)
    air_layer.addLayout(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
Ejemplo n.º 13
0
def create_sample():
    # create materials
    magnetic_field = ba.kvector_t(1.0, 1.0, 1.0)
    substr_field = ba.kvector_t(0.0, 1.0, 0.0)
    particle_material = ba.HomogeneousMagneticMaterial("particle", 2e-5, 4e-7,
                                                       magnetic_field)
    air_material = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    substrate_material = ba.HomogeneousMagneticMaterial(
        "Substrate", 7e-6, 1.8e-7, substr_field)

    # Create multilayer
    particle_layout = ba.ParticleLayout()
    cylinder_ff = ba.FormFactorCylinder(5 * nm, 5 * nm)
    cylinder = ba.Particle(particle_material, cylinder_ff)
    particle_layout.addParticle(cylinder)

    air_layer = ba.Layer()
    air_layer.setMaterial(air_material)
    air_layer.addLayout(particle_layout)

    substrate_layer = ba.Layer()
    substrate_layer.setMaterial(substrate_material)

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

    return multi_layer
def get_sample():
    """
    Returns a sample with uncorrelated cylinders and prisms on a substrate.
    Parameter set is fixed.
    """
    # 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", 6e-4, 2e-8)

    # collection of particles
    cylinder_ff = ba.FormFactorCylinder(5*nm, 5*nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    prism_ff = ba.FormFactorPrism3(5*nm, 5*nm)
    prism = ba.Particle(m_particle, prism_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder, 0.5)
    particle_layout.addParticle(prism, 0.5)

    # interference = ba.InterferenceFunctionRadialParaCrystal(20.0*nm, 1e3*nm)
    # pdf = ba.FTDistribution1DGauss(7 * nm)
    # interference.setProbabilityDistribution(pdf)
    # particle_layout.addInterferenceFunction(interference)

    # air layer with particles and substrate form multi layer
    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
Ejemplo n.º 16
0
def get_sample():
    """
    Returns a sample with cylinders on a substrate, forming a 2D 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.InterferenceFunctionFinite2DLattice.createSquare(
        25.0 * nm, 0.0, 40, 40)
    interference.setPositionVariance(1.0)

    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)
    print(multi_layer.parametersToString())
    print(multi_layer.treeToString())
    return multi_layer
Ejemplo n.º 17
0
def get_sample():
    """
    Returns a sample with cylinders on a substrate, forming a 2D paracrystal
    """
    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
    cylinder_ff = ba.FormFactorCylinder(4 * nm, 5 * nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)

    interference = ba.InterferenceFunction2DParaCrystal.createSquare(
        10.0 * nm, 0.0, 20.0 * micrometer, 20.0 * micrometer)
    pdf = ba.FTDistribution2DCauchy(1.0 * nm, 1.0 * nm)
    interference.setProbabilityDistributions(pdf, pdf)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder, 1.0)
    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.parametersToString())
    print(multi_layer.treeToString())
    return multi_layer
Ejemplo n.º 18
0
def getSample():
    # Defining Materials
    material_2 = ba.HomogeneousMaterial("Si", 7.6e-06, 1.7e-07)
    material_1 = ba.HomogeneousMaterial("Air", 0.0, 0.0)

    # Defining Layers
    layer_1 = ba.Layer(material_1)
    layer_2 = ba.Layer(material_2)

    # Defining Form Factors
    formFactor_1 = ba.FormFactorCylinder(5.0 * nm, 5.0 * nm)

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

    # Defining particles with parameter following a distribution
    distr_1 = ba.DistributionGaussian(5.0, 1.0)
    par_distr_1 = ba.ParameterDistribution("/Particle/Cylinder/Radius",
                                           distr_1, 10, 2.0)
    par_distr_1.linkParameter("/Particle/Cylinder/Height")
    particleDistribution_1 = ba.ParticleDistribution(particle_1, par_distr_1)

    # Defining Particle Layouts and adding Particles
    layout_1 = ba.ParticleLayout()
    layout_1.addParticle(particleDistribution_1, 1.0)
    layout_1.setTotalParticleSurfaceDensity(1)

    # 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
Ejemplo n.º 19
0
def runSimulation():
    # defining materials
    mAmbience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    mSubstrate = ba.HomogeneousMaterial("Substrate", 6e-6, 2e-8)

    magnetic_field = ba.kvector_t(0, 0, 0)

    magParticle = ba.HomogeneousMaterial("magParticle", 6e-4, 2e-8, magnetic_field )
    # collection of particles
    cylinder_ff = ba.FormFactorCylinder(5*nanometer, 5*nanometer)
    cylinder = ba.Particle(magParticle, cylinder_ff)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder, 1.0)
    interference = ba.InterferenceFunctionNone()
    particle_layout.setInterferenceFunction(interference)

    # air layer with particles and substrate form multi layer
    air_layer = ba.Layer(mAmbience)
    air_layer.addLayout(particle_layout)
    substrate_layer = ba.Layer(mSubstrate, 0)
    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayer(substrate_layer)

    # build and run experiment
    simulation = ba.GISASSimulation()
    simulation.setDetectorParameters(100, 0*degree, 2.0*degree, 100, 0.0*degree, 2.0*degree)
    simulation.setBeamParameters(1.0*angstrom, 0.2*degree, 0.0*degree)
    simulation.setSample(multi_layer)
    simulation.setBeamIntensity(1e2)
    simulation.runSimulation()
    ## intensity data
    return simulation.result()
def get_sample():
    """
    Returns a sample with cylinders on a substrate that form a radial paracrystal.
    """
    # 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
    cylinder_ff = ba.FormFactorCylinder(5*nm, 5*nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)

    interference = ba.InterferenceFunctionRadialParaCrystal(
        20.0*nm, 1e3*nm)
    pdf = ba.FTDistribution1DGauss(7 * nm)
    interference.setProbabilityDistribution(pdf)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder, 1.0)
    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
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
Ejemplo n.º 22
0
def getSample():
    # Defining Materials
    material_2 = ba.HomogeneousMaterial("Si", 7.6e-06, 1.7e-07)
    material_1 = ba.HomogeneousMaterial("Air", 0.0, 0.0)

    # Defining Layers
    layer_1 = ba.Layer(material_1)
    layer_2 = ba.Layer(material_2)

    # cylindrical particles with bivariate size distribution
    radius = 5 * nm  # mean radius
    height = radius  # mean height
    nparticles = 10
    nfwhm = 2.0
    sigma = 0.2 * radius  # sx = sy = sigma
    distr = BivariateGaussian(mx=radius, my=height, sx=sigma, sy=sigma)
    params = distr.gen_parameters(nparticles, nfwhm)

    layout_1 = ba.ParticleLayout()
    for p in params:
        cylinder_ff = ba.FormFactorCylinder(p['radius'], p['height'])
        cylinder = ba.Particle(material_2, cylinder_ff)
        layout_1.addParticle(cylinder, p['abundance'])

    # 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
Ejemplo n.º 23
0
    def test_parameterTreeModify(self):
        """
        Modifies values of particle's parameter tree.
        """
        ff = ba.FormFactorCylinder(5 * nm, 6 * nm)
        particle = ba.Particle(ba.HomogeneousMaterial("Air", 0.0, 0.0), ff)
        particle.setAbundance(1.0)
        particle.setPosition(2.0, 3.0, 4.0)

        # print(particle.parametersToString())
        # print(particle.treeToString())

        pool = particle.createParameterTree()
        pool.setParameterValue('/Particle/Abundance', 10.0)
        pool[1].setValue(20.0)  # PositionX
        pool.parameter('/Particle/PositionY').setValue(30.0)
        pool.setMatchedParametersValue('*Cylinder*', 50.0)

        expected = {
            '/Particle/Abundance': 10.0,
            '/Particle/PositionX': 20.0,
            '/Particle/PositionY': 30.0,
            '/Particle/PositionZ': 4.0,
            '/Particle/Cylinder/Radius': 50.0,
            '/Particle/Cylinder/Height': 50.0
        }

        for par in pool:
            self.assertEqual(par.value(), expected[par.getName()])
Ejemplo n.º 24
0
def get_sample_rot_distr():
    # create materials
    substrate_material = ba.HomogeneousMaterial("Substrate", 6.05878e-6,
                                                6.94321e-11)
    particle_material = ba.HomogeneousMaterial("ParticleCore", -0.609e-6,
                                               0.183e-6)
    layer_material = ba.HomogeneousMaterial("D2O", 1.85762e-5, 3.31309e-11)

    # create mesocrystal
    # lattice
    lat = create_hex_lattice(distance, length)
    # basis particle
    ff = ba.FormFactorCylinder(radius, length)
    particle = ba.Particle(particle_material, ff)
    # rotate cylinder to make it parallel to the substrate
    rotation = ba.RotationY(90.0 * ba.degree)
    particle.setRotation(rotation)
    basis = ba.ParticleComposition(particle)

    # mesocrystal
    total_height = nbr_layers * distance * np.sin(hex_angle)
    # using a Gaussian form factor as the overall shape of where the cylinders are
    meso_ff = ba.FormFactorGauss(meso_width, total_height)
    # assemble them into mesocrystal
    npc = ba.Crystal(basis, lat)
    dw_factor = 0.2
    npc.setDWFactor(dw_factor)
    meso = ba.MesoCrystal(npc, meso_ff)
    # rotate mesocrystal
    rot_y = ba.RotationY(180.0 * ba.degree)
    meso.setRotation(rot_y)  # turn upside down
    rot_z = ba.RotationZ(0.1 * ba.degree)
    meso.applyRotation(rot_z)  # rotate around Z
    meso.setPosition(0.0, 0.0, 0.0)

    # add uniform distribution of the domain orientations
    rot_distr = ba.DistributionGate((90.0 - rz_range) * ba.degree,
                                    (90.0 + rz_range) * ba.degree)
    ang_distr = ba.ParameterDistribution("*MesoCrystal/EulerRotation/Gamma",
                                         rot_distr, rz_num)
    part_coll = ba.ParticleDistribution(meso, ang_distr)

    # Create multilayer
    multi_layer = ba.MultiLayer()
    d2o_layer = ba.Layer(layer_material)
    substrate_layer = ba.Layer(substrate_material)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(part_coll)
    d2o_layer.addLayout(particle_layout)

    # the sample is upside down
    multi_layer.addLayer(substrate_layer)
    multi_layer.addLayer(d2o_layer)

    return multi_layer
Ejemplo n.º 25
0
def get_composition(top_material,
                    bottom_material,
                    top_height=4.0,
                    bottom_height=10.0):
    """
    Returns cylindrical particle made of two different materials.
    """

    cylinder_radius = 10 * nm

    topPart = ba.Particle(top_material,
                          ba.FormFactorCylinder(cylinder_radius, top_height))
    bottomPart = ba.Particle(
        bottom_material, ba.FormFactorCylinder(cylinder_radius, bottom_height))

    result = ba.ParticleComposition()
    result.addParticle(topPart, ba.kvector_t(0.0, 0.0, bottom_height))
    result.addParticle(bottomPart)

    return result
def get_sample():
    """
    Returns a sample with cylinders of two different sizes on a substrate.
    The cylinder positions are modelled in Size-Spacing Coupling  Approximation.
    """
    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)

    # cylindrical particle 1
    radius1 = 5 * nm
    height1 = radius1
    cylinder_ff1 = ba.FormFactorCylinder(radius1, height1)
    cylinder1 = ba.Particle(m_particle, cylinder_ff1)

    # cylindrical particle 2
    radius2 = 8 * nm
    height2 = radius2
    cylinder_ff2 = ba.FormFactorCylinder(radius2, height2)
    cylinder2 = ba.Particle(m_particle, cylinder_ff2)

    # interference function
    interference = ba.InterferenceFunctionRadialParaCrystal(
        18.0 * nm, 1e3 * nm)
    pdf = ba.FTDistribution1DGauss(3 * nm)
    interference.setProbabilityDistribution(pdf)
    interference.setKappa(1.0)

    # assembling the sample
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder1, 0.8)
    particle_layout.addParticle(cylinder2, 0.2)
    particle_layout.setInterferenceFunction(interference)

    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
Ejemplo n.º 27
0
    def test_parameterModify(self):
        """
        Modification of particle's parameters without intermediate access to parameter pool
        """
        ff = ba.FormFactorCylinder(5 * nm, 6 * nm)
        particle = ba.Particle(ba.HomogeneousMaterial("Air", 0.0, 0.0), ff)
        particle.setAbundance(1.0)
        particle.setPosition(2.0, 3.0, 4.0)

        particle.setParameterValue('/Particle/Abundance', 10.0)
        particle.setParameterValue('PositionZ', 40.0)
        particle.setParameterValue('*Cylinder*', 50.0)

        self.assertEqual(particle.abundance(), 10.0)
        self.assertEqual(particle.position().z(), 40.0)
Ejemplo n.º 28
0
def get_sample():
    """
    Returns a sample with cylinders in a homogeneous environment ("air"),
    implying a simulation in plain Born approximation.
    """
    # defining materials
    m_ambience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_particle = ba.HomogeneousMaterial("Particle", 6e-4, 2e-8)

    # collection of particles
    cylinder_ff = ba.FormFactorCylinder(5 * nm, 5 * nm)
    cylinder = ba.Particle(m_particle, cylinder_ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder, 1.0)

    air_layer = ba.Layer(m_ambience)
    air_layer.addLayout(particle_layout)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    return multi_layer
Ejemplo n.º 29
0
def get_sample(radius=5.0 * nm, height=10.0 * nm):
    """
    Build the sample representing cylinders on top of substrate without interference.
    """
    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)

    cylinder_ff = ba.FormFactorCylinder(radius, height)
    cylinder = ba.Particle(m_particle, cylinder_ff)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder)

    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
Ejemplo n.º 30
0
def get_sample(radius=5.0 * nm, height=10.0 * nm):
    """
    Returns a sample with uncorrelated cylinders on a substrate.
    """
    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)

    cylinder_ff = ba.FormFactorCylinder(radius, height)
    cylinder = ba.Particle(m_particle, cylinder_ff)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder)

    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