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(): # Defining Materials m_air = ba.HomogeneousMaterial("Air", 0.0, 0.0) m_particle = ba.HomogeneousMaterial("Particle", 0.0006, 2e-08) m_substrate = ba.HomogeneousMaterial("Substrate", 6e-06, 2e-08) # Defining Layers l_air = ba.Layer(m_air) l_substrate = ba.Layer(m_substrate) # Defining Form Factors ff_sphere = ba.FormFactorFullSphere(particle_radius) # Defining composition of particles at specific positions particle_composition = ba.ParticleComposition() # compute number of particles in the vertical direction n = int((height - 2.0 * particle_radius) // lattice_length) # add particles to the particle composition for i in range(n + 1): particle = ba.Particle(m_particle, ff_sphere) particle_position = kvector_t(0.0 * nm, 0.0 * nm, i * lattice_length) particle.setPosition(particle_position) particle_composition.addParticle(particle) # Defining Interference Function interference = ba.InterferenceFunction2DLattice(lattice_length, lattice_length, 90.0 * deg, 0.0 * deg) interference_pdf = ba.FTDecayFunction2DCauchy(500.0 * nm, 500.0 * nm, 0.0 * deg) interference.setDecayFunction(interference_pdf) # interference.setPositionVariance(0.3) # uncomment to add position variance (2D!) # interference.setIntegrationOverXi(True) # uncomment to integrate over xi. Slow! # Defining Particle Layout and adding Particles layout = ba.ParticleLayout() layout.addParticle(particle_composition, 1.0) layout.setInterferenceFunction(interference) layout.setWeight(1.0) # Adding layout to layer l_air.addLayout(layout) # Defining Multilayers multilayer = ba.MultiLayer() multilayer.addLayer(l_air) multilayer.addLayer(l_substrate) # print(multilayer.parametersToString()) # uncomment to print sample parameters return multilayer
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) particleComposition_1 = 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_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_composition(self, top_material, bottom_material): """ Returns particle composition representing sphere made of two different materials. Origin of new object is at the bottom of resulting sphere. """ topCup = ba.Particle(top_material, ba.FormFactorTruncatedSphere(sphere_radius, sphere_radius*2 - bottom_cup_height)) bottomCup = ba.Particle(bottom_material, ba.FormFactorTruncatedSphere(sphere_radius, sphere_radius*2, sphere_radius*2 - bottom_cup_height)) # origin of resulting sphere will be at the bottom result = ba.ParticleComposition() result.addParticle(topCup, kvector_t(0.0, 0.0, bottom_cup_height)) result.addParticle(bottomCup, kvector_t(0.0, 0.0, 0.0)) return result
def get_composition_v2(self, top_material, bottom_material): """ Returns particle composition representing sphere made of two different materials. Alternative to previous method. Rotation is used to get bottom part """ topCup = ba.Particle(top_material, ba.FormFactorTruncatedSphere(sphere_radius, sphere_radius*2 - bottom_cup_height)) bottomCup = ba.Particle(bottom_material, ba.FormFactorTruncatedSphere(sphere_radius, bottom_cup_height)) bottomCup.setRotation(ba.RotationX(180*deg)) # origin of resulting sphere will be at the bottom result = ba.ParticleComposition() result.addParticle(topCup, kvector_t(0.0, 0.0, bottom_cup_height)) result.addParticle(bottomCup, kvector_t(0.0, 0.0, bottom_cup_height)) return result
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 create_basis(self, material, lattice, np_radius, np_sigma_radius, nparticles): scale_param = math.sqrt( math.log((np_sigma_radius / np_radius)**2 + 1.0)) particle = ba.Particle( material, ba.FormFactorSphereLogNormalRadius(np_radius, scale_param, nparticles)) bas_a = lattice.getBasisVectorA() bas_b = lattice.getBasisVectorB() bas_c = lattice.getBasisVectorC() position_0 = ba.kvector_t(0.0, 0.0, 0.0) position_1 = 1.0 / 3.0 * (2.0 * bas_a + bas_b + bas_c) position_2 = 1.0 / 3.0 * (bas_a + 2.0 * bas_b + 2.0 * bas_c) pos_vector = [position_0, position_1, position_2] basis = ba.ParticleComposition() basis.addParticles(particle, pos_vector) return basis
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_position = kvector_t(0.0 * nm, 0.0 * nm, 333.0 * nm) particle_1.setPosition(particle_1_position) # Defining composition of particles at specific positions particleComposition_1 = ba.ParticleComposition() particleComposition_1.addParticle(particle_1) 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(): """ Returns a sample with cylinders on a substrate, forming a 2D centered 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.InterferenceFunction2DLattice.createSquare(25.0*nm) pdf = ba.FTDecayFunction2DCauchy(300.0*nm/2.0/numpy.pi, 100.0*nm/2.0/numpy.pi) interference.setDecayFunction(pdf) particle_layout = ba.ParticleLayout() position1 = ba.kvector_t(0.0, 0.0, 0.0) position2 = ba.kvector_t(12.5*nm, 12.5*nm, 0.0) cylinder_ff = ba.FormFactorCylinder(3.*nm, 3.*nm) cylinder = ba.Particle(m_particle, cylinder_ff) basis = ba.ParticleComposition() basis.addParticles(cylinder, [position1, position2]) particle_layout.addParticle(basis) 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_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 = 30*nm height_a = 4*nm height_b = 8*nm nstack = 5 stack = ba.ParticleComposition() for i in range(0, nstack): box_a = ba.Particle(mat_a, ba.FormFactorBox(length, width, height_a)) box_b = ba.Particle(mat_b, ba.FormFactorBox(length, width, height_b)) stack.addParticle(box_a, ba.kvector_t(0.0, 0.0, i*(height_a+height_b))) stack.addParticle(box_b, ba.kvector_t(0.0, 0.0, height_a + i*(height_a+height_b))) 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