From 7c4f56cd4b1f06cfed70096da2b69b18bf6d1634 Mon Sep 17 00:00:00 2001 From: Jonathon Misiewicz Date: Tue, 5 Oct 2021 10:54:25 -0400 Subject: [PATCH] Closes 151 --- src/qforte/abc/algorithm.py | 4 ---- src/qforte/qpea/qpe.py | 4 +++- tests/test_freeze_orb.py | 25 ++++++++++++++++++++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/qforte/abc/algorithm.py b/src/qforte/abc/algorithm.py index 27917e50..2ed91b0d 100644 --- a/src/qforte/abc/algorithm.py +++ b/src/qforte/abc/algorithm.py @@ -75,10 +75,6 @@ def __init__(self, print_summary_file=False, **kwargs): - if isinstance(self, qf.QPE) and hasattr(system, 'frozen_core'): - if system.frozen_core + system.frozen_virtual > 0: - raise ValueError("QPE with frozen orbitals is not currently supported.") - self._sys = system self._state_prep_type = state_prep_type diff --git a/src/qforte/qpea/qpe.py b/src/qforte/qpea/qpe.py index a14d4abf..48d5a191 100644 --- a/src/qforte/qpea/qpe.py +++ b/src/qforte/qpea/qpe.py @@ -24,7 +24,9 @@ def run(self, guess_energy : A guess for the eigenvalue of the eigenspace with which |0>^(n) has greatest overlap. You should be confident the ground state is within t : A scaling parameter that controls the precision of the computation. You should - confident that the eigenvalue of interest is within +/- t of the guess energy. + confident that the eigenvalue of interest is within +/- 2pi/t of the guess energy. + Larger t's lead to fewer resources for the same amount of precision, but require + more confidence in the guess energy. """ # float: evolution times diff --git a/tests/test_freeze_orb.py b/tests/test_freeze_orb.py index 9fe0760f..f6a63fc0 100644 --- a/tests/test_freeze_orb.py +++ b/tests/test_freeze_orb.py @@ -1,6 +1,6 @@ import pytest from pytest import approx -from qforte import system_factory, UCCNVQE, ADAPTVQE, UCCNPQE, SPQE +from qforte import system_factory, UCCNVQE, ADAPTVQE, UCCNPQE, SPQE, QPE class TestFreezingOrbitals(): @@ -31,3 +31,26 @@ def test_freeze_orb_ucc(self, method, options): Efci = -28.747184707540754 assert Egs == approx(Efci, abs=1.0e-10) + + def test_freeze_orb_qkd(self): + + mol = system_factory(system_type = 'molecule', + build_type = 'psi4', + basis = 'sto-3g', + mol_geometry = [('Be', (0, 0, -1.2)), + ('Be', (0, 0, 1.2))], + symmetry = 'd2h', + num_frozen_docc = 2, + num_frozen_uocc = 3) + + alg = QPE(mol) + + alg.run(-28.75, nruns=100, num_precise_bits=5, t=100) + + Egs = alg.get_gs_energy() + # WARNING: Due to a bug in Psi4, the energies stored in the fci_energy attrbitute of the Molecule class are not + # correct when the number of frozen virtual orbitals is larger than zero. + Efci = -28.747184707540754 + + assert Egs == approx(Efci, abs=1.1e-3) +