GithubHelp home page GithubHelp logo

juqbox.jl's Introduction

Logo

Juqbox.jl is a package for solving quantum optimal control problems in closed quantum systems, where the evolution of the state vector is governed by Schroedinger's equation.

The main features of Juqbox include

  • Symplectic time integration of Schroedinger's equation using the Stormer-Verlet scheme.
  • Efficient parameterization of the control functions using B-splines with carrier waves.
  • Objective function includes target gate infidelity and occupation of guarded (forbidden) states.
  • Exact computation of the gradient of the objective function by solving the discrete adjoint equation.

The numerical methods in Juqbox.jl are documented in these papers:

  1. N. A. Petersson and F. M. Garcia, "Optimal Control of Closed Quantum Systems via B-Splines with Carrier Waves", SIAM J. Sci. Comput. (2022) 44(6): A3592-A3616, LLNL-JRNL-823853, arXiv:2106.14310.
  2. N. A. Petersson, F. M. Garcia, A. E. Copeland, Y. L. Rydin and J. L. DuBois, “Discrete Adjoints for Accurate Numerical Optimization with Application to Quantum Control”, LLNL-JRNL-800457, arXiv:2001.01013.

Installation

The following instructions assume that you have already installed Julia (currently version 1.8.5) on your system. Before proceeding, we recommend that you add the following to the file ~/.julia/config/startup.jl. You may have to first create the config folder under .julia in your home directory. Then add this line to the startup.jl file:

  • ENV["PLOTS_DEFAULT_BACKEND"]="GR"

This is an environment variable. It specifies the backend for plotting. Most of the examples in this document uses the GR backend, which assumes that you have installed that package. If you have trouble with GR, you can instead install the "PyPlot" package and set the default backend to "PyPlot".

Start julia and type ] to enter the package manager. First install these packages (unless they are already installed):

  • (@v1.8) pkg> add Plots
  • (@v1.8) pkg> add GR
  • (@v1.8) pkg> add FFTW
  • (@v1.8) pkg> add Ipopt
  • (@v1.8) pkg> add JLD2
  • (@v1.8) pkg> add LaTeXStrings
  • (@v1.8) pkg> add Printf
  • (@v1.8) pkg> add Random
  • (@v1.8) pkg> add SparseArrays
  • (@v1.8) pkg> add Test

Then install Juqbox.jl:

  • (@v1.8) pkg> add https://github.com/LLNL/Juqbox.jl
  • (@v1.8) pkg> precompile
  • (@v1.8) pkg> test Juqbox
  • ... all tests should pass (case=flux gives a Warning message) ...

To exit the package manager you type <DEL>, and to exit julia you type exit().

Documentation

The Juqbox.jl documentation can be found here.

Examples

To access the examples, clone the Juqbox.jl git repository:

Then go to the examples directory in the Juqbox.jl folder (on some systems the folder is named juqbox.jl):

  • shell> cd Juqbox.jl/examples

