def get_sample():
        # Defining Materials
        material_1 = ba.HomogeneousMaterial("Air", 0.0, 0.0)
        material_2 = ba.HomogeneousMaterial("Au", 3.53665637e-05,
                                            2.9383311e-06)
        material_3 = ba.HomogeneousMaterial("Si", 5.73327e-06, 1.006366e-07)

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

        # Defining Form Factors
        formFactor_1 = ba.FormFactorTruncatedSphere(159.0 * nm, 244.0 * nm,
                                                    0.0 * nm)

        # Defining Particles
        particle_1 = ba.Particle(material_2, formFactor_1)
        particle_1_rotation = ba.RotationY(60.0 * deg)
        particle_1.setRotation(particle_1_rotation)
        particle_1_position = kvector_t(0.0 * nm, 0.0 * nm, 439.0 * nm)
        particle_1.setPosition(particle_1_position)

        # Defining composition of particles at specific positions
        z1 = j
        z2 = j + 120
        z3 = j + 240
        particleComposition_1 = ba.ParticleComposition()
        particleComposition_1.addParticle(particle_1)
        particleComposition_1_rotation = ba.RotationZ(z1 * deg)
        particleComposition_1.setRotation(particleComposition_1_rotation)

        particleComposition_2 = ba.ParticleComposition()
        particleComposition_2.addParticle(particle_1)
        particleComposition_2_rotation = ba.RotationZ(z2 * deg)
        particleComposition_2.setRotation(particleComposition_2_rotation)

        particleComposition_3 = ba.ParticleComposition()
        particleComposition_3.addParticle(particle_1)
        particleComposition_3_rotation = ba.RotationZ(z3 * deg)
        particleComposition_3.setRotation(particleComposition_3_rotation)

        # Defining Particle Layouts and adding Particles
        layout_1 = ba.ParticleLayout()
        layout_1.addParticle(particleComposition_1, 1.0)
        layout_1.addParticle(particleComposition_2, 1.0)
        layout_1.addParticle(particleComposition_3, 1.0)
        layout_1.setTotalParticleSurfaceDensity(0.001)

        # 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
示例#2
0
def get_sample():
    """
    Returns a sample with rotated pyramids on top of a substrate.
    """
    # 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
    pyramid_ff = ba.FormFactorPyramid(10*nm, 5*nm, 54.73*deg)
    pyramid = ba.Particle(m_particle, pyramid_ff)
    transform = ba.RotationZ(45.*deg)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(
        pyramid, 1.0, ba.kvector_t(0.0, 0.0, 0.0), transform)

    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_horizontal_lamellar():
    mat_a = ba.HomogeneousMaterial("PTFE", 5.20508729E-6, 1.96944292E-8)
    mat_b = ba.HomogeneousMaterial("HMDSO", 2.0888308E-6, 1.32605651E-8)
    length = 30 * nm
    width_a = 4 * nm
    width_b = 8 * nm
    height = 30 * nm
    nstack = 5
    stack = ba.ParticleComposition()
    for i in range(0, nstack):
        box_a = ba.Particle(mat_a, ba.FormFactorBox(length, width_a, height))
        box_b = ba.Particle(mat_b, ba.FormFactorBox(length, width_b, height))
        stack.addParticle(box_a, ba.kvector_t(0.0, i * (width_a + width_b),
                                              0.0))
        stack.addParticle(
            box_b,
            ba.kvector_t(0.0,
                         (width_a + width_b) / 2. + i * (width_a + width_b),
                         0.0))

    stack.setRotation(ba.RotationZ(45. * deg))

    # Defining particles with parameter following a distribution
    gate = ba.DistributionGate(0.0 * deg, 180.0 * deg)
    par_distr = ba.ParameterDistribution(
        "/ParticleComposition/ZRotation/Angle", gate, 60, 0.0)
    particles = ba.ParticleDistribution(stack, par_distr)

    return particles
    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
