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

Enable fully occupied spin registers in UCC-like ansatze #1355

Open
zpy2001 opened this issue Apr 8, 2024 · 1 comment
Open

Enable fully occupied spin registers in UCC-like ansatze #1355

zpy2001 opened this issue Apr 8, 2024 · 1 comment

Comments

@zpy2001
Copy link

zpy2001 commented Apr 8, 2024

Environment

  • Qiskit Nature version:0.72
  • Python version: 3.9.18
  • Operating system: MacOS Sonoma

What is happening?

When I use QEOM, I set the driver as

driver = PySCFDriver(
    atom="H 0 0 0; H 0 0 0.7",
    basis="sto3g",
    charge=-1,
    spin=1,
    unit=DistanceUnit.ANGSTROM,
)

It is right in pyscf:
2611712584314_ pic

but meets bug in ansatz:
截屏2024-04-08 下午10 20 36

How can we reproduce the issue?

In docs/tutorials/04_excited_states_solvers.ipynb, input the driver as data above.

What should happen?

It throw out an error
ValueError: The number of spatial orbitals 2must be greater than number of particles of any spin kind (2, 1).

Any suggestions?

No response

@zpy2001 zpy2001 added the bug label Apr 8, 2024
@mrossinek
Copy link
Member

UCC (and its variants) is currently hard-coding a check to ensure that no spin register is completely occupied:

if any(n > self.num_spatial_orbitals for n in self.num_particles):

I think that the code itself should be able to handle the case where the number of particles in a spin exactly fills that spin register but there are no unittests to ensure this. Lifting this limitation will enable this use case to run.


You can already use generalized=True which will ignore the actual occupation that you start from to run the code. But your ansatz will be longer.

@mrossinek mrossinek changed the title The Problem about QEOM dealing with H2, charge = -1 Enable fully occupied spin registers in UCC-like ansatze Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants