Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes 151 #162

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/qforte/abc/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/qforte/qpea/qpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace "confident" by "be confident", or something similar.

Larger t's lead to fewer resources for the same amount of precision, but require
more confidence in the guess energy.
"""

# float: evolution times
Expand Down
25 changes: 24 additions & 1 deletion tests/test_freeze_orb.py
Original file line number Diff line number Diff line change
@@ -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():

Expand Down Expand Up @@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace "qkd" by "qpe".


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)