Multilevel Transmon

In this example we will look at a multilevel transmon qubit with a Hamiltonian given by

\[\hat{H}(t) = -\frac{\delta}{2} \hat{n}(\hat{n} - 1) + u_1(t) (\hat{a} + \hat{a}^\dagger) + u_2(t) i (\hat{a} - \hat{a}^\dagger)\]

where $\hat{n} = \hat{a}^\dagger \hat{a}$ is the number operator, $\hat{a}$ is the annihilation operator, $\delta$ is the anharmonicity, and $u_1(t)$ and $u_2(t)$ are control fields.

We will use the following parameter values:

\[\begin{aligned} \delta &= 0.2 \text{ GHz}\\ \abs{u_i(t)} &\leq 0.2 \text{ GHz}\\ T_0 &= 10 \text{ ns}\\ \end{aligned}\]

For convenience, we have defined the TransmonSystem function in the QuantumSystemTemplates module, which returns a QuantumSystem object for a transmon qubit. We will use this function to define the system.

Setting up the problem

To begin, let's load the necessary packages, define the system parameters, and create a a QuantumSystem object using the TransmonSystem function.

using QuantumCollocation
using NamedTrajectories
using LinearAlgebra
using SparseArrays
using Random; Random.seed!(123)

# define the time parameters

T₀ = 10     # total time in ns
T = 50      # number of time steps
Δt = T₀ / T # time step

# define the system parameters
levels = 5
δ = 0.2

# add a bound to the controls
a_bound = 0.2

# create the system
sys = TransmonSystem(levels=levels, δ=δ)

# let's look at the parameters of the system
sys.params
Dict{Symbol, Any} with 8 entries:
  :lab_frame_type => :duffing
  :ω              => 4.0
  :lab_frame      => false
  :δ              => 0.2
  :mutiply_by_2π  => true
  :drives         => true
  :levels         => 5
  :frame_ω        => 4.0

Since this is a multilevel transmon and we want to implement an, let's say, $X$ gate on the qubit subspace, i.e., the first two levels we can utilize the EmbeddedOperator type to define the target operator.

# define the target operator
op = EmbeddedOperator(:X, sys)

# show the full operator
op.operator |> sparse
5×5 SparseArrays.SparseMatrixCSC{ComplexF64, Int64} with 2 stored entries:
     ⋅      1.0+0.0im      ⋅          ⋅          ⋅    
 1.0+0.0im      ⋅          ⋅          ⋅          ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅    

In this formulation, we also use a subspace identity as the initial state, which looks like

get_subspace_identity(op) |> sparse
5×5 SparseArrays.SparseMatrixCSC{ComplexF64, Int64} with 2 stored entries:
 1.0+0.0im      ⋅          ⋅          ⋅          ⋅    
     ⋅      1.0+0.0im      ⋅          ⋅          ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅    
     ⋅          ⋅          ⋅          ⋅          ⋅    

We can then pass this embedded operator to the UnitarySmoothPulseProblem template to create

# create the problem
prob = UnitarySmoothPulseProblem(sys, op, T, Δt; a_bound=a_bound)

# solve the problem
solve!(prob; max_iter=50)
    building dynamics from integrators...
        constructing knot point dynamics functions...
        determining dynamics derivative structure...
            computing jacobian sparsity...
            creating full trajectory jacobian structure...
        constructing full dynamics derivative functions...
    building evaluator...
    initializing optimizer...
applying constraint: initial value of Ũ⃗
applying constraint: initial value of a
applying constraint: final value of a
applying constraint: bounds on a
applying constraint: bounds on da
applying constraint: bounds on dda
applying constraint: bounds on Δt
applying constraint: time step all equal constraint

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit https://github.com/coin-or/Ipopt
******************************************************************************

This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.3.

Number of nonzeros in equality constraint Jacobian...:    43048
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:     2796
                     variables with only lower bounds:        0
                variables with lower and upper bounds:      246
                     variables with only upper bounds:        0
