Пример #1
0
 def test_gen_g_hop(self):
     mo = mc.mo_coeff
     gall, gop, hop, hdiag = newton_casscf.gen_g_hop(
         mc, mo, ci0, mc.ao2mo(mo))
     self.assertAlmostEqual(lib.finger(gall), 21.288022525148595, 8)
     self.assertAlmostEqual(lib.finger(hdiag), -4.6864640132374618, 8)
     x = numpy.random.random(gall.size)
     u, ci1 = newton_casscf.extract_rotation(mc, x, 1, ci0)
     self.assertAlmostEqual(lib.finger(gop(u, ci1)), -412.9441873541524, 8)
     self.assertAlmostEqual(lib.finger(hop(x)), 73.358310983341198, 8)
Пример #2
0
 def test_gen_g_hop(self):
     mo = mc.mo_coeff
     gall, gop, hop, hdiag = newton_casscf.gen_g_hop(
         mc, mo, ci0, mc.ao2mo(mo))
     self.assertAlmostEqual(lib.finger(gall), 6.3906103343021083, 8)
     self.assertAlmostEqual(lib.finger(hdiag), -7.9071928112940615, 8)
     x = numpy.random.random(gall.size)
     u, ci1 = newton_casscf.extract_rotation(mc, x, 1, ci0)
     self.assertAlmostEqual(lib.finger(gop(u, ci1)), -419.68206754700418, 8)
     self.assertAlmostEqual(lib.finger(hop(x)), 78.31792009930723, 8)
Пример #3
0
 def test_gen_g_hop(self):
     numpy.random.seed(1)
     mo = numpy.random.random(mf.mo_coeff.shape)
     ci0 = numpy.random.random((6,6))
     ci0/= numpy.linalg.norm(ci0)
     gall, gop, hop, hdiag = newton_casscf.gen_g_hop(mc, mo, ci0, mc.ao2mo(mo))
     self.assertAlmostEqual(lib.finger(gall), 21.288022525148595, 8)
     self.assertAlmostEqual(lib.finger(hdiag), -4.6864640132374618, 8)
     x = numpy.random.random(gall.size)
     u, ci1 = newton_casscf.extract_rotation(mc, x, 1, ci0)
     self.assertAlmostEqual(lib.finger(gop(u, ci1)), -412.9441873541524, 8)
     self.assertAlmostEqual(lib.finger(hop(x)), 73.358310983341198, 8)
Пример #4
0
 def test_sa_gen_g_hop(self):
     numpy.random.seed(1)
     mo = numpy.random.random(mf.mo_coeff.shape)
     ci0 = numpy.random.random((2, 36))
     ci0 /= numpy.linalg.norm(ci0, axis=1)[:, None]
     ci0 = list(ci0.reshape((2, 6, 6)))
     gall, gop, hop, hdiag = newton_casscf.gen_g_hop(
         sa, mo, ci0, sa.ao2mo(mo))
     self.assertAlmostEqual(lib.finger(gall), 32.46973284682045, 8)
     self.assertAlmostEqual(lib.finger(hdiag), -63.6527761153809, 8)
     x = numpy.random.random(gall.size)
     u, ci1 = newton_casscf.extract_rotation(sa, x, 1, ci0)
     self.assertAlmostEqual(lib.finger(gop(u, ci1)), -49.017079186126, 8)
     self.assertAlmostEqual(lib.finger(hop(x)), 169.47893548740288, 8)