Skip to content

Commit

Permalink
Fix bug in MCWF display_afterevent
Browse files Browse the repository at this point in the history
  • Loading branch information
david-pl committed Mar 25, 2019
1 parent 8b370d9 commit 40d0231
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/mcwf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,14 @@ function integrate_mcwf(dmcwf::Function, jumpfun::Function, tspan,

recast!(x, psi_tmp)
jumpfun(rng, t, psi_tmp, tmp)
x .= tmp.data

if display_afterevent
affect!.saveiter += 1
copyat_or_push!(affect!.saved_values.t, affect!.saveiter, integrator.t)
copyat_or_push!(affect!.saved_values.saveval, affect!.saveiter,
affect!.save_func(integrator.u, integrator.t, integrator),Val{false})
end

x .= tmp.data
jumpnorm[] = rand(rng)
end

Expand Down
7 changes: 7 additions & 0 deletions test/test_timeevolution_mcwf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ for i=1:length(T)
@test tracedistance(ρt_master[i], ρ_average_3[i]) < 0.1
end

# Test displaying before/after jump
tout, Ψt = timeevolution.mcwf([T[1],T[end]], Ψ₀, Hdense, J1; seed=2, display_beforeevent=true, display_afterevent=true)
for i=2:length(tout)-1
if tout[i+1] == tout[i]
@test Ψt[i+1].data normalize(J1[1]*Ψt[i]).data
end
end

# Test equivalence to schroedinger time evolution for no decay
J = DenseOperator[]
Expand Down

0 comments on commit 40d0231

Please sign in to comment.