Total number of equality constraints.................:     2695
Total number of inequality constraints...............:        0
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  2.5552641e-04 9.95e-01 1.04e-05   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  8.4862050e+00 7.46e-01 4.91e+01  -0.7 9.79e-01    -  8.29e-01 2.50e-01h  3
   2  2.5298780e-01 3.73e-01 4.60e+01  -0.3 8.54e-01    -  6.82e-01 5.00e-01f  2
   3  7.1886697e-01 4.62e-01 9.42e+01  -0.1 1.31e+00    -  1.00e+00 9.91e-01h  1
   4  7.8468493e+00 7.70e-02 5.27e+01  -0.7 7.04e-01    -  1.00e+00 1.00e+00h  1
   5  1.4202292e+00 1.09e-01 8.92e+01  -0.8 7.32e-01    -  9.61e-01 1.00e+00f  1
   6  9.0638246e-01 3.87e-02 9.21e+01  -1.2 4.58e-01    -  1.00e+00 1.00e+00h  1
   7  8.3804125e+00 1.97e-02 6.24e+01  -1.9 2.98e-01    -  1.00e+00 1.00e+00h  1
   8  9.1126453e+00 2.40e-03 1.52e+01  -1.9 1.06e-01    -  1.00e+00 1.00e+00h  1
   9  7.5588618e+00 3.20e-03 1.54e+01  -2.5 1.09e-01    -  1.00e+00 1.00e+00f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  3.3386102e+00 7.08e-02 8.07e+01  -1.7 1.40e+00    -  9.31e-01 2.97e-01F  1
  11  5.0496816e+00 3.56e-02 4.80e+01  -1.8 3.40e-01    -  1.00e+00 1.00e+00h  1
  12  2.4643412e+00 9.59e-03 3.93e+01  -2.1 1.80e-01    -  1.00e+00 1.00e+00f  1
  13  1.9809261e+00 1.74e-02 5.18e+01  -0.7 3.02e+01    -  1.00e+00 7.04e-03f  4
  14  1.2389769e+00 7.60e-03 2.83e+01  -1.4 2.11e-01    -  9.97e-01 1.00e+00f  1
  15  6.9876969e-01 4.78e-03 2.57e+01  -2.3 1.73e-01    -  1.00e+00 1.00e+00h  1
  16  2.7405957e+00 2.07e-03 4.83e+01  -3.0 1.76e-01    -  9.87e-01 1.00e+00H  1
  17  1.6294653e+00 1.69e-03 1.49e+01  -3.5 9.72e-02    -  1.00e+00 1.00e+00f  1
  18  1.3242926e+00 1.61e-03 1.49e+01  -4.0 3.59e-01    -  1.00e+00 9.58e-02f  1
  19  5.8795672e-01 2.69e-03 1.94e+01  -4.0 3.42e-01    -  1.00e+00 3.09e-01f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  20  4.3912757e-01 7.63e-03 8.86e+01  -2.0 5.09e-01    -  7.72e-01 3.25e-01f  1
  21  2.6897930e-01 1.90e-02 4.01e+01  -2.3 5.90e-01    -  1.00e+00 6.00e-01f  1
  22  1.2381157e+00 1.17e-02 7.60e+01  -1.4 3.31e-01    -  1.00e+00 1.00e+00h  1
  23  6.7499161e-01 1.29e-02 5.08e+01  -1.5 2.88e-01    -  7.70e-01 1.00e+00f  1
  24  4.7555166e-02 7.88e-03 4.60e+01  -1.5 2.03e-01    -  1.00e+00 1.00e+00h  1
  25  4.1289384e-01 8.65e-03 5.33e+01  -0.8 3.39e+00    -  1.00e+00 2.41e-02f  5
  26  1.1430465e-01 1.39e-02 9.45e+01  -0.9 2.96e-01    -  1.00e+00 1.00e+00f  1
  27  5.4789872e-01 3.90e-03 2.34e+01  -0.9 3.36e-01    -  1.00e+00 1.00e+00h  1
  28  5.4027269e-01 3.75e-03 1.56e+01  -0.9 1.08e-01    -  1.00e+00 1.00e+00h  1
  29  4.9313289e-01 1.99e-03 1.23e+01  -1.9 1.14e-01    -  1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  30  1.6800155e-01 7.20e-03 3.31e+01  -2.6 1.73e-01    -  1.00e+00 1.00e+00h  1
  31  3.5116156e-02 6.96e-03 6.62e+01  -2.6 8.00e-01    -  6.65e-01 5.02e-02h  4
  32  9.4662422e-02 8.41e-04 4.34e+01  -2.3 1.46e-01    -  1.00e+00 1.00e+00h  1
  33  6.0264568e-02 5.84e-03 2.55e+01  -2.5 2.27e-01    -  1.00e+00 1.00e+00h  1
  34  4.2451820e-01 2.58e-03 6.58e+01  -2.6 1.30e-01    -  1.00e+00 1.00e+00h  1
  35  3.8747299e-02 1.19e-03 4.88e+01  -2.6 7.02e-02    -  1.00e+00 1.00e+00h  1
  36  9.4312727e-02 1.27e-03 4.56e+01  -2.8 1.23e-01    -  1.00e+00 1.00e+00h  1
  37  5.4667861e-02 1.06e-03 4.34e+01  -4.0 6.58e-02    -  1.00e+00 1.00e+00h  1
  38  7.4865168e-03 1.28e-03 5.59e+01  -4.1 1.45e+00    -  4.94e-01 2.31e-02h  4
  39  7.2103132e-03 8.70e-04 4.91e+01  -4.0 9.34e-02    -  1.00e+00 5.00e-01h  2
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  40  7.5069156e-03 8.61e-04 4.97e+01  -3.5 3.95e-01    -  1.00e+00 2.02e-02h  6
  41  5.6467196e-03 3.86e-04 4.93e+01  -4.0 3.37e-02    -  1.00e+00 1.00e+00h  1
  42  5.3160931e-03 4.30e-04 4.78e+01  -4.0 7.31e-02    -  1.00e+00 5.00e-01h  2
  43  5.5656055e-03 3.81e-04 5.09e+01  -4.0 8.20e-02    -  1.00e+00 1.25e-01h  4
  44  4.7480800e-03 2.22e-03 4.92e+01  -4.0 9.70e-02    -  1.00e+00 1.00e+00h  1
  45  3.7725757e-03 3.95e-02 4.95e+01  -4.0 6.73e-01    -  5.25e-01 1.00e+00h  1
  46  2.3302052e-01 1.49e-02 4.88e+01  -4.0 3.81e-01    -  1.00e+00 1.00e+00h  1
  47  3.0778154e-03 5.70e-03 4.93e+01  -4.1 1.48e-01    -  1.00e+00 1.00e+00h  1
  48  3.5132616e-03 1.20e-03 4.98e+01  -4.0 8.05e-02    -  1.00e+00 1.00e+00h  1
  49  3.5314371e-03 9.86e-04 4.98e+01  -4.0 9.06e-02    -  1.00e+00 5.00e-01h  2
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  50  3.5880547e-03 8.36e-04 4.90e+01  -4.0 2.30e-01    -  1.00e+00 2.50e-01h  3

