Пример #1
0
    def test_finite_diff_rohf_grad(self):
        mf = scf.ROHF(mol)
        mf.conv_tol = 1e-14
        e0 = mf.kernel()
        g = grad.ROHF(mf).kernel()
        mf_scanner = mf.as_scanner()

        e1 = mf_scanner('''O    0.   0.       0.
                        H     0.8  0.3      0.2
                        H    0.   -0.758   0.587
                        H    0.   0.757    0.587''')
        e2 = mf_scanner('''O    0.   0.       0.
                        H     0.8  0.3      0.2
                        H    0.   -0.756   0.587
                        H    0.   0.757    0.587''')
        self.assertAlmostEqual(g[2, 1], (e2 - e1) / 2e-3 * lib.param.BOHR, 5)

        e1 = mf_scanner('''O    0.   0.       0.
                        H     0.8  0.3      0.2
                        H    0.   -0.7571  0.587
                        H    0.   0.757    0.587''')
        e2 = mf_scanner('''O    0.   0.       0.
                        H     0.8  0.3      0.2
                        H    0.   -0.7569 0.587
                        H    0.   0.757    0.587''')
        self.assertAlmostEqual(g[2, 1], (e2 - e1) / 2e-4 * lib.param.BOHR, 7)

        mf = scf.ROHF(mol1)
        mf.conv_tol = 1e-14
        e0 = mf.kernel()
        g = grad.ROHF(mf).kernel()
        mf_scanner = mf.as_scanner()

        e1 = mf_scanner('''
C              0.63540095    0.65803739   -0.00861418
H              0.99205538   -0.35077261   -0.00861418
H              0.99207379    1.16143558   -0.88226569
H             -0.43459905    0.65805058   -0.00861418''')
        e2 = mf_scanner('''
C              0.63540095    0.65803739   -0.00861418
H              0.99205538   -0.35077261   -0.00861418
H              0.99207379    1.16343558   -0.88226569
H             -0.43459905    0.65805058   -0.00861418''')
        self.assertAlmostEqual(g[2, 1], (e2 - e1) / 2e-3 * lib.param.BOHR, 5)

        e1 = mf_scanner('''
C              0.63540095    0.65803739   -0.00861418
H              0.99205538   -0.35077261   -0.00861418
H              0.99207379    1.16233558   -0.88226569
H             -0.43459905    0.65805058   -0.00861418''')
        e2 = mf_scanner('''
C              0.63540095    0.65803739   -0.00861418
H              0.99205538   -0.35077261   -0.00861418
H              0.99207379    1.16253558   -0.88226569
H             -0.43459905    0.65805058   -0.00861418''')
        self.assertAlmostEqual(g[2, 1], (e2 - e1) / 2e-4 * lib.param.BOHR, 7)
Пример #2
0
 def test_nr_rohf(self):
     mf = scf.ROHF(h2o_n)
     mf.conv_tol = 1e-14
     mf.kernel()
     g = grad.ROHF(mf)
     self.assertAlmostEqual(lib.finger(g.grad_elec()), 4.1499791106739679,
                            6)
Пример #3
0
 def test_nr_rohf(self):
     mf = scf.ROHF(h2o_n)
     mf.conv_tol = 1e-14
     mf.kernel()
     g = grad.ROHF(mf)
     self.assertAlmostEqual(lib.finger(g.grad_elec()), 4.230345200147354, 6)