def test_state_average_mix_fci_dmrg(self):
    fcisolver1 = fci.direct_spin0_symm.FCISolver(mol)

    class FCI_as_DMRG(fci.direct_spin0_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
    solver1 = FCI_as_DMRG(mol)
    solver1.spin = fcisolver1.spin = 0
    solver1.nroots = fcisolver1.nroots = 2
    solver2 = fci.FCI(mol, singlet=False)
    solver2.spin = 2
    mc = mcscf.CASSCF(mfr, 4, 4)
    mc = mcscf.addons.state_average_mix_(mc, [solver1, solver2], (0.25, 0.25, 0.5))
    mc.kernel()
    e = mc.e_states
    self.assertAlmostEqual(numpy.dot(e, [0.25, 0.25, 0.5]), (- 108.80340952016508), 7)
    dm1 = mc.analyze()
    self.assertAlmostEqual(lib.fp(dm1[0]), 1.0553944556722636, 4)
    self.assertEqual(dm1[1], None)
    mc.cas_natorb()
def test_state_average_mix_fci_dmrg(self):
    fcisolver1 = fci.direct_spin0_symm.FCISolver(mol)

    class FCI_as_DMRG(fci.direct_spin0_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
    solver1 = FCI_as_DMRG(mol)
    solver1.spin = fcisolver1.spin = 0
    solver1.nroots = fcisolver1.nroots = 2
    solver2 = fci.FCI(mol, singlet=False)
    solver2.spin = 2
    mc = mcscf.CASSCF(mfr, 4, 4)
    mc = mcscf.addons.state_average_mix_(mc, [solver1, solver2], (0.25, 0.25, 0.5))
    mc.kernel()
    e = mc.e_states
    self.assertAlmostEqual(numpy.dot(e, [0.25, 0.25, 0.5]), (- 108.80340952016508), 7)
    dm1 = mc.analyze()
    self.assertAlmostEqual(lib.fp(dm1[0]), 1.0553944556722636, 4)
    self.assertEqual(dm1[1], None)
    mc.cas_natorb()