Number of Iterations....: 50

                                   (scaled)                 (unscaled)
Objective...............:   3.5880546533301810e-03    3.5880546533301810e-03
Dual infeasibility......:   4.9015656567781598e+01    4.9015656567781598e+01
Constraint violation....:   8.3550884893413002e-04    8.3550884893413002e-04
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   1.1837657524828006e-04    1.1837657524828006e-04
Overall NLP error.......:   4.9015656567781598e+01    4.9015656567781598e+01


Number of objective function evaluations             = 97
Number of objective gradient evaluations             = 51
Number of equality constraint evaluations            = 97
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 51
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 0
Total seconds in IPOPT                               = 7.648

EXIT: Maximum Number of Iterations Exceeded.

Let's look at the fidelity in the subspace

println("Fidelity: ", unitary_fidelity(prob; subspace=op.subspace_indices))
Fidelity: 0.9969628457842681

and plot the result using the plot_unitary_populations function.

plot_unitary_populations(prob; fig_size=(900, 700))
Example block output

Leakage suppresion

As can be seen from the above plot, there is a substantial amount of leakage into the higher levels during the evolution. To mitigate this, we have implemented the ability to add a cost to populating the leakage levels, in particular this is an $L_1$ norm cost, which is implemented via slack variables and should ideally drive those leakage populations down to zero. To implement this, pass leakage_suppresion=true and R_leakage={value} to the UnitarySmoothPulseProblem template.

# create the a leakage suppression problem, initializing with the previous solution

prob_leakage = UnitarySmoothPulseProblem(sys, op, T, Δt;
    a_bound=a_bound,
    leakage_suppression=true,
    R_leakage=1e-1,
    a_guess=prob.trajectory.a
)

# solve the problem

solve!(prob_leakage; max_iter=50)
    building dynamics from integrators...
        constructing knot point dynamics functions...
        determining dynamics derivative structure...
            computing jacobian sparsity...
            creating full trajectory jacobian structure...
        constructing full dynamics derivative functions...
    building evaluator...
    initializing optimizer...
applying constraint: initial value of Ũ⃗
applying constraint: initial value of a
applying constraint: final value of a
applying constraint: bounds on a
applying constraint: bounds on da
applying constraint: bounds on dda
applying constraint: bounds on Δt
applying constraint: L1 slack constraint on Ũ⃗
applying constraint: time step all equal constraint
This is Ipopt version 3.14.16, running with linear solver MUMPS 5.7.3.

