Closed julenl closed 7 months ago
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 | |
---|---|
Change from base Build 7020358022: | -0.02% |
Covered Lines: | 8769 |
Relevant Lines: | 10108 |
So, @mrossinek
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 >= ...
toany(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.