示例#5
0
def get_sample():
    """
    Returns a sample with rotated pyramids on top of a substrate.
    """
    # 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
    pyramid_ff = ba.FormFactorPyramid(40*nm, 20*nm, 54.73*deg)
    pyramid = ba.Particle(m_particle, pyramid_ff)
    particle_layout = ba.ParticleLayout()

    # Option1: add rotational distribution manually
    # nrotations=100
    # angles = np.linspace(0, 180, nrotations, endpoint=False)
    # for angle in angles:
    #     transform = ba.RotationZ(angle*deg)
    #     particle_layout.addParticle(pyramid, 1.0/nrotations, ba.kvector_t(0.0, 0.0, 0.0), transform)

    # use BornAgain distributions
    transform = ba.RotationZ(45.*deg)
    particle_layout.addParticle(pyramid, 1.0, ba.kvector_t(0.0, 0.0, 0.0), transform)

    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())
    return multi_layer
示例#6
0
def get_sample():
    """
    Returns a sample with a grating on a substrate,
    modelled by infinitely long boxes forming a 1D 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
    lattice_length = 100.0 * nm
    lattice_rotation_angle = 0.0 * deg
    interference = ba.InterferenceFunction1DLattice(lattice_length,
                                                    lattice_rotation_angle)
    pdf = ba.FTDecayFunction1DCauchy(1e+6)
    interference.setDecayFunction(pdf)

    box_ff = ba.FormFactorBox(1000 * nm, 20 * nm, 10.0 * nm)
    box = ba.Particle(m_particle, box_ff)
    transform = ba.RotationZ(90.0 * deg)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(box, 1.0, ba.kvector_t(0.0, 0.0, 0.0),
                                transform)
    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
示例#7
0
    def testBoxTransform(self):
        """
        Reference box of (10,50,20) size is compared against the box (50,20,10) with two rotations applied to get
        reference one
        """
        mParticle = ba.HomogeneousMaterial("Ag", 1.245e-5, 5.419e-7)

        # reference box
        length = 10
        width = 50
        height = 20

        box = ba.Particle(mParticle, ba.FormFactorBox(length, width, height))
        box.setPosition(kvector_t(0, 0, -layer_thickness / 2 - height / 2))
        reference_data = self.get_result(box)
        #IntensityDataIOFactory.writeIntensityData(reference_data, "ref_TransformBox.int")

        # second box
        length = 50
        width = 20
        height = 10
        box = ba.Particle(mParticle, ba.FormFactorBox(length, width, height))
        box.setRotation(ba.RotationZ(90 * deg))
        box.rotate(ba.RotationY(90 * deg))
        box.setPosition(kvector_t(0, 0, -layer_thickness / 2))

        data = self.get_result(box)

        diff = ba.RelativeDifference(data, reference_data)
        print(diff)
        self.assertLess(diff, 1e-10)
    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
示例#9
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
示例#10
0
    def get_sample():
        # Defining Materials
        material_1 = ba.HomogeneousMaterial("example01_Air", 0.0, 0.0)
        material_2 = ba.HomogeneousMaterial("Si", 5.73327e-06, 1.006366e-07)

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

        particleComposition_1 = ba.ParticleComposition()

        for i in range(nslices):
            r = 159 * nm - i * 2
            z = i * 15 * nm
            y = z + 15 * nm

            # Defining Form Factors
            formFactor_1 = ba.FormFactorCone6(r, 5.0 * nm, 68.0 * deg)
            formFactor_2 = ba.FormFactorCone6(r, 10.0 * nm, 78.0 * deg)

            # Defining Particles
            particle_1 = ba.Particle(material_2, formFactor_1)
            particle_1_rotation = ba.RotationY(180.0 * deg)
            particle_1.setRotation(particle_1_rotation)
            particle_1_position = kvector_t(0.0 * nm, 0.0 * nm, y * nm)
            particle_1.setPosition(particle_1_position)
            particle_2 = ba.Particle(material_2, formFactor_2)
            particle_2_position = kvector_t(0.0 * nm, 0.0 * nm, z * nm)
            particle_2.setPosition(particle_2_position)

            # Defining composition of particles at specific positions

            particleComposition_1.addParticle(particle_1)
            particleComposition_1.addParticle(particle_2)

        particleComposition_1_rotation = ba.RotationZ(j * deg)
        particleComposition_1.setRotation(particleComposition_1_rotation)

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

        # 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
示例#11
0
    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)
        material_4 = ba.MaterialBySLD("Fe", 7.9486e-06, -5.9880e-10)

        # Defining Layers

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

        formFactor_1 = ba.FormFactorCone6(85 * nm, 385.0 * nm, 86.0 * deg)
        formFactor_2 = ba.FormFactorCone6(84 * nm, 385.0 * nm, 86.0 * deg)
        formFactor_3 = ba.FormFactorTruncatedSphere(68.0 * nm, 95.0 * nm,
                                                    0.0 * nm)

        particle_1 = ba.Particle(material_4, 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, 385.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(i * 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 Particle Layouts and adding Particles
        layout_1 = ba.ParticleLayout()
        layout_1.addParticle(particleComposition_1, 1.0)
        layout_1.setTotalParticleSurfaceDensity(0.01)

        # 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
示例#12
0
def get_sample(lattice_rotation_angle=0.0 * deg):
    """
    Returns a sample with a grating on a substrate.
    lattice_rotation_angle = 0 - beam parallel to grating lines
    lattice_rotation_angle = 90*deg - beam perpendicular to grating lines
    """
    # defining materials
    m_ambience = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    m_si = ba.HomogeneousMaterial("Si", 5.78164736e-6, 1.02294578e-7)

    box_length, box_width, box_height = 50 * micrometer, 70 * nm, 50 * nm
    lattice_length = 150 * nm

    # collection of particles
    interference = ba.InterferenceFunction1DLattice(
        lattice_length, 90.0 * deg - lattice_rotation_angle)

    pdf = ba.ba.FTDecayFunction1DGauss(450.0)
    interference.setDecayFunction(pdf)

    box_ff = ba.FormFactorLongBoxLorentz(box_length, box_width, box_height)
    box = ba.Particle(m_si, box_ff)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(box, 1.0, ba.kvector_t(0.0, 0.0, 0.0),
                                ba.RotationZ(lattice_rotation_angle))
    particle_layout.setInterferenceFunction(interference)

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

    roughness = ba.LayerRoughness()
    roughness.setSigma(5.0 * nm)
    roughness.setHurstParameter(0.5)
    roughness.setLatteralCorrLength(10.0 * nm)

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(air_layer)
    multi_layer.addLayerWithTopRoughness(substrate_layer, roughness)
    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)

        # Defining Form Factors
        formFactor_1 = ba.FormFactorCone6(90.0 * nm, 270.0 * nm, 75.0 * deg)
        formFactor_2 = ba.FormFactorCone6(88.0 * nm, 270.0 * nm, 75.0 * deg)

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

        # Defining Core Shell Particles

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

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

        # Defining Roughness Parameters
        # layerRoughness_1 = ba.LayerRoughness(1.0, 0.3, 5.0*nm)

        # 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.addLayerWithTopRoughness(layer_2, layerRoughness_1)
        return multiLayer_1
示例#14
0
    def create_meso(self):

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

        basis = self.create_basis(self.particle_material, lattice)

        ff_meso = self.create_outer_formfactor()

        npc = ba.Crystal(basis, lattice)
        npc.setPositionVariance(self.particle_pos_sigma *
                                self.particle_pos_sigma)
        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
def get_sample(lattice_rotation_angle=45 * deg):
    """
    Returns a sample with a grating on a substrate,
    modelled by very long boxes forming a 1D lattice with Cauchy correlations.
    """
    # 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)

    box_length, box_width, box_height = 10 * nm, 10000 * nm, 10 * nm
    lattice_length = 30 * nm

    # collection of particles
    interference = ba.InterferenceFunction1DLattice(lattice_length,
                                                    lattice_rotation_angle)
    pdf = ba.FTDecayFunction1DCauchy(1000.0)
    interference.setDecayFunction(pdf)

    box_ff = ba.FormFactorBox(box_length, box_width, box_height)
    box = ba.Particle(m_particle, box_ff)

    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(box, 1.0, ba.kvector_t(0.0, 0.0, 0.0),
                                ba.RotationZ(lattice_rotation_angle))
    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)
    return multi_layer
Plot form factors.
"""
import bornagain as ba
from bornagain import nanometer, degree
import bornplot as bp
import math