Start julia and try the `cnot1-setup.jl' test case:

  • shell> julia
  • julia> include("cnot1-setup.jl")
  • julia> pcof = run_optimizer(prob,pcof0);
  • julia> pl = plot_results(params,pcof);
  • julia> pl[1]

Examples of the setup procedure can be found in the following scripts in the Juqbox.jl/examples directory (invoke by, e.g. include("cnot1-setup.jl"))

  • rabi-setup.jl Pi-pulse (X-gate) for a qubit, i.e. a Rabi oscillator.
  • cnot1-setup.jl CNOT gate for a single qudit with 4 essential and 2 guard levels.
  • flux-setup.jl CNOT gate for single qubit with a flux-tuning control Hamiltonian.
  • cnot2-setup.jl CNOT gate for a pair of coupled qubits with guard levels.
  • cnot3-setup.jl Cross-resonance CNOT gate for a pair of qubits that are coupled by a cavity resonator. Note: This case reads an optimized solution from file.
  • Risk_Neutral/run_all.jl SWAP 0-2 gate for a single qudit. This routine performs both a deterministic optimization, and a risk-neutral optimization where the system Hamiltonian is perturbed by additive noise which is assumed to be uniform. Full details of the example can be found in Section 6.2 in one of our papers, which can be found here.

Contributing to Juqbox.jl

Juqbox.jl is currently under development. The prefered method of contributing is through a pull request (PR). If you are interested in contributing, please contact Anders Petersson ([email protected]) or Fortino Garcia ([email protected]).

Credits

Most of the Julia code was written by Anders Petersson and Fortino Garcia. Important contributions were also made by Ylva Rydin and Austin Copeland.

License

Juqbox.jl is relased under the MIT license.

Note: FFTW.jl license

Juqbox.jl uses the Julia package FFTW.jl for post processing of the results. That package is released under the MIT Expat license and provides Julia bindings to the FFTW library for fast Fourier transforms (FFTs), as well as functionality useful for signal processing. Note that the FFTW library is licensed under GPLv2 or higher (see its license file), but the bindings to the FFTW library in the FFTW.jl package are licensed under MIT. As an lternative to using the FFTW libary, the FFTs in Intel's Math Kernel Library (MKL) can be used by setting an environment variable JULIA_FFTW_PROVIDER to MKL and running Pkg.build("FFTW"). MKL will be provided through MKL_jll. Setting this environment variable only needs to be done for the first build of the package; after that, the package will remember to use MKL when building and updating.

Note: Ipopt.jl license

Juqbox.jl uses the Julia package Ipopt.jl for optimizing control functions. That package is released under the MIT Expat License and provides Julia bindings to the Ipopt library, which is released under the Eclipse Public License.

juqbox.jl's People

Contributors

andersp avatar fortinog avatar jasonchadwick avatar leespen1 avatar sohailreddy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

juqbox.jl's Issues

assign_thresholds()

How are the threshold assigned? Is it proper to assign the same threshold for all parameters based on max control amplitudes?

D1 vs number of frequencies

nCoeff = 2 * Nctrl * Nfreq * D1

For long gates acting on many levels, I get high fidelities by choosing Nfreq small but D1 large. However, this gives me noisy Fourier spectrums with many little peaks around the main peak. A sample representing this for Nfreq = 2 (with main frequencies 4.1 and 4.8 GHz for transmon and cavity coupled to it), D1 = 500 and pulse duration Tmax = 5000 ns:

image

If I instead keep D1 small and constant but increase Nfreq (so that I would use similar number of coefficients as before), can I get rid of the little peaks? I know I may get more main peaks in that case but I want to remove the noise created by the little peaks.

Gates on two qudits with guard levels

Section 6.1 of the paper (https://arxiv.org/pdf/2106.14310.pdf) gives an example for the case right below Eq. (2.16) [*]. You say in Section 6.1 that “While there are additional resonant
frequencies in the system, they are sufficiently close to the above set to trigger all
desired transitions in the system.”

  1. What is the measure for “being sufficiently close”? If one of the qudits has 2 essential + 1 guard (a transmon) and the other has 8 essential + 3 guards (a cavity mode), what other frequencies would you need to include? I am assuming a gate which acts on transmon as identity and on cavity mode as non-identity affecting some or all essential levels.

  2. For the case right below Eq. (2.16); n1 = 3, n2 = 3. How many essential and guard levels are considered?

[*] However, it seems that the number of guard levels is zero for the latter. Asking about this in Question 2 above.

Control runtime

In Juqbox, can you control runtime so that optimization terminates with an output even if the optimization does not converge? I am looking for something like the following: If classical computation time is too large, then terminate optimization and store output after a certain time. It is possible to do it with “number of iterations” but I am curious if there is a parameter choice for runtime too.

Ignore certain initial conditions

By default, Juqbox will optimize for every possible initial occupation of Ne levels - is it possible to tell Juqbox to ignore some of these initial conditions if we don't care about how those states evolve? (I am looking at a gate that promotes a 2-state qubit to a 4-state ququart, so I want that oscillator to have 4 essential levels but I don't care what happens if it starts in state 2 or 3 because I expect it to always start in states 0 or 1)

Set max control amplitude in lab frame?

How do I specify the maximum control amplitude in the lab frame? It seems that maxpar in calculate_timestep and assign_thresholds is assumed to be in the rotating frame.

p, q, evalctrl

Are pfunc, qfunc calculated by

pfunc, qfunc = Juqbox.evalctrl(params, pcof, td, q)

correspond to p, q in Eq. (4) of https://arxiv.org/pdf/2001.01013.pdf?

I am using p, q in QuTiP master equation (probably as you did in https://arxiv.org/pdf/2005.13165.pdf) but the optimal pulses giving high fidelity in Juqbox does not work (low fidelity) in QuTiP. How should the output p, q be used in QuTiP? I can share my code. Could you share your code?

FFT symmetry

Here is a lab-frame spectrum for an optimal signal calculated via Juqbox. Does negative side of the spectrum contain any new information or can those be ignored since the spectrum is symmetric with respect to the y axis?

Spec1

om[] with different number of columns

Consider frequencies in Pg. 6 of https://arxiv.org/pdf/2106.14310.pdf:

image

Let’s say we want to keep the first 2 frequencies for Omega_1 and first 5 frequencies for Omega_2. So, first row of om[] will have 2 columns and second row of om[] will have 5 columns. Is it possible to form such om[] in Juqbox? Do number of columns have to be equal for each row? If they have to be equal, how should we construct the last 3 columns of the first row? Keeping number of frequencies low is ideal not to make optimization harder than it is supposed to be.

Subsystem ordering in vectors

In examples/cnot3-setup.jl, the Ne and Ng vectors, as well as the Hsym_ops vector, are ordered such that the numbers correspond to the order [fa, fb, fs]. However, the maxpar vector is [0.05, 0.1, 0.1] which seems to be ordered [fs, fa, fb] instead. Is this correct?

Weight vectors

How do you define and use the weight vectors to penalize guard levels?

Trace (in)fidelity

What does “trace fidelity” show? The fidelity of the matrix consisting of only essential levels or the fidelity of the whole matrix including guard levels?

Dual infeasibility vs gate fidelity

Juqbox allows you to specify the convergence goal for dual infeasibility with ipTol; is there a way to instead iterate until reaching a goal gate fidelity?

Pmin, calculate_timestep() and samplerate

How should we choose Pmin?

Is samplerate for plots related to calculate_timestep()? They seem to be not directly related. What does samplerate represent for plots? Where do we takes "samples" from?

Parallelism?

Can Juqbox be set up to take advantage of multiple cores at the same time? The original Ipopt package seems to have some options for this, depending on the linear solver used, but I can't figure out how to get it to work with the Ipopt.jl package.

Choosing D1 parameter

How should we choose D1 (num of B-spline coefficients)? Should it depend on pulse duration?

"Error: regularization becomes too large" (running on cluster)

I received this error message after trying to run Juqbox on a cluster (Julia version 1.4.2) and I can't figure out what went wrong. Is it missing a dependency? IPopt tells me "Error in step computation (regularization becomes too large?)!", and the message sent to stderr is "Error in `julia': corrupted size vs. prev_size: 0x000000000ab78db0". The error does not happen when running the same optimization locally on my laptop.

Output:
juqbox_test_12003451_out.txt

Error output:
juqbox_test_12003451_err.txt

Choosing lbfgsMax

How should we choose lbfgsMax? If it is large, will more memory be used but the job will run faster?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.