Skip to content

Commit 841d02a

Browse files
Minor changes
1 parent 9c08921 commit 841d02a

File tree

4 files changed

+11
-19
lines changed

4 files changed

+11
-19
lines changed

src/qobj/quantum_object.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#=
22
This file defines the QuantumObject (Qobj) structure.
33
It also implements the fundamental functions in Julia standard library:
4+
- Base: show, real, imag, Vector, Matrix
45
- SparseArrays: sparse, nnz, nonzeros, rowvals, droptol!, dropzeros, dropzeros!, SparseVector, SparseMatrixCSC
56
=#
67

src/qobj/quantum_object_base.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
#=
2-
This file defines the AbstractQuantumObject structure, all the type structures for QuantumObject and fundamental functions in Julia standard library.
3-
Also support for fundamental functions in Julia standard library:
4-
- Base: show, length, size, eltype, getindex, setindex!, isequal, :(==), isapprox, Vector, Matrix
1+
#=
2+
This file defines the AbstractQuantumObject structure, all the type structures for AbstractQuantumObject, and fundamental functions in Julia standard library:
3+
- Base: show, length, size, eltype, getindex, setindex!, isequal, :(==), isapprox
54
=#
65

76
export AbstractQuantumObject

src/steadystate.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ function steadystate(
236236
}
237237
ftype = _FType(ψ0)
238238
cb = TerminateSteadyState(abstol, reltol, _steadystate_ode_condition)
239-
sol = mesolve(H, ψ0, [ftype(0), ftype(tmax)], c_ops, progress_bar = Val(false), callback = cb)
239+
sol = mesolve(H, ψ0, [ftype(0), ftype(tmax)], c_ops, progress_bar = Val(false), save_everystep=false, saveat=ftype[], callback = cb)
240240

241241
ρss = sol.states[end]
242242
return ρss

src/time_evolution/ssesolve.jl

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,19 @@ function _ssesolve_prob_func(prob, i, repeat)
4545
rng = traj_rng,
4646
)
4747

48-
noise_rate_prototype = similar(prob.u0, length(prob.u0), length(internal_params.sc_ops))
48+
# noise_rate_prototype = similar(prob.u0, length(prob.u0), length(internal_params.sc_ops))
4949

5050
prm = merge(
5151
internal_params,
5252
(
53+
K = deepcopy(internal_params.K),
54+
D = deepcopy(internal_params.D),
5355
expvals = similar(internal_params.expvals),
5456
progr = ProgressBar(size(internal_params.expvals, 2), enable = false),
5557
),
5658
)
5759

58-
return remake(prob, p = prm, noise = noise, noise_rate_prototype = noise_rate_prototype, seed = seed)
60+
return remake(prob, p = prm, noise = noise, seed = seed)
5961
end
6062

