-
Notifications
You must be signed in to change notification settings - Fork 17
work towards MTKV10 #243
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
work towards MTKV10 #243
Conversation
…ameters and initial conditions
|
Only one test failure left: order = 2 #order of the cumulant expansion
@cnumbers N Δ g κ Γ R ν M
hc = FockSpace(:cavity)
ha = NLevelSpace(:atom, 2)
h = hc ⊗ ha
k = Index(h, :k, N, ha)
l = Index(h, :l, N, ha)
m = Index(h, :m, N, ha)
n = Index(h, :n, N, ha)
@qnumbers a::Destroy(h)
σ(i, j, k) = IndexedOperator(Transition(h, :σ, i, j), k)
σn(i, j, k) = NumberedOperator(Transition(h, :σ, i, j), k)
# Define the Hamiltonian
H = -Δ*a'a + g*(Σ(a'*σ(1, 2, k), k) + Σ(a*σ(2, 1, k), k))
J = [a, σ(1, 2, l), σ(2, 1, l), σ(2, 2, l)]
rates = [κ, Γ, R, ν]
ops = [a'*a, σ(2, 2, m)]
eqs = meanfield(ops, H, J; rates = rates, order = order)
# System parameters
N_ = 2e5
Γ_ = 1.0 #Γ=1mHz
Δ_ = 2500Γ_ #Δ=2.5Hz
g_ = 1000Γ_ #g=1Hz
κ_ = 5e6*Γ_ #κ=5kHz
R_ = 1000Γ_ #R=1Hz
ν_ = 1000Γ_ #ν=1Hz
ps = [N, Δ, g, κ, Γ, R, ν]
p0 = [N_, Δ_, g_, κ_, Γ_, R_, ν_]
op1 = σ(1, 2, m)
op2 = σ(2, 1, n)
# Test system with no filter func to evaluate corr function
eqs_c_2 = complete(eqs);
eqs_ev = evaluate(eqs_c_2; limits = (N=>3))
u0_ev = zeros(ComplexF64, length(eqs_ev))
@named sys_ev = ODESystem(eqs_ev)
prob_ev = ODEProblem(sys_ev, u0_ev, (0.0, 0.1/50Γ_), ps .=> p0);
sol_ev = solve(prob_ev, Tsit5(), maxiters = 1e7)
corr3 = CorrelationFunction(op1, op2, eqs_c_2)
corr3_ev = evaluate(corr3, 1, 2; limits = (N=>3));
@named csys3 = ODESystem(corr3_ev)
p0_c3 = correlation_p0(corr3_ev, sol_ev.u[end], ps .=> p0)
u0_c3 = correlation_u0(corr3_ev, sol_ev.u[end])
dict = merge(Dict(u0_c3), Dict(p0_c3))
# "var\"⟨σ122⟩\"(τ)" ∈ string.(unknowns(csys3))
# "var\"⟨σ122⟩\"(τ)" ∈ string.(first.(u0_c3))
prob_c3 = ODEProblem(csys3, dict, (0.0, 0.05))
sol_c3 = solve(prob_c3, Tsit5(); saveat = 0.001, maxiters = 1e8); |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #243 +/- ##
==========================================
- Coverage 79.38% 78.78% -0.61%
==========================================
Files 17 17
Lines 3235 3214 -21
==========================================
- Hits 2568 2532 -36
- Misses 667 682 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Only two examples in the docs remain to be fixed: @ChristophHotter Can you have a look at them? |
|
Migration to new ModelingToolkit.jl API:
Documentation and example improvements:
Dependency and CI configuration updates:
|
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.
Pull Request Overview
This PR updates QuantumCumulants.jl to work with ModelingToolkit v10 (MTKV10), implementing breaking changes in the API. The main change is replacing ODESystem with System and updating the corresponding function signatures and parameter handling throughout the codebase.
- Replace
ODESystemconstructor withSystemacross all files - Update ODEProblem creation to use dict-based parameter/initial condition merging instead of separate parameter lists
- Refactor internal functions to support the new ModelingToolkit API
Reviewed Changes
Copilot reviewed 56 out of 57 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Multiple test files | Update from ODESystem to System and change ODEProblem parameter syntax |
| src/diffeq.jl | Major refactoring of system creation logic and parameter extraction |
| src/correlation.jl | Update correlation function system creation |
| src/measurement_backaction_indices.jl | Replace ODESystem with System and move utility function |
| src/utils.jl | Add utility function for averaging operations |
| docs/ files | Update documentation examples to use new syntax |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Looks good! Thanks for your work!
I will fix adapt the jupyter notebooks and look at the issue with SQA v0.4.2 later.
Project.toml
Outdated
| Random = "1.10" | ||
| SciMLBase = "1, 2" | ||
| SecondQuantizedAlgebra = "0.3.1" | ||
| SecondQuantizedAlgebra = "<0.4.2" |
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.
Fix to 0.4.1 for now.
I will look at v0.4.2 later.
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.
The dict for the ODEProblem needs to be added also for the jupyter-notebooks. I will do it in a separate PR later.
| tf = 1/20Γ_ # free evolution without drive | ||
| function f(t) | ||
| global function f(t) |
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 does the function need to be global?
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 doesn't, think. I remnant of when I was trying to debug
|
Can we do SQA 4.2 in a seperate PR? |
|
We should implement a Literate.jl workflow such that the jupyter notebooks should not be updated manually. I propose we merge and do this in a seperate PR. |
This PR needs SciML/ModelingToolkit.jl#3781 and https://github.com/qojulia/SecondQuantizedAlgebra.jl
SciML/ModelingToolkit.jl#3789