Skip to content

Commit

Permalink
Doc update and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mabuni1998 committed Jul 31, 2024
1 parent 4b4273d commit 6d44c24
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 32 deletions.
6 changes: 3 additions & 3 deletions docs/src/illustrations/emitters_delay_box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions docs/src/time_delay.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ using WaveguideQED #hide
using LinearAlgebra #hide
using PyPlot #hide
tau = 5
dt = 0.05
tau = 10
dt = 0.1
times = 0:dt:2*tau+dt
bw = WaveguideBasis(1, times) #waveguide basis
be = FockBasis(1) #emitter basis
Expand All @@ -162,9 +162,9 @@ nothing #hide
We can then create the Hamiltonian, where emitter A interacts with the not-delayed operators and emitter B with the delayed operators. We also create the expectation value operators here:

```@example twoemitters
γ = 5
H_e1 = im*sqrt(γ/dt/2)*(sd⊗Ie⊗w - s⊗Ie⊗wd)
H_e2 = im*sqrt(γ/dt/2)*(Ie⊗sd⊗w_tau - Ie⊗s⊗wd_tau)
γ = 1
H_e1 = im*sqrt(γ/dt)*(sd⊗Ie⊗w - s⊗Ie⊗wd)
H_e2 = im*sqrt(γ/dt)*(Ie⊗sd⊗w_tau - Ie⊗s⊗wd_tau)
H = H_e1 + H_e2
ne_a = (sd*s)⊗Ie⊗Iw
Expand All @@ -187,7 +187,7 @@ fig,ax = subplots(1,1,figsize=(9,4.5))
ax.plot(times_sim, abs.(e1), label="Emitter A")
ax.plot(times_sim, abs.(e2), label="Emitter B")
ax.plot(times_sim, abs.(ew), label="Waveguide")
ax.set_xlabel("Time")
ax.set_xlabel(L"Time [$1/\gamma$]")
ax.set_ylabel("Population")
tight_layout()
ax.legend()
Expand All @@ -206,7 +206,7 @@ fig,ax = subplots(1,1,figsize=(9,4.5))
ax.plot(times_sim, abs.(e1), label="Emitter A")
ax.plot(times_sim, abs.(e2), label="Emitter B")
ax.plot(times_sim, abs.(ew), label="Waveguide")
ax.set_xlabel("Time")
ax.set_xlabel(L"Time [$1/\gamma$]")
ax.set_ylabel("Expectation Value")
tight_layout()
ax.legend()
Expand Down Expand Up @@ -234,9 +234,9 @@ function expval(time, psi) #hide
  expect(ne_a, psi), expect(ne_b, psi), expect_waveguide(nw, psi) #hide
end #hide
γ = 2
H_e1 = im*sqrt(γ/dt/2)*(sd⊗Ie⊗w - s⊗Ie⊗wd)
H_e2 = im*sqrt(γ/dt/4)*(Ie⊗sd⊗w_tau - Ie⊗s⊗wd_tau)
γ = 1
H_e1 = im*sqrt(γ/dt)*(sd⊗Ie⊗w - s⊗Ie⊗wd)
H_e2 = im*sqrt(γ/dt/2)*(Ie⊗sd⊗w_tau - Ie⊗s⊗wd_tau)
H = H_e1 + H_e2
Expand All @@ -248,7 +248,7 @@ fig,ax = subplots(1,1,figsize=(9,4.5))
ax.plot(times_sim, abs.(e1), label="Emitter A")
ax.plot(times_sim, abs.(e2), label="Emitter B")
ax.plot(times_sim, abs.(ew), label="Waveguide")
ax.set_xlabel("Time")
ax.set_xlabel(L"Time [$1/\gamma$]")
ax.set_ylabel("Expectation Value")
tight_layout()
ax.legend()
Expand Down
24 changes: 6 additions & 18 deletions src/WaveguideOperator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,7 @@ function waveguide_mul!(result,a::WaveguideDestroy{B,B,1,idx},b,alpha,beta) wher
end
nsteps = a.basis_l.nsteps
timeindex = (a.timeindex + a.delay -1) % (nsteps) +1
if timeindex == 0 || timeindex > nsteps
timeindex = 1
end

@inbounds result[1] += alpha*a.factor*b[timeindex+(idx-1)*nsteps+1]
return
end
Expand All @@ -356,9 +354,7 @@ function waveguide_mul!(result,a::WaveguideDestroy{B,B,2,1},b,alpha,beta) where
end
nsteps = a.basis_l.nsteps
timeindex = (a.timeindex + a.delay -1) % (nsteps) +1
if timeindex == 0 || timeindex > nsteps
timeindex = 1
end

@inbounds result[1] += alpha*a.factor*b[timeindex+1]
#twophotonview = TwoPhotonTimestepView(b,timeindex,nsteps,nsteps+1)
#axpy!(alpha*a.factor,twophotonview,view(result,2:1:nsteps+1))
Expand All @@ -374,9 +370,7 @@ function waveguide_mul!(result,a::WaveguideDestroy{B,B,2,idx},b,alpha,beta) wher
end
nsteps = a.basis_l.nsteps
timeindex = (a.timeindex + a.delay -1) % (nsteps) +1
if timeindex == 0 || timeindex > nsteps
timeindex = 1
end

Nw = get_number_of_waveguides(a.basis_l)
@inbounds result[1] += alpha*a.factor*b[timeindex+(idx-1)*a.basis_l.nsteps+1]
#twophotonview = TwoPhotonTimestepView(b,timeindex,nsteps,Nw*nsteps+1+(idx-1)*(nsteps*(nsteps+1))÷2)
Expand All @@ -402,9 +396,7 @@ function waveguide_mul!(result,a::WaveguideCreate{B,B,1,idx},b,alpha,beta) where
end
nsteps = a.basis_l.nsteps
timeindex = (a.timeindex + a.delay -1) % (nsteps) +1
if timeindex == 0 || timeindex > nsteps
timeindex = 1
end

@inbounds result[timeindex+(idx-1)*nsteps+1] += alpha*a.factor*b[1]
return
end
Expand All @@ -417,9 +409,7 @@ function waveguide_mul!(result,a::WaveguideCreate{B,B,2,1},b,alpha,beta) where {
end
nsteps = a.basis_l.nsteps
timeindex = (a.timeindex + a.delay -1) % (nsteps) +1
if timeindex == 0 || timeindex > nsteps
timeindex = 1
end

@inbounds result[timeindex+1] += alpha*a.factor*b[1]
#twophotonview = TwoPhotonTimestepView(result,timeindex,nsteps,nsteps+1)
#axpy!(alpha*a.factor,view(b,2:1:nsteps+1),twophotonview)
Expand All @@ -435,9 +425,7 @@ function waveguide_mul!(result,a::WaveguideCreate{B,B,2,idx},b,alpha,beta) where
end
nsteps = a.basis_l.nsteps
timeindex = (a.timeindex + a.delay -1) % (nsteps) +1
if timeindex == 0 || timeindex > nsteps
timeindex = 1
end

Nw = get_number_of_waveguides(a.basis_l)
@inbounds result[timeindex+(idx-1)*a.basis_l.nsteps+1] += alpha*a.factor*b[1]
#twophotonview = TwoPhotonTimestepView(result,timeindex,nsteps,Nw*nsteps+1+(idx-1)*(nsteps*(nsteps+1))÷2)
Expand Down

0 comments on commit 6d44c24

Please sign in to comment.