Skip to content

Commit

Permalink
semiclassical mcfw
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph committed Sep 10, 2019
1 parent 5be2ef0 commit 3ff637d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/mcwf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

"""
Expand Down
16 changes: 8 additions & 8 deletions src/semiclassical.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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; <keyword arguments>)
semiclassical.mcwf_dynamic(tspan, psi0, fquantum, fclassical, fjump_classical; <keyword arguments>)
Calculate MCWF trajectories coupled to a classical system.
Expand All @@ -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!
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down Expand Up @@ -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

0 comments on commit 3ff637d

Please sign in to comment.