LLNL / quandary

Optimal control for open quantum systems
MIT License
49 stars 9 forks source link

Quandary seems to be ignoring input prof data #12

Open joshjob42 opened 2 years ago

joshjob42 commented 2 years ago

Given the following .cfg and pcof description (just an example of seemingly a general feature) quandary seems to be eliminating or setting to zero a set of the parameters. Seemingly no matter what settings I use, some of the parameters are ignored. I'm trying to translate some pulses from Juqbox to quandary as in #8 , but keep running into this odd behavior.

nlevels = 5,5
ntime = 65536
dt = 0.00213623
nspline = 10
runtype = simulation
nessential = 4,4
initialcondition = pure,0.0,0.0
np_init = 1
transfreq = 30.159289474462014,0.0
rotfreq = 30.159289474462014,0.0
selfkerr = 1.382300767579509,0.0
collapse_type = none
decay_time = 0.0,0.0
dephase_time = 0.0,0.0
carrier_frequency0 = -0.0,-1.382300767579509,-2.764601535159018
carrier_frequency1 = 0.0,0.0,0.0
apply_pipulse = none
crosskerr = 0.0
Jkl = 0.0
usematfree = 1
datadir = ./data/data_out3
optim_monitor_frequency = 10
output_frequency = 1
output0 = fullstate
linearsolver_type = gmres
linearsolver_maxiter = 20
gate_rot_freq = 30.159289474462014,0.0
optim_regul = 1e-05
optim_atol = 0.0001
optim_rtol = 0.0001
optim_maxiter = 200
optim_init = ./params.dat
optim_init_ampl = 0.05654866776461627,0.05654866776461627
optim_target = pure,3.0,0.0
optim_objective = Jmeasure
optim_weights = 1.0
optim_penalty = 0.01
optim_penalty_param = 0.5
optim_bounds = 0.28274333882308134,0.28274333882308134,0.0,0.0

params.dat:

0.006273048571518148
-0.002671988436886911
0.015305319012587928
-0.003864006886849269
0.004472783549475124
0.001872177951755414
0.0
0.0
0.0
0.0
0.0
0.0
-0.002783689893355962
0.0027456264881874403
-0.017671109902235055
-0.014423247782547458
-0.0011719053410253787
0.004649179451431896
0.0
0.0
0.0
0.0
0.0
0.0
-0.0007134922883191623
-0.0036135590922451613
-0.020209842593556546
-0.011566663788919051
0.012623560831109215
-0.004027644231579048
0.0
0.0
0.0
0.0
0.0
0.0
-0.012485082724985528
0.0073926273963019614
-0.014507184821150154
-0.022172804288916877
-0.014144544605747041
0.0011557469818039455
0.0
0.0
0.0
0.0
0.0
0.0
0.0014475401121371476
-0.008758227853572243
-0.009520317893210433
-0.022200244575830672
-0.015869036842510457
0.000989319618420927
0.0
0.0
0.0
0.0
0.0
0.0
-0.001983597207982895
0.01591726249561899
0.001283756932631295
-0.02561063013422594
-0.028553463768026
0.003198850589086286
0.0
0.0
0.0
0.0
0.0
0.0
-0.00853008711675194
-0.00623078515932393
0.010653702386718217
-0.017770107958376063
-0.018860292382441215
-0.0005564038906752833
0.0
0.0
0.0
0.0
0.0
0.0
-0.01135098552375518
0.0003486621630196009
0.02377266104044435
-0.019390514890622663
-0.0034954865992576365
0.0034566892125143535
0.0
0.0
0.0
0.0
0.0
0.0
8.577253199317275e-5
0.003467204928616855
0.0224248349197595
-0.02926161608534821
0.007985958950111375
0.006388324394239617
0.0
0.0
0.0
0.0
0.0
0.0
0.001075349176437903
-0.00464038144171446
-0.002251673682440214
-0.000713925598675713
0.0056268573293378225
-0.0020663005409689962
0.0
0.0
0.0
0.0
0.0
0.0

The params.dat in the output data folder:

0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
-2.78368989335596e-03
2.74562648818744e-03
-1.76711099022351e-02
-1.44232477825475e-02
-1.17190534102538e-03
4.64917945143190e-03
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
-7.13492288319162e-04
-3.61355909224516e-03
-2.02098425935565e-02
-1.15666637889191e-02
1.26235608311092e-02
-4.02764423157905e-03
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
-1.24850827249855e-02
7.39262739630196e-03
-1.45071848211502e-02
-2.21728042889169e-02
-1.41445446057470e-02
1.15574698180395e-03
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
-8.53008711675194e-03
-6.23078515932393e-03
1.06537023867182e-02
-1.77701079583761e-02
-1.88602923824412e-02
-5.56403890675283e-04
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
-1.13509855237552e-02
3.48662163019601e-04
2.37726610404443e-02
-1.93905148906227e-02
-3.49548659925764e-03
3.45668921251435e-03
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
8.57725319931727e-05
3.46720492861686e-03
2.24248349197595e-02
-2.92616160853482e-02
7.98595895011137e-03
6.38832439423962e-03
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00
0.00000000000000e+00

In general it looks quandary for this system is doing something like setting blocks of 12 coefficients to 0 or including/importing them as is with the pattern [0,1,1,1,0,0,1,1,1,0] (derived from other tests with full parameter vectors). I've tried many different permutations of potential maps from Juqbox to quandary, and varied things like maximum amplitudes, etc., but this problem repeats.

Any help or insight here would be hugely appreciated.

steffi7574 commented 2 years ago

Quandary always sets the first and last two B-spline coefficients to zero, such that the resulting control pulses always start and end at zero at time t=0 and final time t=T.

The ordering of the coefficients for the Bspline amplitudes in Quandary is the following: For each oscillator, iterate over splines first, then each iterates over carrier waves, then each contains two elements (real and imaginary part). Therefore, in your case where you have two oscillators (row 1-60 and 61-120 respectively), each with 10 splines and 3 carrier waves, Quandary will set the first and last 12 parameters to zero for each oscillators: row 1-12, 48-60 (for oscillators 1) as well as 61-72, 108-120 (for oscillators 2) will be set to zero. The number 12 corresponds to 2 splines each with 3 carrier waves and each with a real and imaginary part (12=2splines3carrier2).

As far as I know, Juqbox also does set the first and last two spline coefficients to zero, for the same reason. So I suspect that the reordering you did is not entirely correct.