Skip to content

Commit d565a3b

Browse files
Better support to direct rotation in Hamiltonian space
1 parent 5e56876 commit d565a3b

File tree

1 file changed

+33
-20
lines changed

1 file changed

+33
-20
lines changed

src/time_evolution/brmesolve.jl

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,26 @@ function bloch_redfield_tensor(
3939

4040
H_new = getVal(fock_basis) ? H : QuantumObject(Diagonal(rst.values), Operator(), H.dimensions)
4141
c_ops_new = isnothing(c_ops) ? nothing : map(x -> getVal(fock_basis) ? x : U' * x * U, c_ops)
42-
R = liouvillian(H_new, c_ops_new)
42+
L0 = liouvillian(H_new, c_ops_new)
4343

44-
isempty(a_ops) || (R += sum(x -> _brterm(rst, x[1], x[2], sec_cutoff, fock_basis), a_ops))
44+
# Check whether we can rotate the terms to the eigenbasis directly in the Hamiltonian space
45+
fock_basis_hamiltonian = getVal(fock_basis) && sec_cutoff == -1
4546

47+
R = isempty(a_ops) ? 0 : sum(x -> _brterm(rst, x[1], x[2], sec_cutoff, fock_basis_hamiltonian), a_ops)
48+
49+
# If in fock basis, we need to transform the terms back to the fock basis
50+
# Note: we can transform the terms in the Hamiltonian space only if sec_cutoff is -1
51+
# otherwise, we need to use the SU superoperator below to transform the entire Liouvillian
52+
# at the end, due to the action of M_cut
4653
if getVal(fock_basis)
47-
return R
54+
if fock_basis_hamiltonian
55+
return L0 + R # Already rotated in the Hamiltonian space
56+
else
57+
SU = sprepost(U, U')
58+
return L0 + SU * R * SU'
59+
end
4860
else
49-
return R, U
61+
return L0 + R, U
5062
end
5163
end
5264

@@ -84,11 +96,21 @@ function brterm(
8496
fock_basis::Union{Bool,Val} = Val(false),
8597
)
8698
rst = eigenstates(H)
87-
term = _brterm(rst, a_op, spectra, sec_cutoff, makeVal(fock_basis))
99+
U = QuantumObject(rst.vectors, Operator(), H.dimensions)
100+
101+
# Check whether we can rotate the terms to the eigenbasis directly in the Hamiltonian space
102+
fock_basis_hamiltonian = getVal(fock_basis) && sec_cutoff == -1
103+
104+
term = _brterm(rst, a_op, spectra, sec_cutoff, fock_basis_hamiltonian)
88105
if getVal(fock_basis)
89-
return term
106+
if fock_basis_hamiltonian
107+
return term # Already rotated in the Hamiltonian space
108+
else
109+
SU = sprepost(U, U')
110+
return SU * term * SU'
111+
end
90112
else
91-
return term, Qobj(rst.vectors, Operator(), rst.dimensions)
113+
return term, U
92114
end
93115
end
94116

@@ -97,7 +119,7 @@ function _brterm(
97119
a_op::T,
98120
spectra::F,
99121
sec_cutoff::Real,
100-
fock_basis::Union{Bool,Val},
122+
fock_basis_hamiltonian::Union{Bool,Val},
101123
) where {T<:QuantumObject{Operator},F<:Function}
102124
_check_br_spectra(spectra)
103125

@@ -124,11 +146,8 @@ function _brterm(
124146
M_cut = @. abs(vec_skew - vec_skew') < sec_cutoff
125147
end
126148

127-
# If in fock basis, we need to transform the terms back to the fock basis
128-
# Note: we can transform the terms in the Hamiltonian space only if sec_cutoff is -1
129-
# otherwise, we need to use the SU superoperator below to transform the entire Liouvillian
130-
# due to the action of M_cut
131-
if getVal(fock_basis) && sec_cutoff == -1
149+
# Rotate the terms to the eigenbasis if possible
150+
if getVal(fock_basis_hamiltonian)
132151
A_mat = U * A_mat * U'
133152
A_mat_spec = U * A_mat_spec * U'
134153
A_mat_spec_t = U * A_mat_spec_t * U'
@@ -149,13 +168,7 @@ function _brterm(
149168

150169
(sec_cutoff != -1) && (out .*= M_cut)
151170

152-
# If sec_cutoff is not -1, we need to transform in the Liouville space
153-
if getVal(fock_basis) && sec_cutoff != -1
154-
SU = _sprepost(U, U')
155-
return QuantumObject(SU * out * SU', SuperOperator(), rst.dimensions)
156-
else
157-
return QuantumObject(out, SuperOperator(), rst.dimensions)
158-
end
171+
return QuantumObject(out, SuperOperator(), rst.dimensions)
159172
end
160173

161174
@doc raw"""

0 commit comments

Comments
 (0)