Skip to content

Commit

Permalink
Include link to arxiv
Browse files Browse the repository at this point in the history
Minor typo fixes in documentation and link to arxiv paper included. Also possible basis now include the SpinBasis when combining with wavegiudes.
  • Loading branch information
mabuni1998 committed Jan 9, 2025
1 parent 5d1c133 commit 26e3685
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 21 deletions.
3 changes: 3 additions & 0 deletions Examples/qo_singlephoton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ bw = WaveguideBasis(1,param.times)
a = destroy(bc)
ad = create(bc);
n = ad*a identityoperator(bw)

#$w†a and a†w efficient implementation$
wda = emission(bc,bw)
adw = absorption(bc,bw)
Expand All @@ -46,6 +47,8 @@ ref_sol = ξfun.(sol1.t,param.σ,param.t0)-sqrt(param.γ)*sol1
#Plot single photon waveguide state
ψ_single = OnePhotonView(ψ)/sqrt(dt)



fig,ax = subplots(1,1,figsize=(9,4.5))
ax.plot(param.times,abs.(ξvec).^2,"g-",label="Input pulse")
ax.plot(param.times,abs.(ψ_single).^2,"ro",label="δ = 0",fillstyle="none")
Expand Down
Binary file modified Examples/two_photon_contour.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

