def test_project_init_guess_activefirst(self):
    with lib.temporary_env(mcr_prg, ncas=6, ncore=3):
        mo1 = mcscf.addons.project_init_guess(mcr_prg, mfr.mo_coeff, priority='active')
    s1 = reduce(numpy.dot, (mo1.T, mfr_prg.get_ovlp(), mo1))
    self.assertEqual(numpy.count_nonzero((numpy.linalg.eigh(s1)[0] > 1e-10)), s1.shape[0])
    self.assertAlmostEqual(numpy.linalg.norm(s1), 5.291502622129184, 9)
    mfr_mo_norm = numpy.einsum('ip,ip->p', mfr.mo_coeff.conj(), mfr_prg.get_ovlp().dot(mfr.mo_coeff))
    mfr_mo_norm = (mfr.mo_coeff / numpy.sqrt(mfr_mo_norm)[None, :])
    s2 = [reduce(numpy.dot, (mfr_prg.get_ovlp(), mo1[:, i], mfr_mo_norm[:, i])) for i in (1, 3)]
    self.assertAlmostEqual(s2[1], 1.0, 9)
    self.assertFalse((s2[0] > s2[1]))
def test_project_init_guess_activefirst(self):
    with lib.temporary_env(mcr_prg, ncas=6, ncore=3):
        mo1 = mcscf.addons.project_init_guess(mcr_prg, mfr.mo_coeff, priority='active')
    s1 = reduce(numpy.dot, (mo1.T, mfr_prg.get_ovlp(), mo1))
    self.assertEqual(numpy.count_nonzero((numpy.linalg.eigh(s1)[0] > 1e-10)), s1.shape[0])
    self.assertAlmostEqual(numpy.linalg.norm(s1), 5.291502622129184, 9)
    mfr_mo_norm = numpy.einsum('ip,ip->p', mfr.mo_coeff.conj(), mfr_prg.get_ovlp().dot(mfr.mo_coeff))
    mfr_mo_norm = (mfr.mo_coeff / numpy.sqrt(mfr_mo_norm)[None, :])
    s2 = [reduce(numpy.dot, (mfr_prg.get_ovlp(), mo1[:, i], mfr_mo_norm[:, i])) for i in (1, 3)]
    self.assertAlmostEqual(s2[1], 1.0, 9)
    self.assertFalse((s2[0] > s2[1]))