示例#1
0
def test_factorial():
    assert_almost_equal(_test_multifactorial(10, 1),
                        factorialk(10, 1),
                        decimal=0)
    assert_almost_equal(_test_multifactorial(20, 2),
                        factorialk(20, 2),
                        decimal=0)
    assert_almost_equal(_test_multifactorial(20, 3),
                        factorialk(20, 3),
                        decimal=0)
    assert_almost_equal(_test_multifactorial(0, 3),
                        factorialk(0, 3),
                        decimal=0)
示例#2
0
def _get_cp2k_norm_corrections(l: int, alphas: Union[float, np.ndarray]) \
        -> Union[float, np.ndarray]:
    """Compute the corrections for the normalization of the basis functions.

    This correction is needed because the CP2K atom code works with a different
    type of normalization for the primitives. IOData assumes Gaussian primitives
    are always L2-normalized.

    Parameters
    ----------
    l
        The angular momentum of the (pure) basis function. (s=0, p=1, ...)
    alphas
        The exponent or exponents of the Gaussian primitives for which the correction
        is to be computed.

    Returns
    -------
    corrections
        The scale factor for the expansion coefficients of the wavefunction in
        terms of primitive Gaussians. The inverse of this correction can be
        applied to the contraction coefficients.

    """
    expzet = 0.25 * (2 * l + 3)
    prefac = np.sqrt(np.sqrt(np.pi) / 2.0**(l + 2) * factorialk(2 * l + 1, 2))
    zeta = 2.0 * alphas
    return zeta**expzet / prefac
示例#3
0
 def time_factorialk_exact_false_scalar_negative_int(self):
     factorialk(-10000, 3, exact=True)
示例#4
0
 def time_factorialk_exact_true_scalar_positive_int(self, n, k):
     factorialk(n, k, exact=True)
示例#5
0
def test_factorial():
    assert_almost_equal(_test_multifactorial(10, 1), factorialk(10, 1), decimal=0)
    assert_almost_equal(_test_multifactorial(20, 2), factorialk(20, 2), decimal=0)
    assert_almost_equal(_test_multifactorial(20, 3), factorialk(20, 3), decimal=0)
    assert_almost_equal(_test_multifactorial(0, 3), factorialk(0, 3), decimal=0)