Number of nonzeros in equality constraint Jacobian...:    44812
Number of nonzeros in inequality constraint Jacobian.:        0
Number of nonzeros in Lagrangian Hessian.............:        0

Total number of variables............................:     3996
                     variables with only lower bounds:     1176
                variables with lower and upper bounds:      246
                     variables with only upper bounds:        0
Total number of equality constraints.................:     3283
Total number of inequality constraints...............:        0
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:        0
        inequality constraints with only upper bounds:        0

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  5.8771005e+01 1.26e+00 9.25e-01   0.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  5.4464150e+01 4.22e-01 9.82e+01  -1.1 1.09e+00    -  3.25e-01 6.65e-01f  1
   2  6.0232894e+01 1.64e-02 4.46e+01  -1.3 4.79e-01    -  6.60e-01 1.00e+00f  1
   3  5.5607426e+01 4.33e-03 2.11e+01  -1.7 2.08e-01    -  9.99e-01 1.00e+00f  1
   4  4.5614238e+01 4.06e-03 5.62e+01  -2.1 2.38e-01    -  1.00e+00 7.40e-01f  1
   5  2.7633789e+01 6.35e-03 3.88e+01  -2.6 4.05e-01    -  1.00e+00 6.57e-01f  1
   6  1.7230012e+01 5.79e-03 4.14e+01  -2.0 2.20e+00    -  8.25e-01 2.26e-01f  1
   7  1.2642723e+01 1.09e-02 5.02e+01  -2.1 2.45e-01    -  1.00e+00 9.32e-01f  1
   8  1.1151139e+01 8.29e-03 5.70e+01  -2.2 2.40e-01    -  1.00e+00 1.00e+00f  1
   9  7.8830274e+00 3.88e-03 6.09e+01  -2.8 1.17e-01    -  1.00e+00 7.57e-01f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  8.6096947e+00 2.16e-03 6.59e+01  -2.7 2.02e-01    -  6.12e-01 8.98e-01H  1
  11  6.8330523e+00 1.66e-03 4.96e+01  -3.2 8.34e-02    -  1.00e+00 9.37e-01f  1
  12  6.9642217e+00 1.62e-03 3.93e+01  -2.8 9.81e-02    -  5.41e-01 7.48e-01f  1
  13  6.5975026e+00 2.01e-03 3.42e+01  -3.0 6.34e-01    -  1.69e-01 1.81e-01f  1
  14  7.4390627e+00 1.94e-03 7.02e+01  -2.3 6.43e-01    -  1.19e-01 1.92e-01f  1
  15  6.6099018e+00 1.91e-03 9.50e+01  -2.9 1.10e-01    -  4.48e-01 7.84e-01f  1
  16  7.7908805e+00 6.21e-03 2.43e+01  -2.3 5.26e-01    -  2.43e-01 3.03e-01f  1
  17  7.2722967e+00 1.48e-03 3.36e+01  -2.7 9.84e-02    -  5.32e-01 7.44e-01h  1
  18  6.6792355e+00 1.54e-03 3.59e+01  -2.7 1.18e-01    -  2.37e-01 7.00e-01f  1
  19  6.7332268e+00 1.44e-03 6.61e+01  -2.7 6.14e-01    -  2.71e-01 8.41e-02h  2
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  20  7.3841675e+00 1.21e-03 8.06e+01  -2.5 2.61e-01    -  1.00e+00 4.93e-01f  2
  21  7.4420788e+00 1.11e-03 1.16e+01  -2.6 9.19e-02    -  7.26e-01 8.54e-01h  1
  22  7.1439606e+00 3.53e-04 2.02e+01  -2.6 5.05e-02    -  6.86e-01 1.00e+00f  1
  23  6.4123719e+00 5.33e-04 8.59e+00  -3.2 1.70e-01    -  1.00e+00 5.61e-01f  1
  24  6.5522082e+00 1.31e-03 1.80e+01  -2.7 1.47e-01    -  9.27e-01 5.67e-01h  1
  25  6.2121194e+00 3.80e-03 1.30e+01  -2.9 3.48e-01    -  8.11e-01 6.43e-01h  1
  26  6.7639270e+00 2.41e-03 9.76e+01  -2.5 1.64e-01    -  3.78e-01 3.68e-01f  1
  27  6.6418677e+00 1.98e-03 8.87e+01  -2.8 2.01e-01    -  3.21e-01 1.75e-01h  1
  28  6.5108252e+00 1.06e-03 1.71e+01  -2.8 1.50e-01    -  2.77e-01 4.93e-01h  1
  29  6.2280535e+00 1.32e-03 2.73e+01  -2.8 8.00e-02    -  8.25e-01 1.00e+00f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  30  1.1251174e+01 1.74e-02 4.73e+01  -2.1 4.12e-01    -  4.26e-01 1.00e+00f  1
  31  9.4059475e+00 1.38e-02 5.00e+01  -2.3 3.69e-01    -  9.51e-01 5.86e-01h  1
  32  8.4090029e+00 9.95e-03 5.25e+01  -2.3 3.18e-01    -  6.46e-01 6.49e-01h  1
  33  8.2812945e+00 1.06e-02 4.70e+01  -2.3 1.88e+00    -  4.54e-01 1.14e-01f  3
  34  7.9267041e+00 3.34e-03 4.25e+01  -2.3 1.27e-01    -  1.00e+00 1.00e+00h  1
  35  7.9663831e+00 3.22e-03 6.65e+01  -2.3 2.57e-01    -  5.19e-01 4.11e-01H  1
  36  7.8770765e+00 1.57e-03 3.86e+01  -2.3 1.06e-01    -  1.00e+00 1.00e+00h  1
  37  7.6407281e+00 1.53e-02 6.88e+01  -2.3 2.61e-01    -  9.17e-01 8.73e-01h  1
  38  7.5992930e+00 2.21e-03 6.71e+01  -2.3 9.29e-02    -  1.00e+00 9.54e-01h  1
  39  7.5694792e+00 2.69e-03 3.72e+01  -2.3 1.08e-01    -  1.00e+00 1.00e+00f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  40  7.4745772e+00 1.79e-03 7.13e+01  -2.3 8.55e-02    -  1.00e+00 1.00e+00h  1
  41  7.4795670e+00 1.65e-03 3.66e+01  -2.3 1.00e-01    -  1.00e+00 1.00e+00h  1
  42  7.3032627e+00 5.26e-03 1.99e+01  -2.3 1.53e-01    -  1.00e+00 1.00e+00h  1
  43  7.2559317e+00 4.71e-03 7.78e+01  -2.3 2.62e-01    -  9.77e-01 2.14e-01h  3
  44  7.1640925e+00 6.63e-03 7.74e+01  -2.3 2.09e-01    -  1.00e+00 1.00e+00h  1
  45  7.1966678e+00 1.76e-03 3.79e+01  -2.3 1.83e-01    -  1.00e+00 1.00e+00H  1
  46  7.1126679e+00 5.44e-04 4.26e+01  -2.3 6.68e-02    -  1.00e+00 1.00e+00h  1
  47  7.0931453e+00 7.22e-04 5.77e+01  -2.3 3.85e-01    -  6.41e-01 1.20e-01h  4
  48  7.0588622e+00 9.23e-04 6.56e+01  -2.3 9.29e-02    -  1.00e+00 1.00e+00h  1
  49  3.8180551e+00 1.21e-03 7.22e+01  -3.5 9.38e-02    -  1.00e+00 9.34e-01f  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  50  3.7394455e+00 9.33e-03 7.36e+01  -2.7 2.47e-01    -  1.00e+00 7.42e-01h  1