6163
# Standard output function
@@ -151,7 +153,6 @@ function ssesolveProblem(
151153
sc_ops::Union{Nothing,AbstractVector,Tuple} = nothing;
152154
alg::StochasticDiffEqAlgorithm = SRA1(),
153155
e_ops::Union{Nothing,AbstractVector,Tuple} = nothing,
154-
H_t::Union{Nothing,Function,TimeDependentOperatorSum} = nothing,
155156
params::NamedTuple = NamedTuple(),
156157
rng::AbstractRNG = default_rng(),
157158
kwargs...,
@@ -164,7 +165,7 @@ function ssesolveProblem(
164165
sc_ops isa Nothing &&
165166
throw(ArgumentError("The list of collapse operators must be provided. Use sesolveProblem instead."))
166167

167-
!(H_t isa Nothing) && throw(ArgumentError("Time-dependent Hamiltonians are not currently supported in ssesolve."))
168+
# !(H_t isa Nothing) && throw(ArgumentError("Time-dependent Hamiltonians are not currently supported in ssesolve."))
168169

169170
t_l = convert(Vector{Float64}, tlist) # Convert it into Float64 to avoid type instabilities for StochasticDiffEq.jl
170171

@@ -197,7 +198,6 @@ function ssesolveProblem(
197198
sc_ops = sc_ops2,
198199
expvals = expvals,
199200
Hdims = H.dims,
200-
H_t = H_t,
201201
times = t_l,
202202
is_empty_e_ops = is_empty_e_ops,
203203
params...,
@@ -230,7 +230,6 @@ end
230230
sc_ops::Union{Nothing,AbstractVector,Tuple} = nothing;
231231
alg::StochasticDiffEqAlgorithm=SRA1()
232232
e_ops::Union{Nothing,AbstractVector,Tuple} = nothing,
233-
H_t::Union{Nothing,Function,TimeDependentOperatorSum}=nothing,
234233
params::NamedTuple=NamedTuple(),
235234
rng::AbstractRNG=default_rng(),
236235
ntraj::Int=1,
@@ -269,7 +268,6 @@ Above, `C_n` is the `n`-th collapse operator and `dW_j(t)` is the real Wiener i
269268
- `sc_ops::Union{Nothing,AbstractVector,Tuple}=nothing`: List of stochastic collapse operators ``\{\hat{C}_n\}_n``.
270269
- `alg::StochasticDiffEqAlgorithm`: The algorithm used for the time evolution.
271270
- `e_ops::Union{Nothing,AbstractVector,Tuple}=nothing`: The list of operators to be evaluated during the evolution.
272-
- `H_t::Union{Nothing,Function,TimeDependentOperatorSum}`: The time-dependent Hamiltonian of the system. If `nothing`, the Hamiltonian is time-independent.
273271
- `params::NamedTuple`: The parameters of the system.
274272
- `rng::AbstractRNG`: The random number generator for reproducibility.
275273
- `ntraj::Int`: Number of trajectories to use.
@@ -298,7 +296,6 @@ function ssesolveEnsembleProblem(
298296
sc_ops::Union{Nothing,AbstractVector,Tuple} = nothing;
299297
alg::StochasticDiffEqAlgorithm = SRA1(),
300298
e_ops::Union{Nothing,AbstractVector,Tuple} = nothing,
301-
H_t::Union{Nothing,Function,TimeDependentOperatorSum} = nothing,
302299
params::NamedTuple = NamedTuple(),
303300
rng::AbstractRNG = default_rng(),
304301
ntraj::Int = 1,
@@ -329,13 +326,12 @@ function ssesolveEnsembleProblem(
329326
sc_ops;
330327
alg = alg,
331328
e_ops = e_ops,
332-
H_t = H_t,
333329
params = merge(params, (global_rng = rng, seeds = seeds)),
334330
rng = rng,
335331
kwargs...,
336332
)
337333

338-
ensemble_prob = EnsembleProblem(prob_sse, prob_func = prob_func, output_func = output_func, safetycopy = true)
334+
ensemble_prob = EnsembleProblem(prob_sse, prob_func = prob_func, output_func = output_func, safetycopy = false)
339335

340336
return ensemble_prob
341337
catch e
@@ -353,7 +349,6 @@ end
353349
sc_ops::Union{Nothing, AbstractVector}=nothing;
354350
alg::StochasticDiffEqAlgorithm=SRA1(),
355351
e_ops::Union{Nothing,AbstractVector,Tuple}=nothing,
356-
H_t::Union{Nothing,Function,TimeDependentOperatorSum}=nothing,
357352
params::NamedTuple=NamedTuple(),
358353
rng::AbstractRNG=default_rng(),
359354
ntraj::Int=1,
@@ -395,7 +390,6 @@ Above, `C_n` is the `n`-th collapse operator and `dW_j(t)` is the real Wiener i
395390
- `sc_ops::Union{Nothing,AbstractVector,Tuple}=nothing`: List of stochastic collapse operators ``\{\hat{C}_n\}_n``.
396391
- `alg::StochasticDiffEqAlgorithm`: Algorithm to use for the time evolution.
397392
- `e_ops::Union{Nothing,AbstractVector,Tuple}`: List of operators for which to calculate expectation values.
398-
- `H_t::Union{Nothing,Function,TimeDependentOperatorSum}`: Time-dependent part of the Hamiltonian.
399393
- `params::NamedTuple`: Dictionary of parameters to pass to the solver.
400394
- `rng::AbstractRNG`: Random number generator for reproducibility.
401395
- `ntraj::Int`: Number of trajectories to use.
@@ -425,7 +419,6 @@ function ssesolve(
425419
sc_ops::Union{Nothing,AbstractVector,Tuple} = nothing;
426420
alg::StochasticDiffEqAlgorithm = SRA1(),
427421
e_ops::Union{Nothing,AbstractVector,Tuple} = nothing,
428-
H_t::Union{Nothing,Function,TimeDependentOperatorSum} = nothing,
429422
params::NamedTuple = NamedTuple(),
430423
rng::AbstractRNG = default_rng(),
431424
ntraj::Int = 1,
@@ -448,7 +441,6 @@ function ssesolve(
448441
sc_ops;
449442
alg = alg,
450443
e_ops = e_ops,
451-
H_t = H_t,
452444
params = params,
453445
rng = rng,
454446
ntraj = ntraj,

0 commit comments

Comments
 (0)