From e59f88437ef5e602883d0666761f547442ae8507 Mon Sep 17 00:00:00 2001 From: Adrian Mak Date: Mon, 18 Dec 2023 08:35:18 +0800 Subject: [PATCH] test for custom basis --- src/qibochem/driver/molecule.py | 2 +- tests/test_molecule.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qibochem/driver/molecule.py b/src/qibochem/driver/molecule.py index f3527b3..adf818c 100644 --- a/src/qibochem/driver/molecule.py +++ b/src/qibochem/driver/molecule.py @@ -374,7 +374,7 @@ def hamiltonian( if ham_type in ("s", "sym"): # Qibo SymbolicHamiltonian return symbolic_hamiltonian(ham) - raise NameError(f"Unknown {ham_type}!") # Shouldn't ever reach here + # raise NameError(f"Unknown {ham_type}!") # Shouldn't ever reach here @staticmethod def eigenvalues(hamiltonian): diff --git a/tests/test_molecule.py b/tests/test_molecule.py index 2d9be44..c374a06 100644 --- a/tests/test_molecule.py +++ b/tests/test_molecule.py @@ -41,6 +41,12 @@ def test_run_pyscf_molecule_xyz(): assert lih.e_hf == pytest.approx(lih_ref_energy) +def test_molecule_custom_basis(): + mol = Molecule([("Li", (0.0, 0.0, 0.0)), ("H", (0.0, 0.0, 1.2))], 0, 1, "6-31g") + mol.run_pyscf() + assert np.isclose(mol.e_hf, -7.94129296352493) + + def test_hf_embedding_1(): mol = Molecule([("Li", (0.0, 0.0, 0.0)), ("H", (0.0, 0.0, 1.2))]) mol.run_pyscf()