Пример #1
0
            mapar = mbpar
            for ma in range(0, l + 1, 1):
                if mapar == 1:
                    ulist[llup] = np.conj(ulist[llu])
                else:
                    ulist[llup] = -np.conj(ulist[llu])

                mapar = -mapar
                llu += 1
                llup -= 1
            mbpar = -mbpar
            mb += 1
    return


@nb.njit(nb.c16(nb.c16, nb.c16, nb.i8, nb.i8),
         cache=True,
         fastmath=True,
         nogil=True)
def sph_harm(Ra, Rb, l, m):
    '''
    Spherical harmonics from Wigner-D functions

    args:
        Ra: complex, Cayley-Klein parameter for spherical harmonic
        Rb: complex, Cayley-Klein parameter for spherical harmonic
        l: int, index of spherical harmonic l >= 0
        m: int, index of spherical harmonic -l <= m <= l

    The spherical harmonics are a subset of Wigner-D matrices,
    and can be calculated in the same manner
Пример #2
0
        3.28721858553429e+293, 5.42391066613159e+295, 9.00369170577843e+297,
        1.503616514865e+300
    ],
                       dtype=np.float64)
    return fac_arr[n]


@nb.njit(nb.f8(nb.i8, nb.i8, nb.i8), cache=True, fastmath=True, nogil=True)
def deltacg(l1, l2, l):
    sfaccg = factorial((l1 + l2 + l) // 2 + 1)
    return np.sqrt(
        factorial((l1 + l2 - l) // 2) * factorial(
            (l1 - l2 + l) // 2) * factorial((-l1 + l2 + l) // 2) / sfaccg)


@nb.njit(nb.c16(nb.c16, nb.c16, nb.i8, nb.i8, nb.i8),
         cache=True,
         fastmath=True,
         nogil=True)
def Wigner_D(Ra, Rb, twol, twomp, twom):

    ra, phia = cmath.polar(Ra)
    rb, phib = cmath.polar(Rb)

    epsilon = 10**(-15)
    if ra <= epsilon:
        if twomp != -twom or abs(twomp) > twol or abs(twom) > twol:
            return 0.0j

        else:
            if (twol - twom) % 4 == 0:
Пример #3
0
                        if m < 0 or m > j:
                            continue

                        # convert array arguments to CG args
                        J1 = j1 / 2
                        J2 = j2 / 2
                        J = j / 2

                        M1 = m1 - J1
                        M2 = m2 - J2
                        M = m - J
                        # add CG coef to cgs array
                        cgs[j1, j2, j, m1, m2] = CG(J1, M1, J2, M2, J, M)


@numba.njit(numba.c16(numba.i8, numba.i8, numba.i8, numba.f8, numba.f8,
                      numba.f8),
            cache=True,
            fastmath=True,
            nogil=True)
def U(j, m, m_prime, psi, theta, phi):
    '''
    Computes the 4-D hyperspherical harmonic given the three angular coordinates
    and indices

    args:
        j:  free integer parameter, used to index arrays, corresponds to free half integral/
            integral constants used for calculation, int

        m, mp:  free integer parameter, used to index arrays, cooresponds to free half integral/
            integral constants used for calculation, int
Пример #4
0
                    atm_nums[i, j] = neighbor[0].specie.number

        else:
            raise NotImplementedError('Specified backend not supported')

        # assign these arrays to attributes
        self.center_atoms = center_atoms
        self.neighborlist = neighborlist
        self.neighbor_indices = neighbor_inds
        self.atomic_numbers = atm_nums
        self.site_atomic_numbers = site_atomic_numbers

        return


@nb.njit(nb.c16(nb.c16, nb.c16, nb.i8, nb.i8), cache=True,
         fastmath=True, nogil=True)
def sph_harm(Ra, Rb, l, m):
    '''
    Spherical harmonics from Wigner-D functions

    args:
        Ra: complex, Cayley-Klein parameter for spherical harmonic
        Rb: complex, Cayley-Klein parameter for spherical harmonic
        l: int, index of spherical harmonic l >= 0
        layer: int, index of spherical harmonic -l <= layer <= l

    The spherical harmonics are a subset of Wigner-D matrices,
    and can be calculated in the same manner
    '''
    if m % 2 == 0:
Пример #5
0
                np.sin(beta / 2)**(2 * J - M - MP - 2 * k) / factorial(k) /
                factorial(J - M - k) / factorial(J - MP - k) /
                factorial(M + MP + k))

        if derivative == True:
            temp *= ((2 * J - M - MP - 2 * k) / np.tan(beta / 2) -
                     (M + MP + 2 * k) * np.tan(beta / 2))

        d += temp

    d *= constant

    return d


@numba.njit(numba.c16(numba.f8, numba.f8, numba.f8, numba.f8, numba.f8,
                      numba.f8, numba.b1),
            cache=True,
            fastmath=True,
            nogil=True)
def wigner_D(J, M, MP, alpha, beta, gamma, derivative):
    '''
    Large Wigner D function
    Ref:  Quantum theory of angular momentum D.A. Varshalovich 1988
    Args:
        alpha: float
               First euler angle of rotation

        beta: float
              Second euler angle of rotation

        gamma: float