8484 # #
8585
8686 @test prob. prob. f. f isa ScaledOperator
87+ @test ! haskey (prob. prob. kwargs, :tstops ) # tstops should not exist for time-independent cases
8788 @test sum (abs .(sol. expect[1 , :] .- amp_rabi .* sin .(Ω_rabi * tlist) .^ 2 )) / length (tlist) < 0.1
8889 @test length (sol. times) == length (tlist)
8990 @test length (sol. times_states) == 1
223224 sol_me5 = mesolve (H, ψ0, tlist, progress_bar = Val (false ))
224225
225226 @test TESetup. prob_me. prob. f. f isa MatrixOperator
227+ @test ! haskey (TESetup. prob_me. prob. kwargs, :tstops ) # tstops should not exist for time-independent cases
226228 @test isket (sol_me5. states[1 ])
227229 @test length (sol_me. times) == length (tlist)
228230 @test length (sol_me. times_states) == 1
435437 expect_mc_states_mean2 = expect .(Ref (e_ops[1 ]), average_states (sol_mc_states2))
436438
437439 @test prob_mc. prob. f. f isa ScaledOperator
440+ @test ! haskey (prob_mc. prob. kwargs, :tstops ) # tstops should not exist for time-independent cases
438441 @test sum (abs, sol_mc. expect .- sol_me. expect) / length (tlist) < 0.1
439442 @test sum (abs, sol_mc2. expect .- sol_me. expect) / length (tlist) < 0.1
440443 @test sum (abs, average_expect (sol_mc3) .- sol_me. expect) / length (tlist) < 0.1
@@ -1206,11 +1209,11 @@ end
12061209
12071210@testitem " Example: Qubit driven by two sequential cosine pulses" begin
12081211 # settings of pulses
1209- T = 10 # duration of each pulse
12101212 A1 = rand () # Rabi amplitude of pulse 1
12111213 A2 = rand () # Rabi amplitude of pulse 2
12121214 t1 = 0 # starting time of pulse 1
12131215 t2 = 100 # starting time of pulse 2
1216+ T = 10 # duration of each pulse
12141217 pulse1 (p, t) = ((t1 <= t) && (t <= t1 + T)) ? (0.5 * p. A1 * π / T) * (1 - cos (2 π * (t - t1) / T)) : 0
12151218 pulse2 (p, t) = ((t2 <= t) && (t <= t2 + T)) ? (0.5 * p. A2 * π / T) * (1 - cos (2 π * (t - t2) / T)) : 0
12161219
@@ -1226,8 +1229,10 @@ end
12261229 tlist = range (0.0 , stop = 140.0 , length = 10000 ) # don't change tlist, to check the second pulse contribute correctly under 'tstops=tlist' setting
12271230 e_ops = [sigmax (), sigmaz ()]
12281231 params = (A1 = A1, A2 = A2)
1229- sol_se = sesolve (H, ψ0, tlist; e_ops = e_ops, params = params, progress_bar = Val (false ))
1230- sol_me = mesolve (H, ρ0, tlist; e_ops = e_ops, params = params, progress_bar = Val (false ))
1232+ prob_se = sesolveProblem (H, ψ0, tlist; e_ops = e_ops, params = params, progress_bar = Val (false ))
1233+ prob_me = mesolveProblem (H, ρ0, tlist; e_ops = e_ops, params = params, progress_bar = Val (false ))
1234+ sol_se = sesolve (prob_se)
1235+ sol_me = mesolve (prob_me)
12311236
12321237 # analytic solution
12331238 function θ (t, t_start, A)
@@ -1244,6 +1249,8 @@ end
12441249 X_analytic = sin .(θlist)
12451250 Z_analytic = cos .(θlist)
12461251
1252+ @test prob_se. prob. kwargs[:tstops ] == tlist # tstops should be equal to tlist for time-dependent cases
1253+ @test prob_me. prob. kwargs[:tstops ] == tlist # tstops should be equal to tlist for time-dependent cases
12471254 @test all (isapprox .(X_analytic, sol_se. expect[1 , :]; atol = 1e-6 ))
12481255 @test all (isapprox .(X_analytic, sol_me. expect[1 , :]; atol = 1e-6 ))
12491256 @test all (isapprox .(Z_analytic, sol_se. expect[2 , :]; atol = 1e-6 ))
0 commit comments