def get_sample():
    """
    Returns a sample with box-shaped core-shell particles on a substrate.
    """
    # defining materials
    m_vacuum = ba.HomogeneousMaterial("Vacuum", 0.0, 0.0)
    m_shell = ba.HomogeneousMaterial("Shell", 1e-4, 2e-8)
    m_core = ba.HomogeneousMaterial("Core", 6e-5, 2e-8)

    # collection of particles
    parallelepiped1_ff = ba.FormFactorBox(16 * nm, 16 * nm, 8 * nm)
    parallelepiped2_ff = ba.FormFactorBox(12 * nm, 12 * nm, 7 * nm)
    shell_particle = ba.Particle(m_shell, parallelepiped1_ff)
    core_particle = ba.Particle(m_core, parallelepiped2_ff)
    core_position = ba.kvector_t(0.0, 0.0, 0.0)

    particle = ba.ParticleCoreShell(shell_particle, core_particle,
                                    core_position)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(particle)
    interference = ba.InterferenceFunctionNone()
    particle_layout.setInterferenceFunction(interference)

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

    multi_layer = ba.MultiLayer()
    multi_layer.addLayer(vacuum_layer)

    return multi_layer
Esempio n. 2
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)
Esempio n. 3
0
def get_vertical_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.rotate(ba.RotationEuler(45.0*deg, 90.*deg, 0.0))

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

    stack.setPosition(0.0, 0.0, width_a/2.)

    return particles
Esempio n. 4
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
Esempio n. 5
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
Esempio n. 6
0
def getSample():
    # Defining Materials
    material_1 = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    material_2 = ba.HomogeneousMaterial("Si", 7.6e-06, 1.7e-07)

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

    # Defining Form Factors
    formFactor_1 = ba.FormFactorBox(20.0 * nm, 20.0 * nm, 10.0 * nm)

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

    # Defining Particle Layouts and adding Particles
    layout_1 = ba.ParticleLayout()
    layout_1.addParticle(particle_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
Esempio n. 7
0
def getSample():
    # Defining Materials
    material_1 = ba.HomogeneousMaterial("Air", 0.0, 0.0)
    material_3 = ba.HomogeneousMaterial("Si", 7.6e-06, 1.7e-07)
    material_2 = ba.HomogeneousMaterial("Polymer", 1.99999999995e-06, 1.3e-08)

    # Defining Layers
    layer_1 = ba.Layer(material_1)
    layer_2 = ba.Layer(material_2, 50)
    layer_3 = ba.Layer(material_3)

    # Defining Form Factors
    formFactor_1 = ba.FormFactorBox(20.0 * nm, 20.0 * nm, 10.0 * nm)

    # Defining Particles
    particle_1 = ba.Particle(material_3, formFactor_1)
    particle_1_rotation = ba.RotationX(45.0 * deg)
    particle_1.setRotation(particle_1_rotation)
    particle_1_position = kvector_t(0.0 * nm, 0.0 * nm, -42.9 * nm)
    particle_1.setPosition(particle_1_position)

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

    # Adding layouts to layers
    layer_2.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 get_sample():
    """
    Returns a sample with cylindrical particles on 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
    edge = 40 * nm
    ff = ba.FormFactorBox(edge, edge, edge)
    cylinder = ba.Particle(m_particle, ff)
    particle_layout = ba.ParticleLayout()
    particle_layout.addParticle(cylinder, 1.0)

    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(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
"""
All form factors available in BornAgain in the Born Approximation
"""
import numpy
import bornagain as ba
from bornagain import deg, angstrom
from matplotlib import pyplot as plt

phi_min, phi_max = -2.0, 2.0
alpha_min, alpha_max = 0.0, 2.0

formfactors = [
    ba.FormFactorAnisoPyramid(20.0, 16.0, 13.0, 60.0 * deg),
    ba.FormFactorBox(20.0, 16.0, 13.0),
    ba.FormFactorCantellatedCube(15.0, 6.0),
    ba.FormFactorCone(10.0, 13.0, 60.0 * deg),
    ba.FormFactorCone6(10.0, 13.0, 60.0 * deg),
    ba.FormFactorCuboctahedron(20.0, 13.0, 0.7, 60.0 * deg),
    ba.FormFactorCylinder(8.0, 16.0),
    ba.FormFactorDodecahedron(5.0),
    ba.FormFactorEllipsoidalCylinder(8.0, 13.0, 16.0),
    ba.FormFactorFullSphere(8.0),
    ba.FormFactorFullSpheroid(10.0, 13.0),
    ba.FormFactorHemiEllipsoid(10.0, 6.0, 8.0),
    ba.FormFactorIcosahedron(8.0),
    ba.FormFactorPrism3(10.0, 13.0),
    ba.FormFactorPrism6(5.0, 11.0),
    ba.FormFactorPyramid(18.0, 13.0, 60.0 * deg),
    ba.FormFactorCosineRippleBox(27.0, 20.0, 14.0),
    ba.FormFactorSawtoothRippleBox(36.0, 25.0, 14.0, 3.0),
    ba.FormFactorTetrahedron(15.0, 6.0, 60.0 * deg),
Esempio n. 12
0
"""
Plot form factors.
"""
import bornagain as ba
from bornagain import nanometer, degree
import bornplot as bp

det = bp.Detector(1000, 0, 5, 0, 5)
n = 3
results = []
for i in range(n):
    siz = [10, 100, 1000][i]
    title = r'$L_x = %d~nm$' % siz
    ff = ba.FormFactorBox(siz, 10, 10)
    data = bp.run_simulation(det, ff)
    results.append(bp.Result(i, data, title))

bp.make_plot(results, det, "ff_det_box")
Esempio n. 13
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.FormFactorBox(18 * nanometer, 4.6 * nanometer, 3 * 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_Box")