Skip to content

Commit

Permalink
black test_recover_pyscf.py
Browse files Browse the repository at this point in the history
  • Loading branch information
willwheelera committed Jan 27, 2021
1 parent 4679cac commit 4bf1bd4
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions tests/unit/test_recover_pyscf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,41 @@
import numpy as np
import os


def test_molecule():
chkname = "test_recover_pyscf.chk"
mol = pyscf.gto.M(atom="He 0. 0. 0.", basis="bfd_vdz", ecp="bfd", unit="bohr")
for scf in [pyscf.scf.rhf.RHF, pyscf.scf.uhf.UHF]:
if os.path.isfile(chkname):
os.remove(chkname)
os.remove(chkname)
mf = scf(mol)
mf.chkfile=chkname
mf.chkfile = chkname
mf.kernel()
mol2, mf2 = pyqmc.recover_pyscf(chkname)
print(type(mf2), scf)
assert isinstance(mf2,scf)
assert isinstance(mf2, scf)


def test_pbc():
chkname = "test_recover_pyscf.chk"
mol = pyscf.pbc.gto.M(
atom="H 0. 0. 0.; H 1. 1. 1.",
basis="gth-szv", pseudo='gth-pade', unit="bohr",
basis="gth-szv",
pseudo="gth-pade",
unit="bohr",
a=(np.ones((3, 3)) - np.eye(3)) * 4,
)
for scf in [pyscf.pbc.scf.khf.KRHF, pyscf.pbc.scf.kuhf.KUHF]:
if os.path.isfile(chkname):
os.remove(chkname)
mf = scf(mol, mol.make_kpts((2,1,1)))
mf.chkfile=chkname
os.remove(chkname)
mf = scf(mol, mol.make_kpts((2, 1, 1)))
mf.chkfile = chkname
mf.kernel()
mol2, mf2 = pyqmc.recover_pyscf(chkname)
print(type(mf2), scf)
assert isinstance(mf2,scf)
assert isinstance(mf2, scf)


if __name__=="__main__":
if __name__ == "__main__":
test_molecule()
test_pbc()
test_pbc()

0 comments on commit 4bf1bd4

Please sign in to comment.