From 24d0327c26cad12b6402bacd4c74e3d81954b6ab Mon Sep 17 00:00:00 2001 From: Silas-Coleman Date: Wed, 7 May 2025 15:57:03 -0500 Subject: [PATCH 1/3] Added Time Integrators --- src/quantum_integrators.jl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/quantum_integrators.jl b/src/quantum_integrators.jl index 8108a1c8..1a3ce1d7 100644 --- a/src/quantum_integrators.jl +++ b/src/quantum_integrators.jl @@ -4,6 +4,8 @@ export KetIntegrator export UnitaryIntegrator export DensityMatrixIntegrator export VariationalUnitaryIntegrator +export TimeDependentKetIntegrator +export TimeDependentUnitaryIntegrator using LinearAlgebra using NamedTrajectories @@ -80,5 +82,30 @@ function VariationalUnitaryIntegrator( return BilinearIntegrator(Ĝ, traj, var_Ũ⃗, a) end +# ----------------------------------------------------------------------------- # +# Default Integrators +# ----------------------------------------------------------------------------- # + +function TimeDependentKetIntegrator( + sys::QuantumSystem, + traj::NamedTrajectory, + ψ̃::Symbol, + a::Symbol , + t::Symbol +) + return TimeDependentBilinearIntegrator(sys.G, traj, ψ̃, a, t) +end + +function TimeDependentUnitaryIntegrator( + sys::QuantumSystem, + traj::NamedTrajectory, + Ũ⃗::Symbol, + a::Symbol, + t::Symbol +) + Ĝ = (a_, t_) -> I(sys.levels) ⊗ sys.G(a_,t_) + return TimeDependentBilinearIntegrator(Ĝ, traj, Ũ⃗, a, t) +end + end \ No newline at end of file From 1bdd0305efa6d38e6d3e37e2ba91fb8ebad5214e Mon Sep 17 00:00:00 2001 From: Silas-Coleman Date: Mon, 12 May 2025 11:41:23 -0500 Subject: [PATCH 2/3] Corrected Integrator Dependencies --- src/quantum_integrators.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/quantum_integrators.jl b/src/quantum_integrators.jl index 1a3ce1d7..919c47f9 100644 --- a/src/quantum_integrators.jl +++ b/src/quantum_integrators.jl @@ -87,7 +87,7 @@ end # ----------------------------------------------------------------------------- # function TimeDependentKetIntegrator( - sys::QuantumSystem, + sys::TimeDependentQuantumSystem, traj::NamedTrajectory, ψ̃::Symbol, a::Symbol , @@ -97,7 +97,7 @@ function TimeDependentKetIntegrator( end function TimeDependentUnitaryIntegrator( - sys::QuantumSystem, + sys::TimeDependentQuantumSystem, traj::NamedTrajectory, Ũ⃗::Symbol, a::Symbol, From e849fd7c0848a5092dfde21f18ff2384be807215 Mon Sep 17 00:00:00 2001 From: Silas-Coleman Date: Thu, 22 May 2025 12:13:17 -0500 Subject: [PATCH 3/3] Added time-dependent support in unitary_smooth_pulse_problem --- .../unitary_smooth_pulse_problem.jl | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/problem_templates/unitary_smooth_pulse_problem.jl b/src/problem_templates/unitary_smooth_pulse_problem.jl index 2a560f44..4062353b 100644 --- a/src/problem_templates/unitary_smooth_pulse_problem.jl +++ b/src/problem_templates/unitary_smooth_pulse_problem.jl @@ -73,6 +73,7 @@ function UnitarySmoothPulseProblem( unitary_integrator=UnitaryIntegrator, state_name::Symbol = :Ũ⃗, control_name::Symbol = :a, + time_name::Symbol = :t, timestep_name::Symbol = :Δt, init_trajectory::Union{NamedTrajectory, Nothing}=nothing, a_guess::Union{Matrix{Float64}, Nothing}=nothing, @@ -121,6 +122,11 @@ function UnitarySmoothPulseProblem( ) end + if typeof(system) == TimeDependentQuantumSystem + add_component!(traj, time_name, get_times(traj)) + update_bound!(traj, time_name, (0.0, Δt_max*T)) + end + # Objective J = UnitaryInfidelityObjective(goal, state_name, traj; Q=Q) @@ -138,12 +144,23 @@ function UnitarySmoothPulseProblem( J, constraints, piccolo_options, traj, state_name, timestep_name; state_leakage_indices=goal isa EmbeddedOperator ? get_leakage_indices(goal) : nothing ) - + integrators = [ - unitary_integrator(system, traj, state_name, control_name), DerivativeIntegrator(traj, control_name, control_names[2]), DerivativeIntegrator(traj, control_names[2], control_names[3]), ] + if typeof(system) == TimeDependentQuantumSystem + integrators = [ + TimeDependentUnitaryIntegrator(system, traj, state_name, control_name, time_name), + integrators..., + TimeIntegrator(traj, time_name) + ] + else + integrators = [ + unitary_integrator(system, traj, state_name, control_name), + integrators... + ] + end return DirectTrajOptProblem( traj,