<commit_before>import unittest
import numpy as np

from pyscf import gto
from pyscf.scf import hf

from pyscf.pbc import gto as pbcgto
from pyscf.pbc.scf import hf as pbchf


def make_cell1(L, n):
    mol = gto.Mole()
    mol.unit = 'B'
    mol.atom.extend([['He', (L/2.,L/2.,L/2.)], ])
# these are some exponents which are not hard to integrate
    mol.basis = { 'He': [[0, (0.8, 1.0)],
                         [0, (1.0, 1.0)],
                         [0, (1.2, 1.0)]] }
    mol.verbose = 0
    mol.build()

    pseudo = None
    cell = pbcgto.Cell()
    # cell.output = '/dev/null'
    cell.verbose = 5
    cell.unit = mol.unit
    cell.h = ((L,0,0),(0,L,0),(0,0,L))
    cell.gs = [n,n,n]

    cell.atom = mol.atom
    cell.basis = mol.basis
    cell.pseudo = pseudo
    cell.build()
    return mol, cell

def make_cell2(L, n):
    mol = gto.M(atom = [['He', (L/2.-.5,L/2.,L/2.-.5)],
                        ['He', (L/2.   ,L/2.,L/2.+.5)]],
                basis = { 'He': [[0, (0.8, 1.0)],
                                 [0, (1.0, 1.0)],
                                 [0, (1.2, 1.0)]] },
                unit = 'B',
                verbose = 0)

    cell = pbcgto.Cell()
               #output = '/dev/null',
    cell.build(unit = mol.unit,
               h = ((L,0,0),(0,L,0),(0,0,L)),
               gs = [n,n,n],
               atom = mol.atom,
               basis = mol.basis)
    return mol, cell

def finger(mat):
    w = np.cos(np.arange(mat.size))
    return np.dot(mat.ravel(), w)

class KnowValues(unittest.TestCase):
    def test_numint20(self):
        mol, cell = make_cell1(20, 20)
        mf = pbchf.RHF(cell)
        self.assertAlmostEqual(mf.scf(), -2.4607103378280013, 8)

    def test_mole_int20(self):
        mol, cell = make_cell1(20, 20)
        mf = pbchf.RHF(cell)
        mf.mol_ex = True
        self.assertAlmostEqual(mf.scf(), -2.6023559969743499, 8)

#    def test_numint(self):
#        mol, cell = make_cell1(60, 120)
#        mf = pbchf.RHF(cell)
## python 2.6, numpy 1.6.2, mkl 10.3 got -2.5877571064424578
#        self.assertAlmostEqual(mf.scf(), -2.58766850182551, 8)
#
#    def test_mole_int(self):
#        mol, cell = make_cell1(60, 120)
#        mf = pbchf.RHF(cell)
#        mf.mol_ex = True
## python 2.6, numpy 1.6.2, mkl 10.3 got -2.6350239901935644
#        self.assertAlmostEqual(mf.scf(), -2.63493445685, 8)


    def test_kinetic20(self):
        mol, cell = make_cell2(20, 20)
        tao = pbchf.get_t(cell)<commit_msg>Removed molecular exchange from test_hf<commit_after>import unittest
import numpy as np

from pyscf import gto
from pyscf.scf import hf

from pyscf.pbc import gto as pbcgto
from pyscf.pbc.scf import hf as pbchf


def make_cell1(L, n):
    mol = gto.Mole()
    mol.unit = 'B'
    mol.atom.extend([['He', (L/2.,L/2.,L/2.)], ])
# these are some exponents which are not hard to integrate
    mol.basis = { 'He': [[0, (0.8, 1.0)],
                         [0, (1.0, 1.0)],
                         [0, (1.2, 1.0)]] }
    mol.verbose = 0
    mol.build()

    pseudo = None
    cell = pbcgto.Cell()
    # cell.output = '/dev/null'
    cell.verbose = 5
    cell.unit = mol.unit
    cell.h = ((L,0,0),(0,L,0),(0,0,L))
    cell.gs = [n,n,n]

    cell.atom = mol.atom
    cell.basis = mol.basis
    cell.pseudo = pseudo
    cell.build()
    return mol, cell

def make_cell2(L, n):
    mol = gto.M(atom = [['He', (L/2.-.5,L/2.,L/2.-.5)],
                        ['He', (L/2.   ,L/2.,L/2.+.5)]],
                basis = { 'He': [[0, (0.8, 1.0)],
                                 [0, (1.0, 1.0)],
                                 [0, (1.2, 1.0)]] },
                unit = 'B',
                verbose = 0)

    cell = pbcgto.Cell()
               #output = '/dev/null',
    cell.build(unit = mol.unit,
               h = ((L,0,0),(0,L,0),(0,0,L)),
               gs = [n,n,n],
               atom = mol.atom,
               basis = mol.basis)
    return mol, cell

def finger(mat):
    w = np.cos(np.arange(mat.size))
    return np.dot(mat.ravel(), w)

class KnowValues(unittest.TestCase):
    def test_numint20(self):
        mol, cell = make_cell1(20, 20)
        mf = pbchf.RHF(cell)
        self.assertAlmostEqual(mf.scf(), -2.4607103378280013, 8)

#    def test_numint(self):
#        mol, cell = make_cell1(60, 120)
#        mf = pbchf.RHF(cell)
## python 2.6, numpy 1.6.2, mkl 10.3 got -2.5877571064424578
#        self.assertAlmostEqual(mf.scf(), -2.58766850182551, 8)

    def test_kinetic20(self):
        mol, cell = make_cell2(20, 20)
        tao = pbchf.get_t(cell)
{'fraction_non_alphanumeric': 0.1737791465024197, 'fraction_numerical': 0.07589089309282886, 'mean_word_length': 1.7641337386018237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2451355', 'n_tokens_mistral': 2020, 'n_tokens_neox': 1807, 'n_words': 381}