-
Notifications
You must be signed in to change notification settings - Fork 4
Add quantum fisher information for a driven-dissipative Kerr parametric oscillator using auto-diff #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
using SciMLSensitivity # Allows for ODE sensitivity analysis | ||
using FiniteDiff # Finite difference methods | ||
using LinearAlgebra # Linear algebra operations | ||
using CairoMakie # Plotting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add
CairoMakie.activate!(type = "svg")
The KPO system is governed by the Hamiltonian: | ||
$$H = -p_1 a^\dagger a + K (a^\dagger)^2 a^2 - G (a^\dagger a^\dagger + a a)$$ | ||
|
||
where: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should leave an empty line after where:
, otherwise the list is not properly shown.
```{julia} | ||
function final_state(p) | ||
G, K, γ = 0.002, 0.001, 0.01 | ||
|
||
N = 20 # cutoff of the Hilbert space dimension | ||
a = destroy(N) # annihilation operator | ||
|
||
coef(p,t) = - p[1] | ||
H = QobjEvo(a' * a , coef) + K * a' * a' * a * a - G * (a' * a' + a * a) | ||
c_ops = [sqrt(γ)*a] | ||
ψ0 = fock(N, 0) # initial state | ||
|
||
tlist = range(0, 2000, 100) | ||
|
||
sol = mesolve(H, ψ0, tlist, c_ops; params = p, progress_bar = Val(false), saveat = [tlist[end]]) | ||
return sol.states[end].data | ||
end | ||
``` | ||
|
||
```{julia} | ||
function final_state(p, t) | ||
G, K, γ = 0.002, 0.001, 0.01 | ||
|
||
N = 20 # cutoff of the Hilbert space dimension | ||
a = destroy(N) # annihilation operator | ||
|
||
coef(p,t) = - p[1] | ||
H = QobjEvo(a' * a , coef) + K * a' * a' * a * a - G * (a' * a' + a * a) | ||
c_ops = [sqrt(γ)*a] | ||
ψ0 = fock(N, 0) # initial state | ||
|
||
tlist = range(0, 2000, 100) | ||
|
||
sol = mesolve(H, ψ0, tlist, c_ops; params = p, progress_bar = Val(false), saveat = [t]) | ||
return sol.states[end].data | ||
end | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we define everything in one function?
```{julia} | |
function final_state(p) | |
G, K, γ = 0.002, 0.001, 0.01 | |
N = 20 # cutoff of the Hilbert space dimension | |
a = destroy(N) # annihilation operator | |
coef(p,t) = - p[1] | |
H = QobjEvo(a' * a , coef) + K * a' * a' * a * a - G * (a' * a' + a * a) | |
c_ops = [sqrt(γ)*a] | |
ψ0 = fock(N, 0) # initial state | |
tlist = range(0, 2000, 100) | |
sol = mesolve(H, ψ0, tlist, c_ops; params = p, progress_bar = Val(false), saveat = [tlist[end]]) | |
return sol.states[end].data | |
end | |
``` | |
```{julia} | |
function final_state(p, t) | |
G, K, γ = 0.002, 0.001, 0.01 | |
N = 20 # cutoff of the Hilbert space dimension | |
a = destroy(N) # annihilation operator | |
coef(p,t) = - p[1] | |
H = QobjEvo(a' * a , coef) + K * a' * a' * a * a - G * (a' * a' + a * a) | |
c_ops = [sqrt(γ)*a] | |
ψ0 = fock(N, 0) # initial state | |
tlist = range(0, 2000, 100) | |
sol = mesolve(H, ψ0, tlist, c_ops; params = p, progress_bar = Val(false), saveat = [t]) | |
return sol.states[end].data | |
end | |
``` | |
function final_state(p, t=nothing) | |
G, K, γ = 0.002, 0.001, 0.01 | |
N = 20 # cutoff of the Hilbert space dimension | |
a = destroy(N) # annihilation operator | |
coef(p,t) = - p[1] | |
H = QobjEvo(a' * a , coef) + K * a' * a' * a * a - G * (a' * a' + a * a) | |
c_ops = [sqrt(γ)*a] | |
ψ0 = fock(N, 0) # initial state | |
tlist = isnothing(t) ? [0, 2000] : [0, t] | |
sol = mesolve(H, ψ0, tlist, c_ops; params = p, progress_bar = Val(false)) | |
return sol.states[end].data | |
end |
Plot the time evolution of the Quantum Fisher Information: | ||
|
||
```{julia} | ||
fig = Figure(size=(900, 350)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove the size here? We should have set a default size in Quarto already.
I don't have the permissions to push to this branch/PR nor to resolve the comments on github. See #46 Here is the notebook with implemented suggestions: |
Friendly bump |
Can you locally make a new branch based on |
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I'm approving.
I'm also working to make it working with true automatic differentiation using Enzyme.jl. I will let you know.
ooeoe. That would be super cool! |
Checklist
Thank you for contributing to Tutorials for Quantum Toolbox in
Julia
! Please make sure you have finished the following tasks before opening the PR.date
were modified for new or updated tutorials.Version Information
section was added at the end and displays the output ofversioninfo()
.make render
.Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a Draft Pull Request to let the others know this on-going work.
Description
This is a PR to preview the new tutorial contributed by @oameye