LLNL / Juqbox.jl

Juqbox.jl solves quantum optimal control problems in closed quantum systems
MIT License
42 stars 10 forks source link

D1 vs number of frequencies #12

Closed relugzosiraba closed 3 years ago

relugzosiraba commented 3 years ago

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.

andersp commented 3 years ago

The main idea behind the algorithm in Juqbox is to select the carrier wave frequencies such that they equal the transition frequencies in the system Hamiltonian. By doing that the B-splines only need to describe the slow variation in amplitude and phase of each carrier wave. A rule of thumb is about D1=10 B-spline coefficients per 100 ns of gate duration. You may want to look at our latest preprint on arXiv for further details: http://arxiv.org/abs/2106.14310

relugzosiraba commented 3 years ago

Let’s say we consider a system with many levels. Assume we choose long gate duration, which means one should also include small frequencies in carrier waves (see the frequency resolution discussion in https://github.com/LLNL/Juqbox.jl/issues/14). In such a case where Nfreq is large due to the inclusion of small frequencies, can/should we choose D1 small? By this way, we can keep nCoeff not too larger (so that the optimization problem does not get too difficult) than the case where the gate duration is short. However, I am not sure if there will be any gain in choosing gate duration large but D1 small. The ultimate goal is to get high fidelities.

The rule of thumb was suggested as “D1=10 B-spline coefficients per 100 ns of gate duration”. Can/should we choose a rule of thumb which also includes Nfreq (and hence gate duration)?

andersp commented 3 years ago

I don't know a general answer to your question, but if you describe your system in detail I can try advising what frequencies to try.

relugzosiraba commented 3 years ago

A related question:

Looking at the time domain plots here, should we expect to get the dirty frequency domain plots? Or can I simply eliminate the dirty peaks by modifying the plotting parameters? I think that I include enough transition frequencies for the carrier waves.

case___Tmax_1___random_seed_1-ctrl-lab-fft-log case___Tmax_1___random_seed_1-ctrl-lab-fft case___Tmax_1___random_seed_1-ctrl-lab case___Tmax_1___random_seed_1-ctrl-rot

andersp commented 3 years ago

What you call the "dirty" peaks are centered around the carrier wave frequencies that you provided. If you don't think they should be there you need to remove those carrier wave frequencies from your problem specification. It has nothing to do with plotting.

relugzosiraba commented 3 years ago

I get dirty peaks no matter what N_freq I choose. I get clean pulses when I work with the simple examples provided in Juqbox but the pulses for slightly complicated gates are always dirty as in those figures. Why are there too many dirty peaks even though I provide a finite number of carrier frequencies?

relugzosiraba commented 3 years ago

I've attached the code that I used to generate the recent plots. I’ve also added the output data and results. How can I improve the code to get clean pulses?

Archive.2.zip

andersp commented 3 years ago

I played around a bit with your test case and found a pretty good solution with 99.9 % gate fidelity. Next step would be to reduce the leakage, and I recommend adding another guard level to the transmon and maybe increase the wmatscale parameter. baris1-setup.jl.zip

relugzosiraba commented 3 years ago

thx, checking

relugzosiraba commented 3 years ago

The problem is not really with the fidelity. I have already been getting high fidelities but the pulses are not clean even in your version of the code. However your suggestions seem to make things better.

andersp commented 3 years ago

In your case the transition frequencies are only separated by about 11 MHz. The frequency resolution in the FFT is df = 1/Tmax. If Tmax=1000 ns, df = 1e-3 GHz = 1 MHz. Further, the B-splines vary on the time scale dts = Tmax/D1, corresponding to the frequency scale dfs = D1/Tmax. If D1=100, then dfs = 0.1 GHz = 100 MHz. With these settings the B-splines vary about 10x faster than the (rotating frame) carrier waves, which explains why you don't see any clean peaks in the spectrum. There are two possibilities for getting a cleaner spectrum of the control pulses: 1) Increase Tmax 2) Decrease D1 To a lesser extent it will also help to set bounds such that each B-spline starts and ends at zero. You can do that by calling the zero_start_end!() function, after assign_thresholds_ctrl_freq().

relugzosiraba commented 3 years ago

Thanks! I had already noticed the positive effects of increasing Tmax and decreasing D1 at the same time. Your frequency scale argument says that D1 should not be too large. That’s bad news for convergence speed…

I have some questions about “baris1-setup.jl.zip” you shared. I noticed that you tried varying parameters.

Do you suggest use_sparse = true or false? How do you decide which to select?

Why did you make lbfgsMax = 100? How would that help?

Do we need large Pmin? It is set to 80. Could too small Pmin result in dirty pulses?

andersp commented 3 years ago

Here are my answers and some additional suggestions

  1. On a machine with enough memory, Juqbox usually runs faster by setting use_sparse=false.
  2. I could not get your original setup to converge, even with the original setting of params.traceInfidelityThreshold=1e-2. The evolution of the objective function was very spiky, with a spike about every 10 iterations. That's why I increased lbfgsMax.
  3. Long time integrations require a smaller time step to keep the phase error small. It is controlled by setting the number of points (time steps) per shortest period (Pmin). Since to original setup wasn't converging very well, I increased Pmin until the infidelity stopped changing for a given parameter vector. That's how I picked Pmin=80.
  4. I also reduced params.traceInfidelityThreshold to 1e-3. That corresponds to a gate fidelity of 99.9 %.
  5. It is good practice to verify the parameter vector in the converged solution by evaluating the objective function with twice the number of time steps. It should not make much of a difference. If it does, then you can start a new optimization with a larger Pmin, using the previous parameter vector as initial guess.