QuantumCollocation.jl icon indicating copy to clipboard operation
QuantumCollocation.jl copied to clipboard

[Feature]: rydberg gate problem templates

Open aarontrowbridge opened this issue 1 year ago • 24 comments

Feature Description

We would love to compare Piccolo with the results in Time-Optimal Two- and Three-Qubit Gates for Rydberg Atoms.

This should be a straightforward task where one

  • implements an n-rydberg atom hamiltonian of the form in the paper above,
  • solves a time-optimal control problem, by first solving a free-time problem and then using the solution of that for a minimum time problem, exactly as in the docs script docs/literate/quickstart.jl

Implementation Guidelines

  • A file, for creating the rydberg hamiltonians should be added to the directory src/quantum_system_templates, matching the style of the files therein.
  • Add a doc script to the folder docs/literate/examples
    • see the Literate.jl docs and the other scripts in the docs/literate folder for reference
  • Add a file to test with some simple tests for the functions exported

Importance

3

What does this feature affect?

  • [ ] quantum system construction
  • [X] problem setup
  • [X] problem solution
  • [ ] problem performance
  • [ ] solution analysis
  • [X] plotting
  • [X] documentation
  • [ ] tests
  • [ ] other (please specify below)

Other information

No response

aarontrowbridge avatar May 06 '24 21:05 aarontrowbridge

Hi, @aarontrowbridge! This issue is interesting to me. I have basic experience with Julia, but I would like to try it. Do you have any examples you recommend? Thanks!

victor-onofre avatar May 31 '24 14:05 victor-onofre

Hey @victor-onofre, my collaborator @andgoldschmidt is going to send some details but what we would hopefully be able to do is set up a problem analogously to the quickstart example in the docs. So what needs to be worked out -- and I think we have an idea of how to do this -- is setting up the Hamiltonian eq. (1) in the paper for some specific parameters.

The UnitarySmoothPulseProblem template has a way to enforce complex modulus bounds on the drives so it's probably possible to set up the problem directly. It might be possible even to just solve a state transfer problem that has the same interface.

I would be happy to hop on discord with you to get into the details as we really want to make a push on this problem.

aarontrowbridge avatar May 31 '24 17:05 aarontrowbridge

Hi @victor-onofre! Like @aarontrowbridge said, we’ll start from the Hamiltonian (1) in Jandura and Pupillo. As a first pass, we can try to get a similar result in Piccolo without needing to be as clever :smile:

First, let’s look at the Hamiltonian. It is defined as two 3 level systems, each system having $|0\rangle, |1\rangle, |r\rangle$. There is a coupling in the $|1\rangle, |r \rangle$ subspace. The control in Equation (1) is global. Units in the paper are defined using $\Omega_\text{max}$. Blockade strength is $B \approx 10 \Omega_\text{max}$ (see Section 6.1.1), and the duration is $T * \Delta t \approx 10 / \Omega_\text{max}$.

Setting $\Omega_\text{max} = 1/10$ might be good enough for problem scaling. Let’s start with $T = 100$ timesteps with size $\Delta t = 1$ .

1. Create a quantum system. Let’s start by trying out a two qubit system.

RYDBERG = Dict(
    "X" => [0 0 0; 0 0 1; 0 1 0], 
    "Y" => [0 0 0; 0 0 -1im; 0 1im 0],
    "N" => [0 0 0; 0 0 0; 0 0 1]
)

H_drift = kron_from_dict("NN", RYDBERG)
H_drives = [
    kron_from_dict("XI", RYDBERG) + kron_from_dict("IX", RYDBERG),
    kron_from_dict("YI", RYDBERG) + kron_from_dict("IY", RYDBERG)
]

B = 1.0
system = QuantumSystem(B * H_drift, H_drives)

