Closed relugzosiraba closed 2 years ago
Quandary can read parameters from a text file using the "optim_init" configuration option. The format is one column of parameters (floats). It can not read JLD2 files directly. Instead you'll have to extract the parameters into a plain text file. @andersp can probably comment on how to do this.
Then, unfortunately, the order of parameters as given in Juqbox does not match the sorting of parameters in Quandary. Therefore, Juqbox parameters need to be reshuffled before read into Quandary. In Quandary's "develop" branch, there is a python script in /util/sort_Juqbox_to_Quandary_params.py that does that sorting. It's input is a text file that contains a column of (optimized) parameters as provided by Juqbox. The output is the resorted parameter file that can be read in by Quandary.
To save the control vector 'pcof' from Juqbox as a plain ascii (text) file, you do: j> using DelimitedFiles j> writedlm("test.dat", pcof);
To read it from a jld2 file, there is a Juqbox function for that purpose: j> pcof = read_pcof("test.jld2")
Using Juqbox.jl, let’s say I find the optimal coefficient vector (“pcof” stored in .jld2 files, for example as defined in https://github.com/LLNL/Juqbox.jl/blob/master/examples/cnot3-setup.jl) and optimal control pulses (stored in .dat files). How can I use the Juqbox output files as input files in the Quandary configuration files in order to solve Lindblad equation forward in time or to do (more) pulse optimization? Is there 1-to-1 equivalence between Juqbox output and Quandary input? In other words, can I directly use Juqbox output files as input files for Quandary jobs? Or do I need to adjust the Juqbox output first?
How can I set the initial coefficients in Quandary configuration files? There is “optim_init” in https://github.com/LLNL/quandary/blob/master/tests/xgate/xgate.cfg. Does optim_init correspond to pcof in Juqbox.jl?