Skip to content

Commit 3d5a040

Browse files
Support time-dependent operators on dsf_mesolve
1 parent 3077816 commit 3d5a040

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/time_evolution/time_evolution_dynamical.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,10 @@ function _DSF_mesolve_Affect!(integrator)
332332
op_l2 = op_list .+ αt_list
333333
e_ops2 = e_ops(op_l2, dsf_params)
334334
_mesolve_callbacks_new_e_ops!(integrator, [_generate_mesolve_e_op(op) for op in e_ops2])
335-
# By doing this, we are assuming that the system is time-independent and f is a MatrixOperator
336-
copyto!(integrator.f.f.A, liouvillian(H(op_l2, dsf_params), c_ops(op_l2, dsf_params)).data)
335+
336+
# By doing this, we are assuming that all the arguments of ODEFunction are the default ones
337+
integrator.f =
338+
ODEFunction{true,FullSpecialize}(_mesolve_make_L_QobjEvo(H(op_l2, dsf_params), c_ops(op_l2, dsf_params)).data)
337339
return u_modified!(integrator, true)
338340
end
339341

@@ -360,9 +362,12 @@ function dsf_mesolveProblem(
360362

361363
αt_list = convert(Vector{T}, α0_l)
362364
op_l_vec = map(op -> mat2vec(get_data(op)'), op_list)
363-
# Create the Krylov subspace with kron(H₀.data, H₀.data) just for initialize
364-
expv_cache = arnoldi(kron(H₀.data, H₀.data), mat2vec(ket2dm(ψ0).data), krylov_dim)
365+
365366
dsf_identity = Eye(prod(H₀.dimensions))
367+
368+
# Create the Krylov subspace just for initialize
369+
expv_cache = arnoldi(kron(dsf_identity, dsf_identity), mat2vec(ket2dm(ψ0).data), krylov_dim)
370+
366371
dsf_displace_cache_left = sum(op -> ScalarOperator(one(T)) * MatrixOperator(kron(op.data, dsf_identity)), op_list)
367372
dsf_displace_cache_left_dag =
368373
sum(op -> ScalarOperator(one(T)) * MatrixOperator(kron(sparse(op.data'), dsf_identity)), op_list)

0 commit comments

Comments
 (0)