Пример #1
0
 def test_eri(self):
     """Tests all ERI implementations: with and without symmetries."""
     e = kproxy_supercell.PhysERI(self.model_krks, "dft", [1, 1, 1], KRKS)
     m = e.tdhf_full_form()
     testing.assert_allclose(self.ref_m_krhf, m, atol=1e-14)
     vals, vecs = eig(m, nroots=self.td_model_krks.nroots)
     testing.assert_allclose(vals, self.td_model_krks.e, atol=1e-5)
Пример #2
0
 def test_eri(self):
     """Tests all ERI implementations: with and without symmetries."""
     e = kproxy.PhysERI(self.model_krhf, "hf", [1, 1, 1], density_fitting_hf)
     m = e.tdhf_full_form(0)
     testing.assert_allclose(self.ref_m_krhf, m, atol=1e-14)
     vals, vecs = eig(m, nroots=self.td_model_krhf.nroots)
     testing.assert_allclose(vals, self.td_model_krhf.e, atol=1e-5)
Пример #3
0
    def test_eri(self):
        """Tests all ERI implementations: with and without symmetries."""
        for eri in (PhysERI, PhysERI4, PhysERI8):

            # Test plain
            try:
                e = eri(self.model_rhf)
                m = e.tdhf_full_form()

                # Test matrix vs ref
                testing.assert_allclose(m, retrieve_m_hf(e), atol=1e-14)

                # Test matrix vs pyscf
                testing.assert_allclose(self.ref_m, m, atol=1e-14)
                vals, vecs = eig(m, nroots=self.td_model_rhf.nroots)
                testing.assert_allclose(vals, self.td_model_rhf.e, atol=1e-5)

            except Exception:
                print("When testing {} the following exception occurred:".format(eri))
                raise

            # Test frozen
            for frozen in (1, [0, -1]):
                try:
                    e = eri(self.model_rhf, frozen=frozen)
                    m = e.tdhf_full_form()
                    ov_mask = tdhf_frozen_mask(e)
                    ref_m = self.ref_m[numpy.ix_(ov_mask, ov_mask)]
                    testing.assert_allclose(ref_m, m, atol=1e-14)

                except Exception:
                    print("When testing {} with frozen={} the following exception occurred:".format(eri, repr(frozen)))
                    raise
Пример #4
0
 def test_eri(self):
     """Tests all ERI implementations: with and without symmetries."""
     for eri in (ktd.PhysERI, ktd.PhysERI4, ktd.PhysERI8):
         e = eri(self.model_krhf)
         m = e.tdhf_full_form()
         try:
             testing.assert_allclose(self.ref_m_krhf, m, atol=1e-14)
             vals, vecs = eig(m, nroots=self.td_model_krhf.nroots)
             testing.assert_allclose(vals, self.td_model_krhf.e, atol=1e-5)
         except Exception:
             print(
                 "When testing {} the following exception occurred:".format(
                     eri))
             raise