A Julia package for simulating quantum states of photon wavepackets using a discrete-time formalism [Phys. Rev. A 101, 042322](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.101.042322). The package works as an extension to [QuantumOptics.jl](https://qojulia.org/) where bases and operators from WaveguideQED.jl can be used together with operators and bases from QuantumOpics.jl.

### Citing
If you find the package usefull in your research. Please consider citing: [https://arxiv.org/abs/2412.13332](https://arxiv.org/abs/2412.13332).


### Example of usage:
Define a waveguide basis, containing a two-photon wavepacket for a time interval from 0 to 20 with timesteps of 0.2:

Expand Down Expand Up @@ -37,7 +41,7 @@ Finally, we can define an initial two-photon Gaussian wavepacket state with view

```julia
ξfun(t1,t2,σ1,σ2,t0) = sqrt(2/σ1) * (log(2)/pi)^(1/4)*exp(-2*log(2)*(t1-t0)^2/σ1^2)*sqrt(2/σ2)*(log(2)/pi)^(1/4)*exp(-2*log(2)*(t2-t0)^2/σ2^2)
ψ_cw = twophoton(bw,ξfun,1,1,5)
ψ_cw = twophoton(bw,ξfun,1,1,5)/sqrt(2)
psi = fockstate(bc,0) ψ_cw
dt = times[2] - times[1]
H = im*sqrt(1/dt)*(adw-wda)
Expand All @@ -50,7 +54,7 @@ Plotting the two-photon state is also simple:
```julia
ψ_double = TwoPhotonView(ψ);
using PyPlot
fig,ax = subplots(1,1,figsize=(9,4.5))
fig,ax = subplots(1,1,figsize=(4.5,4.5))
plot_twophoton!(ax,ψ_double,times)
```

Expand Down
Binary file added docs/src/illustrations/emitters_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

WaveguideQED.jl is a package for simulating continuous fockstates in waveguides. It expands on [`QuantumOptics.jl`](https://qojulia.org/) by adding a custom basis and operators for efficiently representing time-binned photon states.

## Citing
If you find the package usefull in your research. Please consider citing: [https://arxiv.org/abs/2412.13332](https://arxiv.org/abs/2412.13332).


## Dev docs
Added functionalities:
* [`WaveguideBasis`](@ref) for representing the waveguide Hilbert space and the related functions for generating states in this Hilbert space: [`zerophoton`](@ref), [`onephoton`](@ref), and [`twophoton`](@ref). Also see [`OnePhotonView`](@ref), [`TwoPhotonView`](@ref), and [`plot_twophoton!`](@ref) for viewing the waveguide states and plotting them. Note that [`WaveguideBasis`](@ref) can contain multiple waveguides.
Expand Down
6 changes: 3 additions & 3 deletions docs/src/multiplewaveguides_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ where `ψ_single_1` here denotes the state: $\ket{\psi}_1 = \sum_k \sqrt{\Delta
```@example multiple
ξ2(t1,t2,σ,t0) = ξ(t1,σ,t0)*ξ(t2,σ,t0)
w_idx = 1
ψ_double_1 = twophoton(bw,w_idx,ξ2,2,5)
ψ_double_1 = twophoton(bw,w_idx,ξ2,2,5)/sqrt(2)
w_idx = 2
ψ_double_2 = twophoton(bw,w_idx,ξ2,2,5)
ψ_double_2 = twophoton(bw,w_idx,ξ2,2,5)/sqrt(2)
nothing #hide
```

Expand Down Expand Up @@ -107,7 +107,7 @@ We can now study how single or two-photon states scatter on the emitter. We defi
w = 1
t0 = 5
ψ1 = fockstate(be,0) ⊗ onephoton(bw,1,ξ₁,w,t0)
ψ2 = fockstate(be,0) ⊗ twophoton(bw,1,ξ₂,w,t0)
ψ2 = fockstate(be,0) ⊗ twophoton(bw,1,ξ₂,w,t0)/sqrt(2)
ψScat1 = waveguide_evolution(times,ψ1,H)
ψScat2 = waveguide_evolution(times,ψ2,H)
nothing #hide
Expand Down
4 changes: 2 additions & 2 deletions docs/src/theoreticalbackground.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ If we want to create a two-photon Gaussian state, we instead do:
ξ(t,σ,t0) = sqrt(2/σ)* (log(2)/pi)^(1/4)*exp(-2*log(2)*(t-t0)^2/σ^2)
ξ2(t1,t2,σ,t0) = ξ(t1,σ,t0)*ξ(t2,σ,t0)
σ,t0 = 1,5
ψ = twophoton(bw,ξ2,σ,t0)
ψ = twophoton(bw,ξ2,σ,t0) / sqrt(2)
nothing #hide
```

Here, we defined the two-photon equivalent of our single-photon Gaussian state. When we visualize it, we now need two times, and we make a contour plot. This is easily done by viewing the two-photon state and using [`plot_twophoton!`](@ref):
Here, we defined the two-photon equivalent of our single-photon Gaussian state. Note the factor of $\sqrt{2}$ that is necessary for the state to be normalized. Alternatively, `twophoton(bw,ξ2,σ,t0;norm=true)` would return a normalized state. When we visualize it, we now need two times, and we make a contour plot. This is easily done by viewing the two-photon state and using [`plot_twophoton!`](@ref):

```@example theory
viewed_state = TwoPhotonView(ψ)
Expand Down
13 changes: 6 additions & 7 deletions docs/src/time_delay.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using WaveguideQED #hide
using QuantumOptics #hide
times = 0:0.1:11
dt = times[2]-times[1]
bw = WaveguideBasis(1,1,times)
bw = WaveguideBasis(1,times)
delay_time = 1
w_delayed = destroy(bw;delay=delay_time/dt)
Expand All @@ -39,7 +39,6 @@ The delayed operators are just normal WaveguideOperators addressing different ti

```@example timedelay
be = FockBasis(1)
bw = WaveguideBasis(1,1,times)
sdw_delayed = create(be) ⊗ w_delayed
wds_delayed = destroy(be) ⊗ wd_delayed
nothing #hide
Expand Down Expand Up @@ -81,7 +80,7 @@ nothing #hide
```@example timedelay
using PyPlot #hide
fig,ax = subplots(1,1,figsize=(9,4.5))
ax.plot(times,ne_pi,"r-")
ax.plot(times,real.(ne_pi),"r-")
ax.set_xlabel(L"time [$1/\gamma$]")
ax.set_ylabel("Population")
plt.tight_layout() #hide
Expand All @@ -105,9 +104,9 @@ This gives the plot:

```@example timedelay
fig,ax = subplots(1,1,figsize=(9,4.5))
ax.plot(times_sim,ne_pi[1:end-10],"r-",label=L"$\phi = \pi, \ \ \ \tau= 1$")
ax.plot(times_sim,ne_0,"b-",label=L"$\phi = 0, \ \ \ \tau= 1$")
ax.plot(times_sim,exp.(-times_sim),"k--",label=L"$\tau= \infty$")
ax.plot(times_sim,real.(ne_pi[1:end-10]),"r-",label=L"$\phi = \pi, \ \ \ \tau= 1$")
ax.plot(times_sim,real.(ne_0),"b-",label=L"$\phi = 0, \ \ \ \tau= 1$")
ax.plot(times_sim,real.(exp.(-times_sim)),"k--",label=L"$\tau= \infty$")
ax.set_xlabel(L"time [$1/\gamma$]")
ax.set_ylabel("Population")
ax.legend()
Expand All @@ -127,7 +126,7 @@ Another interesting configuration to investigate is two spatially seperated emit

An emission from emitter A thus arrives at emitter B via the waveguide after $\tau$ time and vice versa. We can represent this in the `Waveguide.jl` formalism as a looped conveyor belt, where the two emitters interact with the waveguide or conveyor belt at two different times/places. This is illustrated below:

![alt text](./illustrations/emitters_circle.svg)
![alt text](./illustrations/emitters_circle.png)

We can create such a loop by using delayed operators. This way, the two emitters interact with the same waveguide in different time bins. The waveguide operators, per default, loop around themselves, and thus, by placing the delayed emitter exactly in the middle of the waveguide state, we recreate the loop above. This is also illustrated here:

Expand Down
10 changes: 5 additions & 5 deletions docs/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ end
nothing #hide
```

Where `expect_waveguide(n_w,psi)` calculates the expectation value of all times of the pulse at each timestep: $\mathrm{expect_waveguide(n_w,psi)} = \bra{\psi} \sum_k I \otimes w_k^\dagger w_k \ket{\psi}$
Where `expect_waveguide(n_w,psi)` calculates the expectation value of all times of the pulse at each timestep: $\mathrm{expect\_waveguide(n_w,psi)} = \bra{\psi} \sum_k I \otimes w_k^\dagger w_k \ket{\psi}$

This can be plotted as:

```@example tutorial
fig,ax = subplots(1,1,figsize=(9,4.5))
ax.plot(times,na,"b-",label="na")
ax.plot(times,nw,"r-",label="nw")
ax.plot(times,nw+na,"g-",label="na+nw")
ax.plot(times,real.(na),"b-",label="na")
ax.plot(times,real.(nw),"r-",label="nw")
ax.plot(times,real.(nw+na),"g-",label="na+nw")
ax.set_xlabel("Time [a.u]")
ax.set_ylabel("Population")
ax.legend()
Expand Down Expand Up @@ -150,7 +150,7 @@ H_twophoton = im*sqrt(γ/dt)*( ad ⊗ w_twophoton - a ⊗ wd_twophoton )
nothing #hide
```

If we want an initial two-photon state, we instead use the function [`twophoton`](@ref) to create a two-photon state $\frac{1}{\sqrt{2}}\left[W^\dagger(\xi)\right]^2|0\rangle = \frac{1}{\sqrt{2}} \int_{t_0}^{t_{end}} d t^{\prime} \int_{t_0}^{t_{end}} d t \ \xi^{(2)}(t,t') w^\dagger(t) w^\dagger\left(t^{\prime}\right)|0\rangle $ (see [`Theoretical Background`](@ref theory) for details). In the following, we define the two-photon wavefunction $\xi^{(2)}(t,t') = \xi^{(1)}(t)\xi^{(1)}(t')$ which is thus a product state of two single-photons.
If we want an initial two-photon state, we instead use the function [`twophoton`](@ref) to create a two-photon state $\frac{1}{\sqrt{2}}\left[W^\dagger(\xi)\right]^2|0\rangle = \frac{1}{\sqrt{2}} \int_{t_0}^{t_{end}} d t^{\prime} \int_{t_0}^{t_{end}} d t \ \xi^{(2)}(t,t') w^\dagger(t) w^\dagger\left(t^{\prime}\right)|0\rangle $ (see [Theoretical Background](@ref theory) for details). In the following, we define the two-photon wavefunction $\xi^{(2)}(t,t') = \xi^{(1)}(t)\xi^{(1)}(t')$ which is thus a product state of two single-photons.

```@example tutorial
ξ2(t1,t2,σ,t0) = ξ(t1,σ,t0)*ξ(t2,σ,t0)
Expand Down
4 changes: 2 additions & 2 deletions src/basis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ end
Base.:(==)(b1::WaveguideBasis,b2::WaveguideBasis) = (b1.N==b2.N && b1.offset==b2.offset && b1.nsteps==b2.nsteps)

#Type unions to dispatch on.
const SingleWaveguideBasis{Np} = Union{CompositeBasis{Vector{Int64}, T},WaveguideBasis{Np,1}} where {T<:Tuple{Vararg{Union{NLevelBasis,FockBasis,WaveguideBasis{Np,1}}}},Np}
const SingleWaveguideBasis{Np} = Union{CompositeBasis{Vector{Int64}, T},WaveguideBasis{Np,1}} where {T<:Tuple{Vararg{Union{SpinBasis,NLevelBasis,FockBasis,WaveguideBasis{Np,1}}}},Np}
const SingleWaveguideKet = Ket{T, Vector{ComplexF64}} where T<:SingleWaveguideBasis
const MultipleWaveguideBasis{Np,Nw} = Union{CompositeBasis{Vector{Int64},T},WaveguideBasis{Np,Nw},WaveguideBasis{Np,Nw}} where {T<:Tuple{Vararg{Union{NLevelBasis,FockBasis,WaveguideBasis{Np,Nw}}}},Np,Nw}
const MultipleWaveguideBasis{Np,Nw} = Union{CompositeBasis{Vector{Int64},T},WaveguideBasis{Np,Nw},WaveguideBasis{Np,Nw}} where {T<:Tuple{Vararg{Union{SpinBasis,NLevelBasis,FockBasis,WaveguideBasis{Np,Nw}}}},Np,Nw}
const MultipleWaveguideKet = Ket{T, Vector{ComplexF64}} where T<:MultipleWaveguideBasis


Expand Down

0 comments on commit 26e3685

Please sign in to comment.