示例#1
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
示例#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_simulation():
    """
    Returns a GISAXS simulation with beam and detector defined.
    """
    simulation = ba.GISASSimulation()
    simulation.setDetectorParameters(200, -2.0*deg, 2.0*deg,
                                     200, 0.0*deg, 2.0*deg)
    simulation.setBeamParameters(1.0*angstrom, 0.2*deg, 0.0*deg)

    # Option 2: use BornAgain distributions
    angle_distr = ba.DistributionGate(0*deg, 180*deg)
    simulation.addParameterDistribution("*/Particle/ZRotation/Angle", angle_distr, 100)
    return simulation
def get_simulation():
    """
    Returns a GISAXS simulation with beam and detector defined.
    Assigns additional distribution to lattice rotation angle.
    """
    simulation = ba.GISASSimulation()
    simulation.setDetectorParameters(100, 0.0 * deg, 2.0 * deg, 100, 0.0 * deg,
                                     2.0 * deg)
    simulation.setBeamParameters(1.0 * angstrom, 0.2 * deg, 0.0 * deg)

    simulation.setSample(get_sample())

    xi_min = 0.0 * deg
    xi_max = 240.0 * deg
    xi_distr = ba.DistributionGate(xi_min, xi_max)

    # assigns distribution with 3 equidistant points to lattice rotation angle
    simulation.addParameterDistribution("*/SquareLattice/Xi", xi_distr, 3)

    return simulation