Skip to content

Commit

Permalink
Merge pull request #35 from albertomercurio/albertomercurio-patch-1
Browse files Browse the repository at this point in the history
Improved liouvillian definition
  • Loading branch information
albertomercurio authored Mar 26, 2024
2 parents 41dac0d + 2cca3f2 commit e19924e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/quantum_operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ function lindblad_dissipator(O::QuantumObject{<:AbstractArray{T},OperatorQuantum
return sprepost(O, O') - spre(Od_O, Id_cache) / 2 - spost(Od_O, Id_cache) / 2
end

# It is already a SuperOperator
lindblad_dissipator(O::QuantumObject{<:AbstractArray{T},SuperOperatorQuantumObject}, Id_cache) where {T} = O

@doc raw"""
destroy(N::Int)
Expand Down
8 changes: 5 additions & 3 deletions src/time_evolution/time_evolution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,17 @@ function liouvillian(H::QuantumObject{MT1,OpType1},
OpType1<:Union{OperatorQuantumObject,SuperOperatorQuantumObject},
OpType2<:Union{OperatorQuantumObject,SuperOperatorQuantumObject}}

L = isoper(H) ? -1im * (spre(H, Id_cache) - spost(H, Id_cache)) : H
L = liouvillian(H, Id_cache)
for c_op in c_ops
isoper(c_op) ? L += lindblad_dissipator(c_op, Id_cache) : L += c_op
L += lindblad_dissipator(c_op, Id_cache)
end
L
end

liouvillian(H::QuantumObject{MT1,OperatorQuantumObject}, Id_cache::Diagonal=I(prod(H.dims))) where {MT1<:AbstractMatrix} = -1im * (spre(H, Id_cache) - spost(H, Id_cache))

liouvillian(H::QuantumObject{MT1,SuperOperatorQuantumObject}, Id_cache::Diagonal) where {MT1<:AbstractMatrix} = H

# liouvillian(H::QuantumObject{<:AbstractArray{T},OpType}) where {T,OpType<:Union{OperatorQuantumObject,SuperOperatorQuantumObject}} = isoper(H) ? -1im * (spre(H) - spost(H)) : H

function liouvillian_floquet(L₀::QuantumObject{<:AbstractArray{T1},SuperOperatorQuantumObject},
Lₚ::QuantumObject{<:AbstractArray{T2},SuperOperatorQuantumObject},
Expand Down

0 comments on commit e19924e

Please sign in to comment.