Beispiel #1
0
    def testDerivBF_pxy(self):
        """
        Test Derivative of the px-type basis functions in y-direction
        """

        # construct integrator object
        integrator = PyQInt()

        # build gtos
        nucleus = [-0.5, 0.0, 0.0]
        gto1 = gto(0.154329, [-0.50, 0.0, 0.0], 3.425251, 1, 0, 0)
        gto2 = gto(0.154329, [0.50, 0.0, 0.0], 3.425251, 1, 0, 0)

        # derivative towards bf coordinates
        t1 = integrator.nuclear_gto_deriv_bf(gto1, gto1, nucleus, 1)

        # test the first derivative of the second hydrogen atom in the
        # Cartesian direction
        t2 = integrator.nuclear_gto_deriv_bf(gto2, gto2, nucleus, 1)

        # also calculate this integral using finite difference
        fx_fd_01 = calculate_fy_bf_finite_difference(gto1, nucleus)
        fx_fd_02 = calculate_fy_bf_finite_difference(gto2, nucleus)

        # testing
        np.testing.assert_almost_equal(-2 * t1, fx_fd_01, 4)
        np.testing.assert_almost_equal(-2 * t2, fx_fd_02, 4)
Beispiel #2
0
    def testDerivOpt_d1(self):
        """
        Test Derivative of the nuclear attraction operator in x-direction
        for d-type orbitals
        """

        # construct integrator object
        integrator = PyQInt()

        # build gtos
        nucleus = np.array([-0.5, 0.0, 0.0])
        gto1 = gto(0.154329, nucleus, 3.425251, 2, 0, 0)
        gto2 = gto(0.154329, -nucleus, 3.425251, 2, 0, 0)

        t1a = integrator.nuclear_gto_deriv_op(gto1, gto1, nucleus, 0)
        t1b = integrator.nuclear_gto_deriv_bf(gto1, gto1, nucleus, 0)

        t2a = integrator.nuclear_gto_deriv_op(gto2, gto2, nucleus, 0)
        t2b = integrator.nuclear_gto_deriv_bf(gto2, gto2, nucleus, 0)

        # also calculate this integral using finite difference
        fd_01 = calculate_fx_op_finite_difference(gto1, nucleus)
        fd_02a = calculate_fx_op_finite_difference(gto2, nucleus)
        fd_02b = calculate_fx_bf_finite_difference(gto2, nucleus)

        # testing
        np.testing.assert_almost_equal(t1a, 0.0, 4)
        np.testing.assert_almost_equal(t1b, 0.0, 4)

        np.testing.assert_almost_equal(-2.0 * t2b, fd_02b, 4)
        np.testing.assert_almost_equal(t2a, fd_02a, 4)