Example #1
0
def get_tetrahedra_integration_weight(omegas, tetrahedra_omegas, function='I'):
    """Returns integration weights

    Parameters
    ----------
    omegas : float or list of float values
        Energy(s) at which the integration weight(s) are computed.
    tetrahedra_omegas : ndarray of list of list
        Energies at vertices of 24 tetrahedra
        shape=(24, 4)
        dytpe='double'
    function : str, 'I' or 'J'
        'J' is for intetration and 'I' is for its derivative.

    """

    if isinstance(omegas, float):
        return phonoc.tetrahedra_integration_weight(
            omegas, np.array(tetrahedra_omegas, dtype='double', order='C'),
            function)
    else:
        integration_weights = np.zeros(len(omegas), dtype='double')
        phonoc.tetrahedra_integration_weight_at_omegas(
            integration_weights, np.array(omegas, dtype='double'),
            np.array(tetrahedra_omegas, dtype='double', order='C'), function)
        return integration_weights
Example #2
0
def get_tetrahedra_integration_weight(omegas,
                                      tetrahedra_omegas,
                                      function='I'):
    """Returns integration weights

    Parameters
    ----------
    omegas : float or list of float values
        Energy(s) at which the integration weight(s) are computed.
    tetrahedra_omegas : ndarray of list of list
        Energies at vertices of 24 tetrahedra
        shape=(24, 4)
        dytpe='double'
    function : str, 'I' or 'J'
        'J' is for intetration and 'I' is for its derivative.

    """

    if isinstance(omegas, float):
        return phonoc.tetrahedra_integration_weight(
            omegas,
            np.array(tetrahedra_omegas, dtype='double', order='C'),
            function)
    else:
        integration_weights = np.zeros(len(omegas), dtype='double')
        phonoc.tetrahedra_integration_weight_at_omegas(
            integration_weights,
            np.array(omegas, dtype='double'),
            np.array(tetrahedra_omegas, dtype='double', order='C'),
            function)
        return integration_weights
Example #3
0
def get_tetrahedra_integration_weight(omegas, tetrahedra_omegas, function='I'):
    if isinstance(omegas, float):
        return phonoc.tetrahedra_integration_weight(
            omegas, np.array(tetrahedra_omegas, dtype='double', order='C'),
            function)
    else:
        integration_weights = np.zeros(len(omegas), dtype='double')
        phonoc.tetrahedra_integration_weight_at_omegas(
            integration_weights, np.array(omegas, dtype='double'),
            np.array(tetrahedra_omegas, dtype='double', order='C'), function)
        return integration_weights
Example #4
0
def get_tetrahedra_integration_weight(omegas, tetrahedra_omegas, function="I"):
    if isinstance(omegas, float):
        return phonoc.tetrahedra_integration_weight(
            omegas, np.array(tetrahedra_omegas, dtype="double", order="C"), function
        )
    else:
        integration_weights = np.zeros(len(omegas), dtype="double")
        phonoc.tetrahedra_integration_weight_at_omegas(
            integration_weights,
            np.array(omegas, dtype="double"),
            np.array(tetrahedra_omegas, dtype="double", order="C"),
            function,
        )
        return integration_weights
Example #5
0
def get_tetrahedra_integration_weight(omegas,
                                      tetrahedra_omegas,
                                      function='I'):
    if isinstance(omegas, float):
        return phonoc.tetrahedra_integration_weight(
            omegas,
            np.array(tetrahedra_omegas, dtype='double', order='C'),
            function)
    else:
        integration_weights = np.zeros(len(omegas), dtype='double')
        phonoc.tetrahedra_integration_weight_at_omegas(
            integration_weights,
            np.array(omegas, dtype='double'),
            np.array(tetrahedra_omegas, dtype='double', order='C'),
            function)
        return integration_weights