question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

same_spin_doubles works incorrectly in UCCSD

See original GitHub issue

Information

  • Qiskit Aqua version: qiskit-master
  • Python version: 3.8
  • Operating system: Ubuntu

What is the current behavior?

same_spin_doubles = True in UCCSD variational form does not work correctly, when only beta same spin double excitations are required.

Steps to reproduce the problem

I faced this problem with triplet O2 molecule. For alpha orbitals there is only one unoccupied spin-orbital, while for beta there are three. I’m expecting to have same spin double excitations only for beta orbitals. However, there are no such excitations when same_spin_doubles = True.

What is the expected behavior?

Suggested solutions

Change condition here. When this condition is False due to alpha orbitals, beta сondition is omitted. My solution is:

        if same_spin_doubles:
            if len(active_occ_list_alpha) > 1 and len(active_unocc_list_alpha) > 1:
                for i, occ_alpha in enumerate(active_occ_list_alpha[:-1]):
                    for j, unocc_alpha in enumerate(active_unocc_list_alpha[:-1]):
                        for occ_alpha_1 in active_occ_list_alpha[i + 1:]:
                            for unocc_alpha_1 in active_unocc_list_alpha[j + 1:]:
                                double_excitations.append([occ_alpha, unocc_alpha,
                                                           occ_alpha_1, unocc_alpha_1])

            up_active_occ_list = active_occ_list_beta
            up_active_unocc_list = active_unocc_list_beta

            if len(active_occ_list_beta) > 1 and len(active_unocc_list_beta) > 1:        
                for i, occ_beta in enumerate(up_active_occ_list[:-1]):
                    for j, unocc_beta in enumerate(up_active_unocc_list[:-1]):
                        for occ_beta_1 in up_active_occ_list[i + 1:]:
                            for unocc_beta_1 in up_active_unocc_list[j + 1:]:
                                double_excitations.append([occ_beta, unocc_beta,
                                                           occ_beta_1, unocc_beta_1])

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
MariaSapovacommented, Mar 17, 2021

@mrossinek Now it looks fine. I think the issue is solved. Thank you!

0reactions
mrossinekcommented, Mar 17, 2021

Alright I just pushed a fix and the only new excitations are now the following:

((5, 7), (6, 8))
((5, 7), (6, 9))
((5, 8), (6, 9))
Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found