<commit_before>import unittest
from pyquante2 import molecule,rhf,h2,h2o,lih,basisset
from pyquante2.scf.iterators import simple,averaging

class test_scf(unittest.TestCase):
    def test_h2(self):
        bfs = basisset(h2,'sto3g')
        h2_rhf = rhf(h2,bfs)
        ens = h2_rhf.converge(simple)
        self.assertAlmostEqual(h2_rhf.energy(),-1.117099582955609)

    def test_lih(self):
        bfs = basisset(lih,'sto3g')
        lih_rhf = rhf(lih,bfs)
        #E,c = lih_rhf.iterate()
        ens = lih_rhf.converge(simple)
        self.assertAlmostEqual(lih_rhf.energy(),-7.8607437) # Jaguar energy for 6-31G**

    def test_lih_averaging(self):
        bfs = basisset(lih,'sto3g')
        lih_rhf = rhf(lih,bfs)
        #E,c = lih_rhf.iterate()
        ens = lih_rhf.converge(averaging)
        self.assertAlmostEqual(lih_rhf.energy(),-7.8607437244557961)

    def test_h4(self):
        h4 = molecule([
            (1,  0.00000000,     0.00000000,     0.36628549),
            (1,  0.00000000,     0.00000000,    -0.36628549),
            (1,  0.00000000,     4.00000000,     0.36628549),
            (1,  0.00000000,     4.00000000,    -0.36628549),
            ],
                      units='Angstrom')
        bfs = basisset(h4,'sto3g')
        h4_rhf = rhf(h4,bfs)
        ens = h4_rhf.converge(simple)
        self.assertAlmostEqual(h4_rhf.energy(),-2.234185653441159)
        # This is not quite equal to 2x the h2 energy, but very close

    def test_h2o(self):
        bfs = basisset(h2o,'sto3g')
        h2o_rhf = rhf(h2o,bfs)
        ens = h2o_rhf.converge(simple)
        self.assertAlmostEqual(h2o_rhf.energy(),-74.959856073494194)

    def test_h2o_averaging(self):
        bfs = basisset(h2o,'sto3g')
        h2o_rhf = rhf(h2o,bfs)
        ens = h2o_rhf.converge(averaging)
        self.assertAlmostEqual(h2o_rhf.energy(),-74.959856073494194)<commit_msg>Simplified tests and added uhf tests<commit_after>import unittest
from pyquante2 import molecule,rhf,uhf,h2,h2o,lih,basisset

class test_scf(unittest.TestCase):
    def test_h2(self):
        bfs = basisset(h2,'sto3g')
        solver = rhf(h2,bfs)
        ens = solver.converge()
        self.assertAlmostEqual(solver.energy,-1.117099582955609)

    def test_lih(self):
        bfs = basisset(lih,'sto3g')
        solver = rhf(lih,bfs)
        ens = solver.converge()
        self.assertAlmostEqual(solver.energy,-7.8607437)

    def test_lih_averaging(self):
        from pyquante2.scf.iterators import averaging
        bfs = basisset(lih,'sto3g')
        solver = rhf(lih,bfs)
        ens = solver.converge(averaging)
        self.assertAlmostEqual(solver.energy,-7.8607375733271088)

    def test_h4(self):
        h4 = molecule([
            (1,  0.00000000,     0.00000000,     0.36628549),
            (1,  0.00000000,     0.00000000,    -0.36628549),
            (1,  0.00000000,     4.00000000,     0.36628549),
            (1,  0.00000000,     4.00000000,    -0.36628549),
            ],
                      units='Angstrom')
        bfs = basisset(h4,'sto3g')
        solver = rhf(h4,bfs)
        ens = solver.converge()
        self.assertAlmostEqual(solver.energy,-2.234185653441159)
        # This is not quite equal to 2x the h2 energy, but very close

    def test_h2o(self):
        bfs = basisset(h2o,'sto3g')
        solver = rhf(h2o,bfs)
        ens = solver.converge()
        self.assertAlmostEqual(solver.energy,-74.959856073494194)

    def test_h2o_averaging(self):
        from pyquante2.scf.iterators import averaging
        bfs = basisset(h2o,'sto3g')
        solver = rhf(h2o,bfs)
        ens = solver.converge(averaging)
        self.assertAlmostEqual(solver.energy,-74.959846854926553)

    def test_oh(self):
        from pyquante2 import oh
        bfs = basisset(oh,'sto3g')
        solver = uhf(oh,bfs)
        Es = solver.converge()
        self.assertAlmostEqual(solver.energy,-130.48582965653802)

    def test_li(self):
        from pyquante2 import li
        bfs = basisset(li,'sto3g')
        solver = uhf(li,bfs)
        Es = solver.converge()
        self.assertAlmostEqual(solver.energy,-12.06529283901496)
{'fraction_non_alphanumeric': 0.11952576820711348, 'fraction_numerical': 0.1231550931526736, 'mean_word_length': 2.3664495114006514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 16, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1730444', 'n_tokens_mistral': 1888, 'n_tokens_neox': 1566, 'n_words': 238}