System and SimulParameters
The two basic parts of any workflow are the structs System
and SimulParameters
. The former defines the dynamics and the latter the specifics of the simulation e.g. grid precision and number of trajectories.
BackAction.System
— TypeSystem(
NLEVELS::Int64, NCHANNELS::Int64, H::Matrix{ComplexF64}
Ls::Vector{Matrix{ComplexF64}}, J::Matrix{ComplexF64},
Heff::Matrix{ComplexF64})
A struct
that characterizes the dynamics via specification of the jump and hamiltonian operators.
Fields
NLEVELS::Int64
: Number of levels of the systemNCHANNELS::Int64
: Number of jump channelsH::Matrix{ComplexF64}
: HamiltonianLs::Vector{Matrix{ComplexF64}}
: List of jump operatorsJ::Matrix{ComplexF64}
: Sum of all the $L_k^{*}L_k$Heff::Matrix{ComplexF64}
: Effective Hamiltonian
Constructor
To create an instance it's enough to provide the hamiltonian and the jump operators in a vector. System(H::Matrix{ComplexF64}, Ls::Vector{Matrix{ComplexF64}})
BackAction.SimulParameters
— TypeSimulParameters(
psi0::Array{ComplexF64}, nsamples::Int64, seed::Int64,
ntraj::Int64, multiplier::Float64, tf::Float64,
dt::Float64, eps::Float64)
A struct
containing all the necessary information for running the the simulation.
Fields
psi0::Array{ComplexF64}
: Initial state, mixed or pure.nsamples::Int64
: Number of samples in the finegridseed::Int64
: seedntraj::Int64
: Number of trajectoriesmultiplier::Float64
: Multiplier to use in the fine gridtf::Float64
: Final timedt::Float64
: time step for the finegrideps::Float64
: Tolerance for passing WTD normalziation
Constructor
To create an instance it's enough to provide initial state, final time, seed and number of trajectories. Unless given nsamples, multiplier and eps use default values. SimulParameters(psi0::Vector{ComplexF64}, tf::Float64, s::Int64, ntraj::Int64, nsamples::Int64=10000, m::Float64=10.0, eps::Float64=1e-3)
About the multiplier
For the Gillipsie algorithm to work it's key to have a grid that's capable of resolving the statistical details of the WTD, this grid is taken in the interval (0, tf*multiplier)
.
Example
Below we give an example using the predefined Pauli matrices available in the package.
using BackAction
# Define the system
deltaomega = 1
gamma = 1
H = 0.5*deltaomega * BackAction.sigma_z # 2-level atom hamiltonian
L = sqrt(gamma) * BackAction.sigma_m # Jump operator for Radiative Damping
sys = System(H, [L])
psi0 = zeros(ComplexF64, 2)
psi0[2] = 1 # Initial condition
# Define the parameters
params = SimulParameters(psi0,
3.0, # Final time. Set very long so that all trajectories jump
1, # seed
1000, # Number of trajectories
50_000, # Number of samples in the finegrid
10.5, # Multiplier to use in the fine grid
1e-3 # Tolerance for passing Dark state test
)
print(sys, "\n\n")
print(params, "\n")
System(NLEVELS=2
NCHANNELS=1
H=ComplexF64[-0.5 + 0.0im 0.0 + 0.0im; 0.0 + 0.0im 0.5 + 0.0im]
Ls=Matrix{ComplexF64}[[0.0 + 0.0im 1.0 + 0.0im; 0.0 + 0.0im 0.0 + 0.0im]]
J=ComplexF64[0.0 + 0.0im 0.0 + 0.0im; 0.0 + 0.0im 1.0 + 0.0im])
Heff=ComplexF64[-0.5 + 0.0im 0.0 + 0.0im; 0.0 + 0.0im 0.5 - 0.5im])
SimulParameters(psi0=ComplexF64[0.0 + 0.0im, 1.0 + 0.0im]
nsamples=50000
seed=1
ntraj=1000)
multiplier=10.5
tf=3.0
dt=0.00063
eps=0.001)
The DetectionClick Struct
To implement the clicks, the struct DetectionClick
is used.
BackAction.DetectionClick
— TypeDetectionClick(time::Float64, label::Int64)
Inmutable struct
that represents the clicks by the time waited to see the click and the label of the channel in which it occured.
Fields
time::Float64
: Waiting timelabel::Int64
: Label of the channel of the click
BackAction.Trajectory
— TypeAlias for Vector{DetectionClick}