Number of Iterations....: 50

                                   (scaled)                 (unscaled)
Objective...............:   3.7394455068087984e+00    3.7394455068087984e+00
Dual infeasibility......:   7.3633148676039596e+01    7.3633148676039596e+01
Constraint violation....:   9.3326753622575143e-03    9.3326753622575143e-03
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   2.0571919700034585e-03    2.0571919700034585e-03
Overall NLP error.......:   7.3633148676039596e+01    7.3633148676039596e+01


Number of objective function evaluations             = 79
Number of objective gradient evaluations             = 51
Number of equality constraint evaluations            = 79
Number of inequality constraint evaluations          = 0
Number of equality constraint Jacobian evaluations   = 51
Number of inequality constraint Jacobian evaluations = 0
Number of Lagrangian Hessian evaluations             = 0
Total seconds in IPOPT                               = 2.978

EXIT: Maximum Number of Iterations Exceeded.

Let's look at the fidelity in the subspace

println("Fidelity: ", unitary_fidelity(prob_leakage; subspace=op.subspace_indices))
Fidelity: 0.998405116901662

and plot the result using the plot_unitary_populations function.

plot_unitary_populations(prob_leakage; fig_size=(900, 700))
Example block output

Here we can see that the leakage populations have been driven substantially down.


This page was generated using Literate.jl.