def test_sort_mo(self):
    mo1 = numpy.arange(mfr.mo_energy.size).reshape(1, (- 1))
    ref = [[0, 1, 2, 3, 7, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]]
    mo2 = mcscf.addons.sort_mo(mcr, mo1, [5, 6, 7, 9])
    self.assertTrue(numpy.allclose(mo2, ref))
    mo2 = mcscf.addons.sort_mo(mcu, (mo1, mo1), [5, 6, 7, 9])
    self.assertTrue(numpy.allclose(mo2, (ref, ref)))
    mo2 = mcscf.addons.sort_mo(mcu, (mo1, mo1), [[5, 6, 7, 9], [5, 6, 8, 9]])
    ref1 = [[0, 1, 2, 3, 6, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]]
    self.assertTrue(numpy.allclose(mo2, (ref, ref1)))
def test_sort_mo(self):
    mo1 = numpy.arange(mfr.mo_energy.size).reshape(1, (- 1))
    ref = [[0, 1, 2, 3, 7, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]]
    mo2 = mcscf.addons.sort_mo(mcr, mo1, [5, 6, 7, 9])
    self.assertTrue(numpy.allclose(mo2, ref))
    mo2 = mcscf.addons.sort_mo(mcu, (mo1, mo1), [5, 6, 7, 9])
    self.assertTrue(numpy.allclose(mo2, (ref, ref)))
    mo2 = mcscf.addons.sort_mo(mcu, (mo1, mo1), [[5, 6, 7, 9], [5, 6, 8, 9]])
    ref1 = [[0, 1, 2, 3, 6, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]]
    self.assertTrue(numpy.allclose(mo2, (ref, ref1)))