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
示例#2
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
示例#3
0
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)

    # Spherical particles, form the base of the mesocrystal
    ff_sphere = ba.FormFactorFullSphere(particle_radius)
    sphere = ba.Particle(m_particle, ff_sphere)

    # mesocrystal lattice (cubic lattice for this example)
    lattice_a = ba.kvector_t(lattice_length, 0.0, 0.0)
    lattice_b = ba.kvector_t(0.0, lattice_length, 0.0)
    lattice_c = ba.kvector_t(0.0, 0.0, lattice_length)
    lattice = ba.Lattice(lattice_a, lattice_b, lattice_c)

    # crystal structure
    crystal = ba.Crystal(sphere, lattice)
    # uncomment to add variance of displacement in each dimension (sigma^2)
    # crystal.setDWFactor(2)    #  for BornAgain 1.16 and below
    # crystal.setPositionVariance(2)    # for BornAgain 1.17+

    # mesocrystal
    # meso_ff = ba.FormFactorBox(meso_length, meso_width, meso_height)      # Box
    # meso_ff = ba.FormFactorCylinder(meso_width/2.0, meso_height)          # Cylinder
    # meso_ff = ba.FormFactorTruncatedSphere(meso_width/2.0, meso_height)   # Tr. Sphere
    # meso_ff = ba.FormFactorGauss(meso_width, meso_height)                 # Gauss
    meso_ff = ba.FormFactorLorentz(meso_width, meso_height)  # Lorentz
    meso = ba.MesoCrystal(crystal, meso_ff)

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

    # Adding layouts to layers
    l_air.addLayout(layout)

    # Defining Multilayers
    multilayer = ba.MultiLayer()
    multilayer.addLayer(l_air)
    multilayer.addLayer(l_substrate)
    # print(multilayer.parametersToString())
    return multilayer
示例#4
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
示例#5
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