diff --git a/Project.toml b/Project.toml index 8f9ae8e7..dd7209f0 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "QuantumOptics" uuid = "6e0679c1-51ea-5a7c-ac74-d61b76210b0c" -version = "1.0.15" +version = "1.0.16" [deps] Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97" diff --git a/src/QuantumOptics.jl b/src/QuantumOptics.jl index 5f6dbfbd..ed9e5b37 100644 --- a/src/QuantumOptics.jl +++ b/src/QuantumOptics.jl @@ -37,6 +37,7 @@ end include("timecorrelations.jl") include("spectralanalysis.jl") include("semiclassical.jl") +include("debug.jl") module stochastic include("stochastic_base.jl") include("stochastic_definitions.jl") diff --git a/src/debug.jl b/src/debug.jl new file mode 100644 index 00000000..c77bae95 --- /dev/null +++ b/src/debug.jl @@ -0,0 +1,21 @@ +function __init__() + if isdefined(Base.Experimental, :register_error_hint) + Base.Experimental.register_error_hint(MethodError) do io, exc, argtypes, kwargs + if (exc.f == timeevolution.master) && (length(argtypes) >= 3) + # Check if the given Hamiltonian is constant. + if !(QuantumOpticsBase.is_const(exc.args[3])) + printstyled(io, "\nHint", color=:green) + print(io, ": You are attempting to use a time-dependent Hamiltonian with a solver that assumes constant dynamics. To avoid errors, please use the dynamic solvers instead, e.g. `master_dynamic` instead of `master`.") + end + end + + if (exc.f == timeevolution.schroedinger) && (length(argtypes) >= 3) + # Check if the given Hamiltonian is constant. + if !(QuantumOpticsBase.is_const(exc.args[3])) + printstyled(io, "\nHint", color=:green) + print(io, ": You are attempting to use a time-dependent Hamiltonian with a solver that assumes constant dynamics. To avoid errors, please use the dynamic solvers instead, e.g. `schroedinger_dynamic` instead of `schroedinger`.") + end + end + end + end +end \ No newline at end of file diff --git a/src/master.jl b/src/master.jl index f3fc3e8a..2e5070a5 100644 --- a/src/master.jl +++ b/src/master.jl @@ -115,6 +115,8 @@ Time-evolution according to a master equation with a Liouvillian superoperator ` permanent! It is still in use by the ode solver and therefore must not be changed. * `kwargs...`: Further arguments are passed on to the ode solver. + +See also: [`master_dynamic`](@ref) """ function master(tspan, rho0::Operator, L::SuperOperator; fout=nothing, kwargs...) # Rewrite rho as Ket and L as Operator