コード例 #1
0
ファイル: test_eom_uccsd.py プロジェクト: zwang123/pyscf
    def test_ucc_eomsf_ccsd_matvec(self):
        numpy.random.seed(10)
        myeom = eom_uccsd.EOMEESpinFlip(ucc1)
        vec = numpy.random.random(myeom.vector_size()) - .9
        vec1 = eom_uccsd.eomsf_ccsd_matvec(myeom, vec)
        self.assertAlmostEqual(lib.finger(vec1), -1655.5564756993756, 8)

        r1, r2 = myeom.vector_to_amplitudes(vec)
        gr1 = eom_uccsd.spatial2spin_eomsf(r1, orbspin)
        gr2 = eom_uccsd.spatial2spin_eomsf(r2, orbspin)
        gvec = eom_gccsd.amplitudes_to_vector_ee(gr1, gr2)

        gcc1 = cc.addons.convert_to_gccsd(ucc1)
        gee1 = eom_gccsd.EOMEE(gcc1)
        vecref = eom_gccsd.eeccsd_matvec(gee1, gvec)
        gr1, gr2 = gee1.vector_to_amplitudes(vecref)
        v1, v2 = myeom.vector_to_amplitudes(vec1)
        self.assertAlmostEqual(float(abs(gr1-eom_uccsd.spatial2spin_eomsf(v1, orbspin)).max()), 0, 9)
        self.assertAlmostEqual(float(abs(gr2-eom_uccsd.spatial2spin_eomsf(v2, orbspin)).max()), 0, 9)
コード例 #2
0
ファイル: test_eom_uccsd.py プロジェクト: chrinide/pyscf
    def test_ucc_eomsf_ccsd_matvec(self):
        numpy.random.seed(10)
        myeom = eom_uccsd.EOMEESpinFlip(ucc1)
        vec = numpy.random.random(myeom.vector_size()) - .9
        vec1 = eom_uccsd.eomsf_ccsd_matvec(myeom, vec)
        self.assertAlmostEqual(lib.finger(vec1), -1655.5564756993756, 8)

        r1, r2 = myeom.vector_to_amplitudes(vec)
        gr1 = eom_uccsd.spatial2spin_eomsf(r1, orbspin)
        gr2 = eom_uccsd.spatial2spin_eomsf(r2, orbspin)
        gvec = eom_gccsd.amplitudes_to_vector_ee(gr1, gr2)

        gcc1 = cc.addons.convert_to_gccsd(ucc1)
        gee1 = eom_gccsd.EOMEE(gcc1)
        vecref = eom_gccsd.eeccsd_matvec(gee1, gvec)
        gr1, gr2 = gee1.vector_to_amplitudes(vecref)
        v1, v2 = myeom.vector_to_amplitudes(vec1)
        self.assertAlmostEqual(float(abs(gr1-eom_uccsd.spatial2spin_eomsf(v1, orbspin)).max()), 0, 9)
        self.assertAlmostEqual(float(abs(gr2-eom_uccsd.spatial2spin_eomsf(v2, orbspin)).max()), 0, 9)
コード例 #3
0
 def test_ucc_eomsf_ccsd_matvec(self):
     numpy.random.seed(10)
     myeom = eom_uccsd.EOMEESpinFlip(ucc1)
     vec = numpy.random.random(myeom.vector_size()) - .9
     vec1 = eom_uccsd.eomsf_ccsd_matvec(myeom, vec)
     self.assertAlmostEqual(lib.finger(vec1), -588.66159772500009, 8)