Пример #1
0
    def test_hfw2(self):
        h1_deriv_1 = sfx2c1e_grad.gen_sf_hfw(mol1, approx='1E')
        h1_deriv_2 = sfx2c1e_grad.gen_sf_hfw(mol2, approx='1E')
        h2_deriv = sfx2c1e_hess.gen_sf_hfw(mol, approx='1E')

        h2 = h2_deriv(0, 0)
        h2_ref = (h1_deriv_1(0)[2] -
                  h1_deriv_2(0)[2]) / 0.0002 * lib.param.BOHR
        self.assertAlmostEqual(abs(h2[2, 2] - h2_ref).max(), 0, 7)

        h2 = h2_deriv(1, 0)
        h2_ref = (h1_deriv_1(1)[2] -
                  h1_deriv_2(1)[2]) / 0.0002 * lib.param.BOHR
        self.assertAlmostEqual(abs(h2[2, 2] - h2_ref).max(), 0, 7)

        h1_deriv_1 = sfx2c1e_grad.gen_sf_hfw(mol1, approx='ATOM1E')
        h1_deriv_2 = sfx2c1e_grad.gen_sf_hfw(mol2, approx='ATOM1E')
        h2_deriv = sfx2c1e_hess.gen_sf_hfw(mol, approx='ATOM1E')

        h2 = h2_deriv(0, 0)
        h2_ref = (h1_deriv_1(0)[2] -
                  h1_deriv_2(0)[2]) / 0.0002 * lib.param.BOHR
        self.assertAlmostEqual(abs(h2[2, 2] - h2_ref).max(), 0, 7)

        h2 = h2_deriv(1, 0)
        h2_ref = (h1_deriv_1(1)[2] -
                  h1_deriv_2(1)[2]) / 0.0002 * lib.param.BOHR
        self.assertAlmostEqual(abs(h2[2, 2] - h2_ref).max(), 0, 7)
Пример #2
0
    R2 = reduce(numpy.dot, (v_s, R2, v_s.T))
    return R2


if __name__ == '__main__':
    bak = lib.param.LIGHT_SPEED
    lib.param.LIGHT_SPEED = 10

    mol = gto.M(
        verbose = 0,
        atom = [["O" , (0. , 0.     , 0.0001)],
                [1   , (0. , -0.757 , 0.587)],
                [1   , (0. , 0.757  , 0.587)]],
        basis = '3-21g',
    )
    h1_deriv_1 = sfx2c1e_grad.gen_sf_hfw(mol, approx='1E')

    mol = gto.M(
        verbose = 0,
        atom = [["O" , (0. , 0.     ,-0.0001)],
                [1   , (0. , -0.757 , 0.587)],
                [1   , (0. , 0.757  , 0.587)]],
        basis = '3-21g',
    )
    h1_deriv_2 = sfx2c1e_grad.gen_sf_hfw(mol, approx='1E')

    mol = gto.M(
        verbose = 0,
        atom = [["O" , (0. , 0.     , 0.   )],
                [1   , (0. , -0.757 , 0.587)],
                [1   , (0. , 0.757  , 0.587)]],