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
300 stars 203 forks source link

Implement an equivalent to legacy `succ_full` option #91

Closed mrossinek closed 2 years ago

mrossinek commented 3 years ago

What is the expected enhancement?

The legacy UCCSD implementation had a method_doubles="succ_full" option which is not yet implemented in Qiskit Nature. This option is a variant of the (now named) SUCCD option which also includes symmetrically mirrored double excitations, however, using the same parameter as the symmetric counter part (as also noted here).

The original implementation in Qiskit Aqua came from the work of this paper in which sections II.E.2 and appendix E provide more in-depth information. The following Qiskit Nature snippet shows the current state of the SUCCD ansatz for the example discussed the aforementioned paper's appendix:

from qiskit_nature.circuit.library.ansatzes import SUCCD
from qiskit_nature.converters.second_quantization import QubitConverter
from qiskit_nature.mappers.second_quantization import JordanWignerMapper

converter = QubitConverter(JordanWignerMapper())
ansatz = SUCCD(converter, (1, 1), 6)

print(ansatz.decompose().draw())
print(ansatz.excitation_list)

which outputs:

     ┌─────────────────────────────────────────────────────────────────────────────────────────────┐»
q_0: ┤0                                                                                            ├»
     │                                                                                             │»
q_1: ┤1                                                                                            ├»
     │                                                                                             │»
q_2: ┤2                                                                                            ├»
     │  exp(-it (IYYIXY + IXXIXY + IXYIYY + IYXIYY + IXYIXX + IYXIXX + IYYIYX + IXXIYX))(1.0*t[0]) │»
q_3: ┤3                                                                                            ├»
     │                                                                                             │»
q_4: ┤4                                                                                            ├»
     │                                                                                             │»
q_5: ┤5                                                                                            ├»
     └─────────────────────────────────────────────────────────────────────────────────────────────┘»
«     ┌─────────────────────────────────────────────────────────────────────────────────────────────┐»
«q_0: ┤0                                                                                            ├»
«     │                                                                                             │»
«q_1: ┤1                                                                                            ├»
«     │                                                                                             │»
«q_2: ┤2                                                                                            ├»
«     │  exp(-it (YZYIXY + XZXIXY + XZYIYY + YZXIYY + XZYIXX + YZXIXX + YZYIYX + XZXIYX))(1.0*t[1]) │»
«q_3: ┤3                                                                                            ├»
«     │                                                                                             │»
«q_4: ┤4                                                                                            ├»
«     │                                                                                             │»
«q_5: ┤5                                                                                            ├»
«     └─────────────────────────────────────────────────────────────────────────────────────────────┘»
«     ┌─────────────────────────────────────────────────────────────────────────────────────────────┐
«q_0: ┤0                                                                                            ├
«     │                                                                                             │
«q_1: ┤1                                                                                            ├
«     │                                                                                             │
«q_2: ┤2                                                                                            ├
«     │  exp(-it (YZYXZY + XZXXZY + XZYYZY + YZXYZY + XZYXZX + YZXXZX + YZYYZX + XZXYZX))(1.0*t[2]) │
«q_3: ┤3                                                                                            ├
«     │                                                                                             │
«q_4: ┤4                                                                                            ├
«     │                                                                                             │
«q_5: ┤5                                                                                            ├
«     └─────────────────────────────────────────────────────────────────────────────────────────────┘
[((0, 3), (1, 4)), ((0, 3), (1, 5)), ((0, 3), (2, 5))]

In this context, the goal of this issue is to implement a variant of SUCCD (or an additional keyword argument to its constructor) which results in the inclusion of the ((0, 3), (2, 4)) excitation, while at the same time still using only three parameters (namely t[0]-t[2] in the example above). This should be achieved by ensuring that ((0, 3), (1, 5)) and ((0, 3), (2, 4)) are assigned the same parameter (namely t[1] in the example above).

Dran-Z commented 2 years ago

If no one has tried by far, I would like to shoot an attempt at it.

mrossinek commented 2 years ago

If no one has tried by far, I would like to shoot an attempt at it.

Sure go ahead :+1:

mrossinek commented 2 years ago

@Dran-Z if you want to work on this as part of unitary hack, please remember to register for the event (making you eligible for the bounty) and open a draft PR as soon as possible :+1: For more information, please refer to: https://unitaryhack.dev/

Dran-Z commented 2 years ago

@Dran-Z if you want to work on this as part of unitary hack, please remember to register for the event (making you eligible for the bounty) and open a draft PR as soon as possible 👍 For more information, please refer to: https://unitaryhack.dev/

@mrossinek Thanks for the reminder. I checked the code and believe I have a workflow pipeline in my mind. The modification involves how to pass the parameters up to its parent class UCC. The work can be divided in two steps: 1. Get the excitation list and pair the symmetric excitations together. 2. Pass each two symmetric excitations as one operator(maybe this is the easiest way) up.

I think I still need some time to figure out the relation between EvolvedOperatorAnsatz, UCC and SUCCD. I don't think I am now aiming at getting the bounty because I have another deadline by this week(But anyone else interested can still aim at this cash bounty). If not, I will still keep working on this problem later.

mrossinek commented 2 years ago

I think I still need some time to figure out the relation between EvolvedOperatorAnsatz, UCC and SUCCD.

Let me know if you need help and want to have a chat on Slack, Discord, or whatever :+1:

YuNariai commented 2 years ago

I think I figured this out, may I make a pull request?

mrossinek commented 2 years ago

@YuNariai @Dran-Z I am not sure if you are collaborating on this.

@YuNariai you do not need to get permission to open a PR, so please feel free to do so.

@Dran-Z I would still like to give you the chance to also contribute so please check back in with me if you're still interested and also take a look at the upcoming PR once it's there :+1:

Dran-Z commented 2 years ago

I think I figured this out, may I make a pull request? Sure just do it if you figured it out.

Dran-Z commented 2 years ago

@YuNariai @Dran-Z I am not sure if you are collaborating on this.

@YuNariai you do not need to get permission to open a PR, so please feel free to do so.

@Dran-Z I would still like to give you the chance to also contribute so please check back in with me if you're still interested and also take a look at the upcoming PR once it's there 👍

I don't mind and actually feel happy that this issue could be solved without me. Feel free to go ahead.