Пример #1
0
        def getf(f, r, a, n, m):
            if n == 0:
                N = 0.25
                ijks = [(0, 0, 0)]
                coefs = [1]
            elif n == 1 and m == 0:
                N = 0.25
                ijks = [(0, 0, 1)]
                coefs = [1]
            elif n == 1:
                N = 0.25
                ijks = [(1, 0, 0), (0, 1, 0)]
                if m == 1:
                    coefs = [1, 1j]
                else:
                    coefs = [1, -1j]
            elif n == 2 and m == 0:
                N = 3
                ijks = [(0, 0, 2), (2, 0, 0), (0, 2, 0)]
                coefs = [2, -1, -1]
            elif n == 2 and m == 1:
                N = 0.25
                ijks = [(1, 0, 1), (0, 1, 1)]
                coefs = [1, 1.0j]
            elif n == 2 and m == -1:
                N = 0.25
                ijks = [(1, 0, 1), (0, 1, 1)]
                coefs = [1, -1.0j]
            elif n == 2 and m == 2:
                N = 1
                ijks = [(2, 0, 0), (0, 2, 0), (1, 1, 0)]
                coefs = [1, -1, 1.0j * 2]
            elif n == 2 and m == -2:
                N = 1
                ijks = [(2, 0, 0), (0, 2, 0), (1, 1, 0)]
                coefs = [1, -1, -1.0j * 2]
            elif n == 3 and m == 0:
                N = 15
                ijks = [(0, 0, 3), (0, 2, 1), (2, 0, 1)]
                coefs = [2, -3, -3]
            else:
                raise ValueError("Do not know that n,m pair %d %d" % (n, m))
            return (
                r * 2**(n + 2) * np.sqrt(np.pi * N / fac2(2 * n + 1)) *
                (a * r)**n * f,
                ijks,
                coefs,
            )
            """
			elif n == 2 and m == 1:
				N = 0.25
				ijks = [(1,0,1)]
				coefs = [1]
			elif n == 2 and m == -1:
				N = 0.25
				ijks = [(0,1,1)]
				coefs = [1]
			"""
            """
Пример #2
0
def contracted_norm(l, alpha, a):
    r"""Compute the normalization constant for a contracted Gaussian function.

    A contracted Gaussian function is defined as

    .. math::

        \psi = a_1 G_1 + a_2 G_2 + a_3 G_3,

    where :math:`a` denotes the contraction coefficients and :math:`G` is a primitive Gaussian function. The
    normalization constant for this function is computed as

    .. math::

        N(l, \alpha, a) = [\frac{\pi^{3/2}(2l_x-1)!! (2l_y-1)!! (2l_z-1)!!}{2^{l_x + l_y + l_z}}
        \sum_{i,j} \frac{a_i a_j}{(\alpha_i + \alpha_j)^{{l_x + l_y + l_z+3/2}}}]^{-1/2}

    where :math:`l` and :math:`\alpha` denote the angular momentum quantum number and the exponent
    of the Gaussian function, respectively.

    Args:
        l (tuple[int]): angular momentum quantum number of the primitive Gaussian functions
        alpha (array[float]): exponents of the primitive Gaussian functions
        a (array[float]): coefficients of the contracted Gaussian functions

    Returns:
        array[float]: normalization coefficient

    **Example**

    >>> l = (0, 0, 0)
    >>> alpha = np.array([3.425250914, 0.6239137298, 0.168855404])
    >>> a = np.array([1.79444183, 0.50032649, 0.18773546])
    >>> n = contracted_norm(l, alpha, a)
    >>> print(n)
    0.39969026908800853
    """
    lx, ly, lz = l
    c = anp.pi ** 1.5 / 2 ** sum(l) * fac2(2 * lx - 1) * fac2(2 * ly - 1) * fac2(2 * lz - 1)
    s = (
        (a.reshape(len(a), 1) * a) / ((alpha.reshape(len(alpha), 1) + alpha) ** (sum(l) + 1.5))
    ).sum()
    n = 1 / anp.sqrt(c * s)
    return n
Пример #3
0
def primitive_norm(l, alpha):
    r"""Compute the normalization constant for a primitive Gaussian function.

    A Gaussian function centred at the position :math:`r = (x, y, z)` is defined as

    .. math::

        G = x^{l_x} y^{l_y} z^{l_z} e^{-\alpha r^2},

    where :math:`l = (l_x, l_y, l_z)` defines the angular momentum quantum number and :math:`\alpha`
    is the Gaussian function exponent. The normalization constant for this function is computed as

    .. math::

        N(l, \alpha) = (\frac{2\alpha}{\pi})^{3/4} \frac{(4 \alpha)^{(l_x + l_y + l_z)/2}}
        {(2l_x-1)!! (2l_y-1)!! (2l_z-1)!!)^{1/2}}.

    Args:
        l (tuple[int]): angular momentum quantum number of the basis function
        alpha (array[float]): exponent of the primitive Gaussian function

    Returns:
        array[float]: normalization coefficient

    **Example**

    >>> l = (0, 0, 0)
    >>> alpha = np.array([3.425250914])
    >>> n = primitive_norm(l, alpha)
    >>> print(n)
    array([1.79444183])
    """
    lx, ly, lz = l
    n = (
        (2 * alpha / anp.pi) ** 0.75
        * (4 * alpha) ** (sum(l) / 2)
        / anp.sqrt(fac2(2 * lx - 1) * fac2(2 * ly - 1) * fac2(2 * lz - 1))
    )
    return n
Пример #4
0
    def normalize(self):
        """Set norms of the primitives and N of the contracted Gaussian"""

        order=np.sum(self.shell)
        facts=np.prod(fac2([2*s-1 for s in self.shell]))
        self.norms=(((2/np.pi)**(3/4))*(2**order)*(facts**(-1/2))*
                     self.exps**((2*order+3)/4))

        pre=(np.pi**1.5)*facts*(2.0**-order)
        divisor=np.add.outer(self.exps,self.exps)**-(order+1.5)
        normalized=self.norms*self.coeffs
        summand=(pre*np.einsum('i,j,ij->',normalized,normalized,divisor))**-.5
        self.N=summand
Пример #5
0
def M_integral(n1, m1, n2, m2, l, Q):
    
    from scipy.special import hyp1f1 as hyp
    from scipy.special import genlaguerre
    from numpy import exp, pi, sqrt
    from scipy.special import factorial as fac
    from scipy.special import factorial2 as fac2
    
    # first term
    M_1 = sqrt( pi * fac(m1) * fac(m2) / ( 2 * fac(n1) * fac(n2) ) )

    # second term 
    M_2 = Q**l * exp( - Q**2 / 2 )

    # third term
    M_3 = (sqrt(2))**(m1 + m2 - n1 - n2 - 2*l)

    # fourth term requires summation
    M_4 = 0
    # if m_i = 0, then range(m_i) doesn't return anything, while range(m_i+1) returns zero as we need
    for k1 in range(m1+1):
        for k2 in range(m2+1):

            t = n1 + n2 - m1 - m2 + 2 * (k1 + k2)
            x = 1
            x *= 2**(- k1 - k2)
            x *= genlaguerre(m1, (n1 - m1)).c[::-1][k1]
            # [::-1] because coefficients returned for x^n, x^(n-1), while we need for 1, x, x^2, ...
            x *= genlaguerre(m2, (n2 - m2)).c[::-1][k2]
            x *= fac2(t + l - 1) / fac(l)
            x *= hyp((1 + l - t)/2, l + 1, Q**2 / 2)

            M_4 += x 

    # now we need to multiply all the terms
    M = M_1 * M_2 * M_3 * M_4


    return M