def test_project_init_guess_prioritylists(self):
    pr = [[[27], [5, 3], [6, 12]], [[5], [17], [13, 10, 8, 6]]]
    mo1_u = mcscf.addons.project_init_guess(mcu_prg, mfu.mo_coeff, priority=pr)
    s0 = mfu_prg.get_ovlp()
    for (ix, mo1) in enumerate(mo1_u):
        s1 = reduce(numpy.dot, (mo1.T, s0, 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)
        mfu_mo = mfu.mo_coeff[ix]
        mfu_mo_norm = numpy.einsum('ip,ip->p', mfu_mo.conj(), s0.dot(mfu_mo))
        mfu_mo_norm = (mfu.mo_coeff[ix] / numpy.sqrt(mfu_mo_norm)[None, :])
        p = pr[ix][0][0]
        s2 = reduce(numpy.dot, (mfu_prg.get_ovlp(), mo1[:, p], mfu_mo_norm[:, p]))
        self.assertAlmostEqual(s2, 1.0, 9)
def test_project_init_guess_prioritylists(self):
    pr = [[[27], [5, 3], [6, 12]], [[5], [17], [13, 10, 8, 6]]]
    mo1_u = mcscf.addons.project_init_guess(mcu_prg, mfu.mo_coeff, priority=pr)
    s0 = mfu_prg.get_ovlp()
    for (ix, mo1) in enumerate(mo1_u):
        s1 = reduce(numpy.dot, (mo1.T, s0, 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)
        mfu_mo = mfu.mo_coeff[ix]
        mfu_mo_norm = numpy.einsum('ip,ip->p', mfu_mo.conj(), s0.dot(mfu_mo))
        mfu_mo_norm = (mfu.mo_coeff[ix] / numpy.sqrt(mfu_mo_norm)[None, :])
        p = pr[ix][0][0]
        s2 = reduce(numpy.dot, (mfu_prg.get_ovlp(), mo1[:, p], mfu_mo_norm[:, p]))
        self.assertAlmostEqual(s2, 1.0, 9)