det = bp.Detector(200, -5, 5, -5, 5)
n = 3
results = []
edge = 3.2

title = 'default'
ff = ba.FormFactorDodecahedron(edge * nanometer)
data = bp.run_simulation(det, ff)
results.append(bp.Result(0, data, title))

title = 'rotated'
trafo = ba.RotationZ(13 * degree)
ff = ba.FormFactorDodecahedron(edge * nanometer)
data = bp.run_simulation(det, ff, trafo)
results.append(bp.Result(1, data, title))

title = 'rotated, tilted'
trafo = ba.createProduct(ba.RotationX(9 * degree), ba.RotationZ(13 * degree))
ff = ba.FormFactorDodecahedron(edge * nanometer)
data = bp.run_simulation(det, ff, trafo)
results.append(bp.Result(2, data, title))

bp.make_plot(results, det, "ff_Dodecahedron_asy")
示例#17
0
"""
Plot form factors.
"""
import bornagain as ba
from   bornagain import nanometer, degree
import bornplot as bp

det = bp.Detector( 200, 0, 5, 0, 5 )
n    = 4
results = []
for i in range(n):
    omega=90*i/(n-1)
    title = r'$\omega=%d^\circ$' % omega
    ff = ba.FormFactorRipple1(25*nanometer, 10*nanometer, 8*nanometer )
    trafo = ba.RotationZ(omega*degree)
    data = bp.run_simulation(det,ff,trafo)
    results.append( bp.Result(i, data, title) )
    
