qiskit-community / qiskit-nature

Qiskit Nature is an open-source, quantum computing, framework for solving quantum mechanical natural science problems.
https://qiskit-community.github.io/qiskit-nature/
Apache License 2.0
291 stars 197 forks source link

UCC and fully occupied MOs (Fix for issue #1277) #1286

Closed julenl closed 7 months ago

julenl commented 7 months ago

Summary

Improved the functionality of UCC a little bit, to work if only one of the spin registers is fully occupied.

Details and comments

The configuration check looked for whether any number of alpha or beta orbitals (length of the spin register) was greater or equals than the number of particles. Obviously, there cannot be more particles than spin orbitals, and in order to handle this case, I updated the previous any(n >= ... to any(n > .... For handling case where both alpha and beta are the same as the number of particles (i.e. (2, 2) for the He2 molecule), I created a new raise condition, notifying that the function is still not implemented. Implementing this option will probably involve dealing with the empty excitation list at line 339. For the case where either alpha or beta is equals to the number of particles (i.e. H-He molecule), it should just pass through.

coveralls commented 7 months ago

Pull Request Test Coverage Report for Build 7057038901


Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit_nature/second_q/circuit/library/ansatzes/ucc.py 2 5 40.0%
<!-- Total: 2 5 40.0% -->
Totals Coverage Status
Change from base Build 7020358022: -0.02%
Covered Lines: 8769
Relevant Lines: 10108

💛 - Coveralls
julenl commented 7 months ago

So, @mrossinek