From 3ff637d9c56af14281a7640d9aa2372582d96816 Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 10 Sep 2019 15:22:35 +0200 Subject: [PATCH] semiclassical mcfw --- src/mcwf.jl | 4 ++-- src/semiclassical.jl | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mcwf.jl b/src/mcwf.jl index f5a8d4ff..0aa57cf0 100644 --- a/src/mcwf.jl +++ b/src/mcwf.jl @@ -204,7 +204,7 @@ function dmcwf_h_dynamic(t::Float64, psi::T, f::Function, rates::DecayRates, H, J, Jdagger, rates_ = result end QO_CHECKS[] && check_mcwf(psi, H, J, Jdagger, rates_) - dmcwf_h(psi, H, J, Jdagger, dpsi, tmp, rates) + dmcwf_h(psi, H, J, Jdagger, dpsi, tmp, rates_) end function dmcwf_nh_dynamic(t::Float64, psi::T, f::Function, dpsi::T) where T<:Ket @@ -224,7 +224,7 @@ function jump_dynamic(rng, t::Float64, psi::T, f::Function, psi_new::T, rates::D else rates_ = result[4] end - jump(rng, t, psi, J, psi_new, rates) + jump(rng, t, psi, J, psi_new, rates_) end """ diff --git a/src/semiclassical.jl b/src/semiclassical.jl index 4e19d858..520aac31 100644 --- a/src/semiclassical.jl +++ b/src/semiclassical.jl @@ -120,9 +120,8 @@ function master_dynamic(tspan, state0::State{B,T}, fquantum, fclassical; kwargs. master_dynamic(tspan, dm(state0), fquantum, fclassical; kwargs...) end -############################### """ - semiclassical.mcwf_dynamic(tspan, state0, fquantum, fclassical, fjump_classical; ) + semiclassical.mcwf_dynamic(tspan, psi0, fquantum, fclassical, fjump_classical; ) Calculate MCWF trajectories coupled to a classical system. @@ -135,6 +134,9 @@ Calculate MCWF trajectories coupled to a classical system. * `fclassical`: Function `f(t, rho, u, du)` calculating the possibly time and state dependent derivative of the classical equations and storing it in the complex vector `du`. +* `fjump_classical`: Function `f(t, rho, u, i)` making a classical jump when a + quantum jump of the i-th jump operator occurs. + * `fout=nothing`: If given, this function `fout(t, state)` is called every time an output should be displayed. ATTENTION: The given state is not permanent! @@ -157,7 +159,6 @@ function mcwf_dynamic(tspan, psi0::State{B,T}, fquantum, fclassical, fjump_class dpsi = copy(psi0) integrate_mcwf(dmcwf_, j_, tspan_, psi, seed, fout; kwargs...) end -################################# function recast!(state::State{B,T,C}, x::C) where {B<:Basis,T<:QuantumState{B},C<:Vector{ComplexF64}} N = length(state.quantum) @@ -186,7 +187,6 @@ function dmaster_h_dynamic(t::Float64, state::State{B,T}, fquantum::Function, fclassical(t, state.quantum, state.classical, dstate.classical) end -################### function dmcwf_h_dynamic(t::Float64, psi::T, fquantum::Function, fclassical::Function, rates::DecayRates, dpsi::T, tmp::K) where {T,K} fquantum_(t, rho) = fquantum(t, psi.quantum, psi.classical) @@ -203,11 +203,11 @@ function jump_dynamic(rng, t::Float64, psi::T, fquantum::Function, fclassical::F else rates_ = result[4] end - i = jump(rng, t, psi.quantum, J, psi_new.quantum, rates) - fjump_classical(t, psi_new.quantum, psi_new.classical, i) + i = jump(rng, t, psi.quantum, J, psi_new.quantum, rates_) + fjump_classical(t, psi_new.quantum, psi.classical, i) + psi_new.classical .= psi.classical end -##########################hier weiter########################################################## function integrate_mcwf(dmcwf::Function, jumpfun::Function, tspan, psi0::T, seed, fout::Function; display_beforeevent=false, display_afterevent=false, @@ -317,5 +317,5 @@ function integrate_mcwf(dmcwf::Function, jumpfun::Function, tspan, end integrate_mcwf(dmcwf, jumpfun, tspan, psi0, seed, fout_; kwargs...) end -################### + end # module