Example #1
0
 def test_localization(self):
     # Check a few selected values of the orbital coefficient matrix.
     mo_loc = cholesky_mos(self.mo_coeff[:, :self.nocc])
     delta = 1.0e-6
     self.assertAlmostEqual(abs(mo_loc[22, 0]), 1.02618438, delta=delta)
     self.assertAlmostEqual(abs(mo_loc[6, 3]), 0.10412481, delta=delta)
     self.assertAlmostEqual(abs(mo_loc[27, 5]), 0.17253633, delta=delta)
     self.assertAlmostEqual(abs(mo_loc[6, 8]), 0.63599723, delta=delta)
     self.assertAlmostEqual(abs(mo_loc[14, 11]), 0.5673705, delta=delta)
     self.assertAlmostEqual(abs(mo_loc[4, 15]), 0.51124407, delta=delta)
Example #2
0
 def test_orth(self):
     # Test whether the localized orbitals are orthonormal.
     mo_loc = cholesky_mos(self.mo_coeff[:, :self.nocc])
     smo = numpy.linalg.multi_dot([mo_loc.T, self.sao, mo_loc])
     matching = numpy.allclose(smo, numpy.eye(self.nocc), 1.0e-12)
     self.assertTrue(matching)
Example #3
0
 def test_density(self):
     # Test whether the localized orbitals preserve the density.
     mo_loc = cholesky_mos(self.mo_coeff[:, :self.nocc])
     rdm_loc = 2 * mo_loc.dot(mo_loc.T)
     matching = numpy.allclose(rdm_loc, self.rdm1_rhf, atol=1.0e-12)
     self.assertTrue(matching)