Skip to content
2 changes: 1 addition & 1 deletion docs/src/users_guide/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Here, we list out each setting along with the specific functions that will use i

- `tidyup_tol::Float64 = 1e-14` : tolerance for [`tidyup`](@ref) and [`tidyup!`](@ref).
- `auto_tidyup::Bool = true` : Automatically tidyup during the following situations:
* Solving for eigenstates, including [`eigenstates`](@ref), [`eigsolve`](@ref), and [`eigsolve_al`](@ref).
* Solving for eigenstates, including [`eigenstates`](@ref), [`eigsolve`](@ref), [`eigsolve_al`](@ref), [`bloch_redfield_tensor`](@ref), [`brterm`](@ref) and [`brmesolve`](@ref).
- (to be announced)

## Change default settings
Expand Down
16 changes: 8 additions & 8 deletions src/time_evolution/brmesolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function bloch_redfield_tensor(
U = QuantumObject(rst.vectors, Operator(), H.dimensions)
sec_cutoff = float(sec_cutoff)

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

Expand Down Expand Up @@ -112,13 +112,6 @@ function _brterm(
ac_term = (A_mat .* spectrum) * A_mat
bd_term = A_mat * (A_mat .* trans(spectrum))

# Remove small values before passing in the Liouville space
if settings.auto_tidyup
tidyup!(A_mat)
tidyup!(ac_term)
tidyup!(bd_term)
end

if sec_cutoff != -1
m_cut = similar(skew)
map!(x -> abs(x) < sec_cutoff, m_cut, skew)
Expand All @@ -129,6 +122,13 @@ function _brterm(
M_cut = @. abs(vec_skew - vec_skew') < sec_cutoff
end

# Remove small values before passing in the Liouville space
if settings.auto_tidyup
tidyup!(A_mat)
tidyup!(ac_term)
tidyup!(bd_term)
end

out =
0.5 * (
+ _sprepost(A_mat .* trans(spectrum), A_mat) + _sprepost(A_mat, A_mat .* spectrum) - _spost(ac_term, Id) -
Expand Down
Loading