Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: rydberg gate problem templates #88

Open
4 of 9 tasks
aarontrowbridge opened this issue May 6, 2024 · 16 comments
Open
4 of 9 tasks

[Feature]: rydberg gate problem templates #88

aarontrowbridge opened this issue May 6, 2024 · 16 comments
Labels
enhancement New feature or request

Comments

@aarontrowbridge
Copy link
Collaborator

aarontrowbridge commented May 6, 2024

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
  • problem setup
  • problem solution
  • problem performance
  • solution analysis
  • plotting
  • documentation
  • tests
  • other (please specify below)

Other information

No response

@aarontrowbridge aarontrowbridge added the enhancement New feature or request label May 6, 2024
@aarontrowbridge aarontrowbridge added good first issue Good for newcomers unitaryhack issue Issue is bountied for unitaryhack hackathon labels May 29, 2024
@victor-onofre
Copy link

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!

@aarontrowbridge
Copy link
Collaborator Author

aarontrowbridge commented May 31, 2024

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.

@andgoldschmidt
Copy link
Member

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 😄

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 🤓, 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
Copy link
Member

andgoldschmidt commented May 31, 2024

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.

@victor-onofre
Copy link

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
Copy link

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
Copy link

victor-onofre commented Jun 3, 2024

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.

@andgoldschmidt
Copy link
Member

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?

@aarontrowbridge
Copy link
Collaborator Author

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

@aarontrowbridge
Copy link
Collaborator Author

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

@victor-onofre
Copy link

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

@victor-onofre
Copy link

victor-onofre commented Jun 4, 2024

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!

@andgoldschmidt
Copy link
Member

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.

@victor-onofre
Copy link

victor-onofre commented Jun 4, 2024

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?

@aarontrowbridge
Copy link
Collaborator Author

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

@victor-onofre
Copy link

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!

@andgoldschmidt andgoldschmidt added qnumerics Issue for qnumerics hackathon and removed unitaryhack issue Issue is bountied for unitaryhack hackathon good first issue Good for newcomers qnumerics Issue for qnumerics hackathon labels Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants