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 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
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
def get_sample(radius=153.4, d=1000.0): # Defining Materials material_1 = ba.HomogeneousMaterial("Air", 0.0, 0.0) material_3 = ba.MaterialBySLD("Si", 2.0737e-06, -2.3758e-11) material_2 = ba.MaterialBySLD("Au", 4.6665e-06, -1.6205e-08) # Defining Layers layer_1 = ba.Layer(material_1) # Defining Form Factors formFactor = ba.FormFactorCone6(radius * ba.nm, 300.0 * ba.nm, 81.0 * ba.deg) # Defining Particles particle = ba.Particle(material_3, formFactor) interference = ba.InterferenceFunctionRadialParaCrystal( d * ba.nm, 2e3 * ba.nm) pdf = ba.FTDistribution1DGauss(250.0 * ba.nm) interference.setProbabilityDistribution(pdf) # Defining Particle Layouts and adding Particles layout_1 = ba.ParticleLayout() layout_1.addParticle(particle, 1.0) layout_1.setTotalParticleSurfaceDensity(0.01) layout_1.setInterferenceFunction(interference) # Adding layouts to layers layer_1.addLayout(layout_1) # Defining Multilayers multiLayer_1 = ba.MultiLayer() multiLayer_1.addLayer(layer_1) return multiLayer_1
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
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), ba.FormFactorTruncatedCube(15.0, 6.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 = 30 * i / (n - 1) title = r'$\omega=%d^\circ$' % omega ff = ba.FormFactorCone6(6 * nanometer, 5 * nanometer, 60 * degree) 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_Cone6")
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