def test_project_init_guess_gramschmidt(self):
    gram_schmidt_idx = numpy.arange(27, dtype=numpy.integer)[:, None].tolist()
    mo1 = mcscf.addons.project_init_guess(mcr_prg, mfr.mo_coeff, priority=gram_schmidt_idx)
    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)
    mf2moi = reduce(numpy.dot, (mfr_prg.mo_coeff.conj().T, mfr_prg.get_ovlp(), mfr.mo_coeff))
    (Q, R) = scipy.linalg.qr(mf2moi)
    mo2 = numpy.dot(mfr_prg.mo_coeff, Q)
    s2 = numpy.abs(reduce(numpy.dot, (mo1.conj().T, mfr_prg.get_ovlp(), mo2)))
    self.assertAlmostEqual(numpy.linalg.norm(s2), 5.291502622129184, 9)
def test_project_init_guess_gramschmidt(self):
    gram_schmidt_idx = numpy.arange(27, dtype=numpy.integer)[:, None].tolist()
    mo1 = mcscf.addons.project_init_guess(mcr_prg, mfr.mo_coeff, priority=gram_schmidt_idx)
    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)
    mf2moi = reduce(numpy.dot, (mfr_prg.mo_coeff.conj().T, mfr_prg.get_ovlp(), mfr.mo_coeff))
    (Q, R) = scipy.linalg.qr(mf2moi)
    mo2 = numpy.dot(mfr_prg.mo_coeff, Q)
    s2 = numpy.abs(reduce(numpy.dot, (mo1.conj().T, mfr_prg.get_ovlp(), mo2)))
    self.assertAlmostEqual(numpy.linalg.norm(s2), 5.291502622129184, 9)