Skip to content

Commit dec5adf

Browse files
[no ci] Differentiate tolerances between pure and mixed state dynamics
1 parent 7d58e46 commit dec5adf

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

src/time_evolution/lr_mesolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ function lr_mesolveProblem(
450450
p.Si .= pinv(Hermitian(p.S), atol = opt.atol_inv)
451451

452452
# Initialization of ODEProblem's kwargs
453-
default_values = (DEFAULT_ODE_SOLVER_OPTIONS..., saveat = [t_l[end]])
453+
default_values = (DEFAULT_ODE_ME_SOLVER_OPTIONS..., saveat = [t_l[end]])
454454
kwargs2 = merge(default_values, kwargs)
455455

456456
# Initialization of Callbacks

src/time_evolution/mcsolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function mcsolveProblem(
132132
T = Base.promote_eltype(H_eff_evo, ψ0)
133133

134134
# We disable the progress bar of the sesolveProblem because we use a global progress bar for all the trajectories
135-
default_values = (DEFAULT_ODE_SOLVER_OPTIONS..., progress_bar = Val(false))
135+
default_values = (DEFAULT_ODE_SE_MC_SOLVER_OPTIONS..., progress_bar = Val(false))
136136
kwargs2 = _merge_saveat(tlist, e_ops, default_values; kwargs...)
137137
kwargs3 = _generate_mcsolve_kwargs(ψ0, T, e_ops, tlist, c_ops, jump_callback, rng, kwargs2)
138138

src/time_evolution/mesolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function mesolveProblem(
7979
ρ0 = to_dense(_CType(T), mat2vec(ket2dm(ψ0).data)) # Convert it to dense vector with complex element type
8080
L = L_evo.data
8181

82-
kwargs2 = _merge_saveat(tlist, e_ops, DEFAULT_ODE_SOLVER_OPTIONS; kwargs...)
82+
kwargs2 = _merge_saveat(tlist, e_ops, DEFAULT_ODE_ME_SOLVER_OPTIONS; kwargs...)
8383
kwargs3 = _generate_se_me_kwargs(e_ops, makeVal(progress_bar), tlist, kwargs2, SaveFuncMESolve)
8484

8585
tspan = (tlist[1], tlist[end])

src/time_evolution/sesolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function sesolveProblem(
6969
ψ0 = to_dense(_CType(T), get_data(ψ0)) # Convert it to dense vector with complex element type
7070
U = H_evo.data
7171

72-
kwargs2 = _merge_saveat(tlist, e_ops, DEFAULT_ODE_SOLVER_OPTIONS; kwargs...)
72+
kwargs2 = _merge_saveat(tlist, e_ops, DEFAULT_ODE_SE_MC_SOLVER_OPTIONS; kwargs...)
7373
kwargs3 = _generate_se_me_kwargs(e_ops, makeVal(progress_bar), tlist, kwargs2, SaveFuncSESolve)
7474

7575
tspan = (tlist[1], tlist[end])

src/time_evolution/smesolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function smesolveProblem(
118118
end
119119
D = DiffusionOperator(D_l)
120120

121-
kwargs2 = _merge_saveat(tlist, e_ops, DEFAULT_SDE_SOLVER_OPTIONS; kwargs...)
121+
kwargs2 = _merge_saveat(tlist, e_ops, DEFAULT_SDE_ME_SOLVER_OPTIONS; kwargs...)
122122
kwargs3 = _generate_stochastic_kwargs(
123123
e_ops,
124124
sc_ops_list,

src/time_evolution/ssesolve.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function ssesolveProblem(
118118
D_l = map(op -> op + _ScalarOperator_e(op, -) * IdentityOperator(prod(dims)), sc_ops_evo_data)
119119
D = DiffusionOperator(D_l)
120120

121-
kwargs2 = _merge_saveat(tlist, e_ops, DEFAULT_SDE_SOLVER_OPTIONS; kwargs...)
121+
kwargs2 = _merge_saveat(tlist, e_ops, DEFAULT_SDE_SE_SOLVER_OPTIONS; kwargs...)
122122
kwargs3 = _generate_stochastic_kwargs(
123123
e_ops,
124124
sc_ops_list,

src/time_evolution/time_evolution.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ export TimeEvolutionSol, TimeEvolutionMCSol, TimeEvolutionStochasticSol
22

33
export liouvillian_floquet, liouvillian_generalized
44

5-
const DEFAULT_ODE_SOLVER_OPTIONS = (abstol = 1e-8, reltol = 1e-6, save_everystep = false, save_end = true)
6-
const DEFAULT_SDE_SOLVER_OPTIONS = (abstol = 1e-2, reltol = 1e-2, save_everystep = false, save_end = true)
5+
# Dynamics of density matrices generally support larger tolerances
6+
const DEFAULT_ODE_SE_MC_SOLVER_OPTIONS = (abstol = 1e-8, reltol = 1e-6, save_everystep = false, save_end = true)
7+
const DEFAULT_ODE_ME_SOLVER_OPTIONS = (abstol = 1e-7, reltol = 1e-5, save_everystep = false, save_end = true)
8+
const DEFAULT_SDE_SE_SOLVER_OPTIONS = (abstol = 5e-3, reltol = 1e-2, save_everystep = false, save_end = true)
9+
const DEFAULT_SDE_ME_SOLVER_OPTIONS = (abstol = 1e-2, reltol = 1e-2, save_everystep = false, save_end = true)
710
const COL_TIMES_WHICH_INIT_SIZE = 200
811

912
@doc raw"""

0 commit comments

Comments
 (0)