예제 #1
0
def calc_model_full(func_no_const, lattice_num, layer=0.1, const=0.0, ddens=1, peakmax=5):
    """
    :param func_no_const:   function that sets the surface implicitly
    :param lattice_num:     points in one side of mesh
    :param layer:           layer width, fraction of lattice parameter
    :param const:           const for function
    :param peakmax:         max number in hkl
    :param show:            to show or not to show triangulation
    :return:
    """
    def func(x, y, z):
        return func_no_const(x, y, z, const)

    qsvec, lenqs = generate_qvecs_lenqs_deprecated(peakmax)

    cube = cube_lattice(lattice_num, func)

    factor_struct = factor_calc_structural(qsvec, cube)
    factor_mol = factor_calc_molecular(qsvec, layer, ddens)

    amplitude = factor_struct * factor_mol
    intensity = amplitude**2

    multiplicity = factor_calc_multiplicity_intens(qsvec)
    intensity *= multiplicity

    lorentz = lenqs * lenqs
    intensity *= lorentz

    return qsvec, intensity
예제 #2
0
def calc_model_set_fstruct_doublelayer(factor_structural, layer_in, ddens_in, layer_out, ddens_out, peakmax=5):

    assert layer_in <= layer_out, 'layer out should be greater or equal than layer in'
    qsvec, lenqs = generate_qvecs_lenqs_deprecated(peakmax)

    multipl = factor_calc_multiplicity_intens(qsvec)

    if len(factor_structural) != len(qsvec):
        raise ValueError("different size of struct factor and number of peaks")
#
    factor_molecular = factor_calc_molecular(qsvec, layer_in, ddens_in-ddens_out)\
                       + factor_calc_molecular(qsvec, layer_out, ddens_out)
#
    amplitude = factor_structural * factor_molecular
    intensity = amplitude**2 * np.array(multipl) * lenqs**2

    return qsvec, intensity
예제 #3
0
def calc_model_set_fstruct(factor_structural, layer, ddens, peakmax=5):
    """

    :param factor_structural:   preset structural factor for all points
    :param layer:               width of layer, fraction of lattice parameter
    :param peakmax:             max number in hkl
    :return:                    qsvec, intensity
    """
    qsvec, lenqs = generate_qvecs_lenqs_deprecated(peakmax)

    multipl = factor_calc_multiplicity_intens(qsvec)

    if len(factor_structural) != len(qsvec):
        raise ValueError("different size of struct factor and number of peaks")
#
    factor_molecular = factor_calc_molecular(qsvec, layer, ddens)
#
    amplitude = factor_structural * factor_molecular
    intensity = amplitude**2 * np.array(multipl) * lenqs**2

    return qsvec, intensity