2. Create a target gate. Let’s say we want to achieve a CZ gate. Notice that we only care about the qubit space, not the Rydberg states. We can encode this using the EmbeddedOperators. We made that interface a little too reliant on composite transmons :nerd_face:, so this definitely needs better constructors (I'll write an issue soon--or feel free to beat me to the punch):

CZ = [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 -1]
levels = [3, 3]
embedding = [1:2, 1:2]
subspace_indices = get_subspace_indices(embedding, levels)
U_goal = EmbeddedOperator(
    embed(CZ, system, subspace=subspace_indices),
    subspace_indices,
    levels
)

3. Define a unitary smooth pulse problem Take a look at the problem templates. We should have all the pieces to set up our problem.

prob = UnitarySmoothPulseProblem(system, U_goal, T, Δt)
solve!(prob, max_iter=100)
println("Fidelity: ", unitary_fidelity(prob, subspace=subspace_indices))

4. Optimize for noise and uncertainty. Let’s try to make the problem robust to the blockade value $B$; we are uncertain about it because atom positions are imprecise. We can also minimize the gate duration---faster is usually better because we don’t want T1 to hurt our gates. For reference, look again at the grab bag of problem templates---now, we want to combine a minimum time problem and unitary robustness problem.

andgoldschmidt avatar May 31 '24 22:05 andgoldschmidt

Some caveats and notes:

  • We might need to switch to exponential integrators because I did not look at the operator norms, but switch with integrator=:exponential in the problem template. Alternatively, I got what looked like a reasonable result setting T=1000 and Δt = 0.1.
  • The Jandura and Pupillo paper showed you could solve the control problem for the gate with state preparation problems, like Equation (16) or (28).
  • The authors of that paper also shared their solutions from the paper . You can download, test and compare to your own.

andgoldschmidt avatar May 31 '24 22:05 andgoldschmidt

Hi @andgoldschmidt and @aarontrowbridge,

Thank you so much for the clear steps and explanations. I will start working on this tomorrow night (European time). Before starting with the actual problem, I will read your paper on Piccolo to better understand the tool. Then, I will go through the Jandura and Pupilo paper.

victor-onofre avatar Jun 01 '24 18:06 victor-onofre

Hi @andgoldschmidt and @aarontrowbridge,

I have read your paper and the Rydberg atoms paper. Right now I understand the general steps. I wanted to run the example you have in Quickstart Guide but I have an error. Do you know what is the issue?

image

As I mentioned before, my experience with Julia is basic. Sorry if it is a simple Julia error.

Thanks!

victor-onofre avatar Jun 02 '24 22:06 victor-onofre

I changed from Ubuntu to Windows, and the get_gate error still shows up. The good news is that the JuliaCon23 example works, I was able to run everything.

victor-onofre avatar Jun 03 '24 09:06 victor-onofre

It is possible that our published code is behind the source. Did you add the package with add or install locally from source with dev?

andgoldschmidt avatar Jun 03 '24 14:06 andgoldschmidt

if you run add QuantumCollocation#main to load the main branch that should also work

aarontrowbridge avatar Jun 03 '24 17:06 aarontrowbridge

this is a julia package registration issue we've been having, that honestly needs to be it's own issue.

aarontrowbridge avatar Jun 03 '24 17:06 aarontrowbridge

I fix the issue by installing it locally from the source. The problem was the package registration

victor-onofre avatar Jun 04 '24 12:06 victor-onofre

I have a couple of questions about the plots in the Quickstart Guide. What is the meaning of the different unitary operator U in the plots? For the one qubit example, you have 8? Why not 2?

image

In your paper, you have an example of a Two-Qubit CNOT Gate Problem:

image

And the results show the 4 different u in the hamiltonian:

image

To me, the plots of the two qubits CNOT make sense, it shows the optimization of the different u to get to the correct state

Thanks!

victor-onofre avatar Jun 04 '24 15:06 victor-onofre

Right! The unitary is a raw output here, so that means we have to account for all the free numbers. A single qubit means a 4 element unitary with real and imaginary parts, for a total of 8 real components. That's what the :Ũ⃗ notation says, read as "unitary_isomorphism_vector". The isomorphism is the real-imaginary isomorphism, and the vector refers to the flattening.

This is the state vector that we evolve in the code when we solve for a gate.

andgoldschmidt avatar Jun 04 '24 16:06 andgoldschmidt

Okay, now is clear to me. Thanks! In the one qubit example, we plot each unitary matrix element. Like in your example in the paper:

image

I think the notation in Quickstart Guide confused me, sorry!

How can I plot the pulse like in the CNOT example with Piccolo?

victor-onofre avatar Jun 04 '24 16:06 victor-onofre

there's actually a function, plot_unitary_populations, for doing exactly this

aarontrowbridge avatar Jun 04 '24 18:06 aarontrowbridge

Hi @andgoldschmidt! Do you think you have time for a Discord call? Maybe tomorrow? It will help me a lot. My timezone is CEST. Thanks!

victor-onofre avatar Jun 05 '24 09:06 victor-onofre

Can I learn the code about Time-Optimal Two- and Three-Qubit Gates for Rydberg Atoms, I cannot reproduce it, however, I really want to learn how it is implemented. I would greatly appreciate it if you could provide me with any assistance. @andgoldschmidt @aarontrowbridge @victor-onofre @zacmanchester @circuitqed

gfq960906 avatar Nov 21 '24 14:11 gfq960906

In fact, the answer CZ = [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 -1] ingores the additional phase theta, I don't know how to design it

gfq960906 avatar Nov 23 '24 07:11 gfq960906

This might be something that can be better addressed in an Office Hour on the Unitary Fund Discord: Piccolo.jl Office Hours (13:00 PDT | 16:00 EDT | 22:00 CEST) Unitary Fund's Calendar

andgoldschmidt avatar Nov 23 '24 15:11 andgoldschmidt

Hi Fuqiang,  I am working on that template and will update at the end of this year. Thanks,Hong-YeHong-Ye Hu, Ph.D.Department of Physics,Harvard University, Cambridge, MAOn Nov 23, 2024, at 10:29 AM, Andy Goldschmidt @.***> wrote: This might be something that can be better addressed in an Office Hour on the Unitary Fund Discord: Piccolo.jl Office Hours (13:00 PDT | 16:00 EDT | 22:00 CEST) Unitary Fund's 🔗 𝗗𝗶𝘀𝗰𝗼𝗿𝗱: buff.ly/3R0YsHf

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

hongyehu avatar Nov 23 '24 16:11 hongyehu

Thank you very much@andgoldschmidt @hongyehu. Could you first briefly explain the approach to this article? Maybe I can try writing it first. I cannot to solve this parameter 'theta', which is target-dependent. So I cannot write the target state. If you can help me. I would be very grateful.@hongyehu

gfq960906 avatar Nov 24 '24 01:11 gfq960906

hey @gfq960906 i think to help you get things running it would be fine to start solving problem with a fixed θ, and then once that's running we can help you make the changes to implement a "free phase objective" which is in the codebase (here) but is very experimental atm

aarontrowbridge avatar Nov 25 '24 21:11 aarontrowbridge

Thank you, I will try to do it. If I have any new progress, I hope you can help me again. @aarontrowbridge

gfq960906 avatar Nov 26 '24 00:11 gfq960906

Hello, Have you made any progress on the template for this article (Time-Optimal Two- and Three-Qubit Gates for Rydberg Atoms)? @hongyehu

gfq960906 avatar Jan 04 '25 03:01 gfq960906