bp.make_plot( results, det, "ff_Ripple1" )
    def get_sample():
        # Defining Materials
        material_1 = ba.HomogeneousMaterial("example01_Air", 0.0, 0.0)
        material_2 = ba.HomogeneousMaterial("Si", 5.73327e-06, 1.006366e-07)

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

        # Defining Form Factors
        formFactor_1 = ba.FormFactorCone6(159.0 * nm, 10.0 * nm, 78.0 * deg)
        formFactor_2 = ba.FormFactorCone6(159.0 * nm, 5.0 * nm, 66.0 * deg)
        formFactor_3 = ba.FormFactorPrism6(159.0 * nm, 300.0 * nm)

        particleComposition_11 = ba.ParticleComposition()

        for i in range(nslices):
            z = i * 15.0 * nm
            y = z + 15.0 * nm

            # Defining Particles
            particle_1 = ba.Particle(material_2, formFactor_1)
            particle_1_position = kvector_t(0.0 * nm, 0.0 * nm, z * nm)
            particle_1.setPosition(particle_1_position)

            particle_2 = ba.Particle(material_2, formFactor_2)
            particle_2_rotation = ba.RotationY(180.0 * deg)
            particle_2.setRotation(particle_2_rotation)
            particle_2_position = kvector_t(0.0 * nm, 0.0 * nm, y * nm)
            particle_2.setPosition(particle_2_position)

            particleComposition_11.addParticle(particle_1)
            particleComposition_11.addParticle(particle_2)

        particleComposition_11_rotation = ba.RotationZ(j * deg)
        particleComposition_11.setRotation(particleComposition_11_rotation)

        particle_3 = ba.Particle(material_2, formFactor_3)
        particle_3_rotation = ba.RotationY(30.0 * deg)
        particle_3.setRotation(particle_3_rotation)
        particle_3_position = kvector_t(0.0 * nm, 0.0 * nm, 79.5 * nm)
        particle_3.setPosition(particle_3_position)

        z1 = j
        z2 = j + 120
        z3 = j + 240

        particleComposition_1 = ba.ParticleComposition()
        particleComposition_1.addParticle(particle_3)
        particleComposition_1_rotation = ba.RotationZ(z1 * deg)
        particleComposition_1.setRotation(particleComposition_1_rotation)
        particleComposition_2 = ba.ParticleComposition()
        particleComposition_2.addParticle(particle_3)
        particleComposition_2_rotation = ba.RotationZ(z2 * deg)
        particleComposition_2.setRotation(particleComposition_2_rotation)
        particleComposition_3 = ba.ParticleComposition()
        particleComposition_3.addParticle(particle_3)
        particleComposition_3_rotation = ba.RotationZ(z3 * deg)
        particleComposition_3.setRotation(particleComposition_3_rotation)

        # Defining Particle Layouts and adding Particles
        layout_1 = ba.ParticleLayout()
        layout_1.addParticle(particleComposition_11, 0.7)
        layout_1.addParticle(particleComposition_1, 0.1)
        layout_1.addParticle(particleComposition_2, 0.1)
        layout_1.addParticle(particleComposition_3, 0.1)
        layout_1.setTotalParticleSurfaceDensity(0.001)

        # 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