Skip to content

Commit 205d36f

Browse files
committed
generalize the definition of liouvillian
1 parent 7265598 commit 205d36f

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased](https://github.com/qutip/QuantumToolbox.jl/tree/main)
99

10+
- Generalize the definition of `liouvillian`. It no longer expects the Hamiltonian to be Hermitian. ([#581])
11+
1012
## [v0.38.1]
1113
Release date: 2025-10-27
1214

@@ -357,3 +359,4 @@ Release date: 2024-11-13
357359
[#575]: https://github.com/qutip/QuantumToolbox.jl/issues/575
358360
[#576]: https://github.com/qutip/QuantumToolbox.jl/issues/576
359361
[#579]: https://github.com/qutip/QuantumToolbox.jl/issues/579
362+
[#581]: https://github.com/qutip/QuantumToolbox.jl/issues/581

src/qobj/superoperators.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ end
4141

4242
## intrinsic liouvillian
4343
_liouvillian(H::MT, Id::AbstractMatrix) where {MT<:Union{AbstractMatrix,AbstractSciMLOperator}} =
44-
-1im * (_spre(H, Id) - _spost(H, Id))
44+
-1im * (_spre(H, Id) - _spost(H', Id))
4545
_liouvillian(H::MatrixOperator, Id::AbstractMatrix) = MatrixOperator(_liouvillian(H.A, Id))
46-
_liouvillian(H::ScaledOperator, Id::AbstractMatrix) = ScaledOperator(H.λ, _liouvillian(H.L, Id))
46+
_liouvillian(H::ScaledOperator, Id::AbstractMatrix) =
47+
-1im * (ScaledOperator(H.λ, _spre(H.L, Id)) - ScaledOperator(conj(H.λ), _spost(H.L', Id)))
4748
_liouvillian(H::AddedOperator, Id::AbstractMatrix) = AddedOperator(map(op -> _liouvillian(op, Id), H.ops))
4849

4950
# intrinsic lindblad_dissipator
@@ -144,7 +145,7 @@ lindblad_dissipator(O::AbstractQuantumObject{SuperOperator}, Id_cache = nothing)
144145
Construct the Liouvillian [`SuperOperator`](@ref) for a system Hamiltonian ``\hat{H}`` and a set of collapse operators ``\{\hat{C}_n\}_n``:
145146
146147
```math
147-
\mathcal{L} [\cdot] = -i[\hat{H}, \cdot] + \sum_n \mathcal{D}(\hat{C}_n) [\cdot]
148+
\mathcal{L} [\cdot] = -i\left(\hat{H}[\cdot] - [\cdot]\hat{H}^\dagger\right) + \sum_n \mathcal{D}(\hat{C}_n) [\cdot]
148149
```
149150
150151
where
@@ -179,4 +180,4 @@ liouvillian(H::AbstractQuantumObject{Operator}, Id_cache::Diagonal = I(prod(H.di
179180

180181
liouvillian(H::AbstractQuantumObject{SuperOperator}, Id_cache::Diagonal) = H
181182

182-
_sum_lindblad_dissipators(c_ops, Id_cache::Diagonal) = sum(op -> lindblad_dissipator(op, Id_cache), c_ops)
183+
_sum_lindblad_dissipators(c_ops, Id_cache::Diagonal) = sum(op -> lindblad_dissipator(op, Id_cache), c_ops; init = 0)

test/core-test/quantum_objects_evo.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
X = a * a'
208208
c_op1 = QobjEvo(a', coef1)
209209
c_op2 = QobjEvo(((a, coef2), (X, coef3)))
210-
c_ops = [c_op1, c_op2]
210+
c_ops = (c_op1, c_op2)
211211
D1_ti = abs2(coef1(p, t)) * lindblad_dissipator(a')
212212
D2_ti =
213213
abs2(coef2(p, t)) * lindblad_dissipator(a) + # normal dissipator for first element in c_op2
@@ -237,10 +237,9 @@
237237
@test_throws ArgumentError cache_operator(L_td, ψ)
238238

239239
@testset "Type Inference" begin
240-
# we use destroy and create here because they somehow causes type instability before
241-
H_td2 = H_td + QobjEvo(destroy(N) + create(N), coef3)
242-
c_ops1 = (destroy(N), create(N))
243-
c_ops2 = (destroy(N), QobjEvo(create(N), coef1))
240+
H_td2 = H_td + QobjEvo(a + a', coef3)
241+
c_ops1 = (a, a')
242+
c_ops2 = (a, QobjEvo(a', coef1))
244243

245244
@inferred liouvillian(H_td, c_ops1)
246245
@inferred liouvillian(H_td, c_ops2)

test/core-test/steady_state.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@
6464
H_td = (H, (H_t, coeff))
6565

6666
sol_me = mesolve(H_td, psi0, t_l, c_ops, e_ops = e_ops, progress_bar = Val(false))
67-
ρ_ss1 = steadystate_fourier(H, -1im * 0.5 * H_t, 1im * 0.5 * H_t, 1, c_ops, solver = SteadyStateLinearSolver())[1]
68-
ρ_ss2 =
69-
steadystate_fourier(H, -1im * 0.5 * H_t, 1im * 0.5 * H_t, 1, c_ops, solver = SSFloquetEffectiveLiouvillian())
67+
ρ_ss1 = steadystate_fourier(H, 0.5 * H_t, 0.5 * H_t, 1, c_ops, solver = SteadyStateLinearSolver())[1]
68+
ρ_ss2 = steadystate_fourier(H, 0.5 * H_t, 0.5 * H_t, 1, c_ops, solver = SSFloquetEffectiveLiouvillian())
7069

7170
@test abs(sum(sol_me.expect[1, (end-100):end]) / 101 - expect(e_ops[1], ρ_ss1)) < 1e-3
7271
@test abs(sum(sol_me.expect[1, (end-100):end]) / 101 - expect(e_ops[1], ρ_ss2)) < 1e-3

0 commit comments

Comments
 (0)