def test_state_average_fci_dmrg(self):
    fcisolver1 = fci.direct_spin1_symm.FCISolver(mol)

    class FCI_as_DMRG(fci.direct_spin1_symm.FCISolver):

        def __getattribute__(self, attr):
            "Prevent 'private' attribute access"
            if (attr in ('make_rdm1s', 'spin_square', 'contract_2e', 'absorb_h1e')):
                raise AttributeError
            else:
                return object.__getattribute__(self, attr)

        def kernel(self, *args, **kwargs):
            return fcisolver1.kernel(*args, **kwargs)

        def approx_kernel(self, *args, **kwargs):
            return fcisolver1.kernel(*args, **kwargs)

        @property
        def orbsym(self):
            return fcisolver1.orbsym

        @orbsym.setter
        def orbsym(self, x):
            fcisolver1.orbsym = x
        spin_square = None
        large_ci = None
        transform_ci_for_orbital_rotation = None
    mc = mcscf.CASSCF(mfr, 4, 4)
    mc.fcisolver = FCI_as_DMRG(mol)
    mc.fcisolver.nroots = fcisolver1.nroots = 2
    mc.state_average_((0.64, 0.36))
    mc.kernel()
    e = mc.e_states
    self.assertAlmostEqual(((e[0] * 0.64) + (e[1] * 0.36)), (- 108.83342083775061), 7)
    dm1 = mc.analyze()
    self.assertAlmostEqual(lib.fp(dm1[0]), (0.5239692938150043 * 2), 4)
def test_state_average_fci_dmrg(self):
    fcisolver1 = fci.direct_spin1_symm.FCISolver(mol)

    class FCI_as_DMRG(fci.direct_spin1_symm.FCISolver):

        def __getattribute__(self, attr):
            "Prevent 'private' attribute access"
            if (attr in ('make_rdm1s', 'spin_square', 'contract_2e', 'absorb_h1e')):
                raise AttributeError
            else:
                return object.__getattribute__(self, attr)

        def kernel(self, *args, **kwargs):
            return fcisolver1.kernel(*args, **kwargs)

        def approx_kernel(self, *args, **kwargs):
            return fcisolver1.kernel(*args, **kwargs)

        @property
        def orbsym(self):
            return fcisolver1.orbsym

        @orbsym.setter
        def orbsym(self, x):
            fcisolver1.orbsym = x
        spin_square = None
        large_ci = None
        transform_ci_for_orbital_rotation = None
    mc = mcscf.CASSCF(mfr, 4, 4)
    mc.fcisolver = FCI_as_DMRG(mol)
    mc.fcisolver.nroots = fcisolver1.nroots = 2
    mc.state_average_((0.64, 0.36))
    mc.kernel()
    e = mc.e_states
    self.assertAlmostEqual(((e[0] * 0.64) + (e[1] * 0.36)), (- 108.83342083775061), 7)
    dm1 = mc.analyze()
    self.assertAlmostEqual(lib.fp(dm1[0]), (0.5239692938150043 * 2), 4)