Example #1
0
def get_sample():
    """
    Returns a sample with a cylindrically shaped mesocrystal 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)

    # mesocrystal lattice
    lattice_basis_1 = ba.kvector_t(5.0, 0.0, 0.0)
    lattice_basis_2 = ba.kvector_t(0.0, 5.0, 0.0)
    lattice_basis_3 = ba.kvector_t(0.0, 0.0, 5.0)
    lattice = ba.Lattice(lattice_basis_1, lattice_basis_2, lattice_basis_3)

    # spherical particle that forms the base of the mesocrystal
    sphere_ff = ba.FormFactorFullSphere(2 * nm)
    sphere = ba.Particle(m_particle, sphere_ff)

    # crystal structure
    crystal = ba.Crystal(sphere, lattice)

    # mesocrystal
    meso_ff = ba.FormFactorCylinder(20 * nm, 50 * nm)
    meso = ba.MesoCrystal(crystal, meso_ff)

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

    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
Example #2
0
    def testSphericalCupOnTopOfSubstrate(self):
        """
        Compares two simulation intended to  provide identical results.
        Simulation #1: truncated sphere on top of substrate.
        Simulation #2: spherical particle crossing the interface.
        Both particles are made of same material as substrate. From scattering point of view,
        both cases should look like a truncated sphere on top of substrate.
        """

        sphere_radius = 10.0
        sphere_shift = 4.0  # shift beneath interface in absolute units

        # truncated sphere on top of substrate with height 16nm
        truncatedSphere = ba.Particle(mSubstrate, ba.FormFactorTruncatedSphere(sphere_radius, sphere_radius*2 - sphere_shift, 0))
        reference = self.get_result(truncatedSphere)

        # sphere crossing interface to look like truncated sphere above
        sphere = ba.Particle(mSubstrate, ba.FormFactorFullSphere(sphere_radius))
        sphere.setPosition(0, 0, -sphere_shift)
        data = self.get_result(sphere)

        diff = ba.RelativeDifference(data, reference)
        print(diff)
        self.assertLess(diff, 1e-10)
Example #3
0
    def buildSample(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.value)
        sphere = ba.Particle(m_particle, sphere_ff)
        particle_layout = ba.ParticleLayout()
        particle_layout.addParticle(sphere)

        interference = ba.InterferenceFunction2DLattice.createHexagonal(
            self.lattice_constant.value)
        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 buildSample(self):
        # defining materials
        m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0)
        m_Si = ba.HomogeneousMaterial("Si", 5.78164736e-6, 1.02294578e-7)
        m_Ag = ba.HomogeneousMaterial("Ag", 2.24749529E-5, 1.61528396E-6)
        m_PTFE = ba.HomogeneousMaterial("PTFE", 5.20508729E-6, 1.96944292E-8)
        m_HMDSO = ba.HomogeneousMaterial("HMDSO", 2.0888308E-6, 1.32605651E-8)

        # collection of particles with size distribution
        nparticles = 20
        nfwhm = 2.0
        sphere_ff = ba.FormFactorFullSphere(self.radius.value)
        # sphere_ff = ba.FormFactorTruncatedSphere(
        #    self.radius.value, self.radius.value*1.5)

        sphere = ba.Particle(m_Ag, sphere_ff)
        position = ba.kvector_t(0 * ba.nm, 0 * ba.nm,
                                -1.0 * self.hmdso_thickness.value)
        sphere.setPosition(position)
        ln_distr = ba.DistributionLogNormal(self.radius.value,
                                            self.sigma.value)
        par_distr = ba.ParameterDistribution("/Particle/FullSphere/Radius",
                                             ln_distr, nparticles, nfwhm)
        # par_distr = ba.ParameterDistribution(
        #    "/Particle/TruncatedSphere/Radius", ln_distr, nparticles, nfwhm)
        # par_distr.linkParameter("/Particle/TruncatedSphere/Height")
        part_coll = ba.ParticleDistribution(sphere, par_distr)

        # interference function
        interference = ba.InterferenceFunctionRadialParaCrystal(
            self.distance.value, 1e6 * ba.nm)
        interference.setKappa(self.kappa.value)
        interference.setDomainSize(20000.0)
        pdf = ba.FTDistribution1DGauss(self.disorder.value)
        interference.setProbabilityDistribution(pdf)

        # assembling particle layout
        particle_layout = ba.ParticleLayout()
        particle_layout.addParticle(part_coll, 1.0)
        particle_layout.addInterferenceFunction(interference)
        particle_layout.setApproximation(ba.ILayout.SSCA)
        particle_layout.setTotalParticleSurfaceDensity(1)

        # roughness
        r_ptfe = ba.LayerRoughness(2.3 * ba.nm, 0.3, 5.0 * ba.nm)
        r_hmdso = ba.LayerRoughness(1.1 * ba.nm, 0.3, 5.0 * ba.nm)

        # layers
        air_layer = ba.Layer(m_air)
        hmdso_layer = ba.Layer(m_HMDSO, self.hmdso_thickness.value)
        hmdso_layer.addLayout(particle_layout)
        ptfe_layer = ba.Layer(m_PTFE, self.ptfe_thickness.value)
        substrate_layer = ba.Layer(m_Si)

        # assembling multilayer
        multi_layer = ba.MultiLayer()
        multi_layer.addLayer(air_layer)
        multi_layer.addLayerWithTopRoughness(hmdso_layer, r_hmdso)
        multi_layer.addLayerWithTopRoughness(ptfe_layer, r_ptfe)
        multi_layer.addLayer(substrate_layer)

        return multi_layer
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),
    ba.FormFactorTruncatedCube(15.0, 6.0),
    ba.FormFactorTruncatedSphere(5.0, 7.0, 0),
    ba.FormFactorTruncatedSpheroid(7.5, 9.0, 1.2, 0),
]

Example #6
0
"""
Plot form factor.
"""
import bornagain as ba
from   bornagain import nanometer, degree
import bornplot as bp

det = bp.Detector( 200, 0, 5, 0, 5 )
n    = 1
results = []
for i in range(n):
    ff = ba.FormFactorFullSphere(3.9*nanometer)
    data = bp.run_simulation(det,ff)
    results.append( bp.Result(i, data) )
    
bp.make_plot( results, det, "ff_FullSphere" )
Example #7
0
 def create_particle(self, material):
     return ba.Particle(material,
                        ba.FormFactorFullSphere(self.m_nanoparticle_radius))