-
Notifications
You must be signed in to change notification settings - Fork 0
/
2023-05-18_harmonic_dynamics_R=26μm_ω=50πps.jl
328 lines (268 loc) · 7.42 KB
/
2023-05-18_harmonic_dynamics_R=26μm_ω=50πps.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# formats: ipynb,jl:light
# text_representation:
# extension: .jl
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.5
# kernelspec:
# display_name: Julia 1.8.5
# language: julia
# name: julia-1.8
# ---
# # Harmonic approximation
const 𝕚 = 1im;
const μm = 1;
const μs = 1;
const ns = 1e-3μs;
const cm = 1e4μm;
const met = 1e6μm;
const sec = 1e6μs;
const ms = 1e3μs;
const MHz = 2π;
const Dalton = 1.5746097504353806e+01;
const RUBIDIUM_MASS = 86.91Dalton;
const TAI_RADIUS = 25.46μm
const N_SITES = 8;
const OMEGA_TARGET = 50π / sec;
const EFFECTIVE_MASS = TAI_RADIUS^2 * RUBIDIUM_MASS;
const MOMENTUM_TARGET = - EFFECTIVE_MASS * OMEGA_TARGET;
const MOMENTUM_UNIT = EFFECTIVE_MASS * π / sec;
using Revise
using Plots: plot, plot!, vline!
includet("./include/rotating_tai.jl")
includet("./include/split_propagator.jl")
includet("./include/free_propagator.jl")
includet("./include/position_momentum_observables.jl")
includet("./include/propagate_scheme.jl")
# ## Ground state (nonadiabatic)
theta_grid = collect(range(0, 0.25π, length=1024));
Ψ0 = propagate_scheme(;
theta_grid,
ret=:initial_state,
direction=1,
omega_up=t->0.0,
omega_down=t->0.0,
omega_0=0.0,
t_r=150μs,
n_cycles=1,
potential_depth=0.2MHz,
mass=EFFECTIVE_MASS,
number_of_sites=N_SITES,
);
plot(abs2.(Ψ0))
"""Analytical ground state of harmonic potential"""
function psi_ho_groundstate(θ; θ₀=0.125π, V₀=2.2MHz, M=EFFECTIVE_MASS, m=N_SITES)
ω = sqrt(V₀ * m^2 / M)
a = 1 / sqrt(M * ω)
c = 1 / (π^(1/4) * sqrt(a))
Δθ = θ .- θ₀
Ψ = c * exp.(-Δθ.^2 ./ (2 * a^2))
return convert(Vector{ComplexF64}, Ψ)
end
Ψ_ho = psi_ho_groundstate(theta_grid);
# Note that the analytic ground state is normalized differently than the numberic ground state (integral normalization vs vector normalization)
plot(theta_grid ./ π, abs2.(Ψ_ho ./ norm(Ψ_ho));
label="Ψ (analytical)",
xlabel="θ (π)",
ylabel="amplitude",
xlim=(0.1, 0.14)
)
plot!(theta_grid ./ π, abs2.(Ψ0);
label="Ψ (numerical)",
)
plot(theta_grid ./ π, abs2.(Ψ_ho ./ norm(Ψ_ho)) .- abs2.(Ψ0 ./ norm(Ψ0));
label="ΔΨ",
xlabel="θ (π)",
ylabel="amplitude",
xlim=(0.1, 0.14)
)
1 - real((Ψ_ho ./ norm(Ψ_ho)) ⋅ Ψ0)
# ## Harmonic adiabatic evolution
# +
omega_ramp_up_adiabatic(t; w0=OMEGA_TARGET, t_r=0.1sec) = w0 * sin(π * t / (2t_r))^2;
omega_ramp_down_adiabatic(t; w0=OMEGA_TARGET, t_r=0.1sec) = w0 * cos(π * t / (2t_r))^2;
args_adiabatic = Dict{Symbol,Any}(
:theta_grid => theta_grid,
:potential_depth => 2.2MHz,
:omega_up => omega_ramp_up_adiabatic,
:omega_down => omega_ramp_down_adiabatic,
:omega_0 => OMEGA_TARGET,
:t_r => 0.1sec,
:n_cycles => 10,
:nt_free => 10000,
:model => :harmonic,
)
# +
frame=:lab
tlists, omega_vals, expvals_left, expvals_right = propagate_scheme(;
args_adiabatic...,
parallel=true,
ret=:expvals,
frame,
);
plot_full_pos_mom_dynamics(
tlists,
expvals_left, expvals_right;
show_standard_deviation=true,
frame
)
# +
frame=:moving
tlists, omega_vals, expvals_left, expvals_right = propagate_scheme(;
args_adiabatic...,
parallel=true,
ret=:expvals,
frame,
);
plot_full_pos_mom_dynamics(
tlists,
expvals_left, expvals_right;
show_standard_deviation=false,
frame
)
# +
frame=:mixed
tlists, omega_vals, expvals_left, expvals_right = propagate_scheme(;
args_adiabatic...,
parallel=true,
ret=:expvals,
frame,
);
plot_full_pos_mom_dynamics(
tlists,
expvals_left, expvals_right;
show_standard_deviation=false,
frame
)
# -
# ### Response to Ω ≠ 0
using QuantumControlBase: @threadsif
"""Evaluate the final "right" population depending on Ω."""
function scan_signal(; parallel=1, n_samples=21, n_cycles=2, Ω_max = (0.5 / n_cycles) / sec, kwargs...)
if parallel ≡ true
parallel=1
end
Ω_vals = collect(range(0, Ω_max; length=n_samples))
P_vals = zeros(n_samples)
@threadsif (parallel ≥ 1) for i=1:n_samples
P_vals[i] = propagate_scheme(;
Ω=Ω_vals[i],
n_cycles,
parallel=(parallel ≥ 2),
ret=:P_right,
kwargs...
)
end
return Ω_vals, P_vals
end
Ω_vals, P_vals = scan_signal(;
args_adiabatic...,
parallel=2,
);
function sagnac_phase(Ω, ; Φ, R=TAI_RADIUS, M=RUBIDIUM_MASS)
A = (R^2 / 2) * Φ
return 4 * M * Ω * A
end
function angular_displacement(omega_vals, tlists)
dt(tlist) = tlist[2] - tlist[1]
Φ = sum(omega_vals[1]) * dt(tlists[1])
Φ += sum(omega_vals[2]) * dt(tlists[2])
Φ += sum(omega_vals[3]) * dt(tlists[3])
return Φ
end
Φ = angular_displacement(omega_vals, tlists);
Φ ./ π
function sagnac_population(
Φ,
Ω_vals;
R=TAI_RADIUS,
M=RUBIDIUM_MASS,
)
ΔΦ = sagnac_phase.(Ω_vals; Φ, R, M)
return cos.(ΔΦ / 2) .^ 2
end
plot(Ω_vals / (π/sec), P_vals; label="Observed", xlabel="Ω (π/sec)", ylabel="population (right)")
plot!(Ω_vals / (π/sec), sagnac_population(Φ, Ω_vals); linestyle=:dash, label="Sagnac", xlabel="Ω (π/sec)", ylabel="population (right)")
# ## Harmonic non-adiabatic evolution
# +
omega_ramp_up_nonadiabatic(t; w0=OMEGA_TARGET, t_r=150μs) = w0 * sin(π * t / (2t_r))^2;
omega_ramp_down_nonadiabatic(t; w0=OMEGA_TARGET, t_r=150μs) = w0 * cos(π * t / (2t_r))^2;
args_nonadiabatic = Dict{Symbol,Any}(
:theta_grid => theta_grid,
:potential_depth => 0.2MHz,
:omega_up => omega_ramp_up_nonadiabatic,
:omega_down => omega_ramp_down_nonadiabatic,
:omega_0 => OMEGA_TARGET,
:t_r => 150μs,
:n_cycles => 10,
:nt_free => 10000,
:model => :harmonic,
)
# +
frame=:lab
tlists, omega_vals, expvals_left, expvals_right = propagate_scheme(;
args_nonadiabatic...,
parallel=true,
ret=:expvals,
frame,
);
plot_full_pos_mom_dynamics(
tlists,
expvals_left, expvals_right;
show_standard_deviation=true,
frame
)
# +
frame=:moving
tlists, omega_vals, expvals_left, expvals_right = propagate_scheme(;
args_nonadiabatic...,
parallel=true,
ret=:expvals,
frame,
);
plot_full_pos_mom_dynamics(
tlists,
expvals_left, expvals_right;
show_standard_deviation=false,
frame
)
# -
# Compare these with the expected oscillation period:
ωₕ = sqrt(0.2MHz * N_SITES^2 / EFFECTIVE_MASS)
# This corresponds to oscillations on the time scale of:
(2π / ωₕ) / ms
plot(tlists[2] ./ ms, expvals_left[2][1,:] .- 0.125π)
plot!(tlists[2] ./ ms, 0.004 .* sin.(ωₕ .* tlists[2]))
# Zooming in on the first two ms:
plot!(;xlim=(0,2))
function get_spectrum(signal, tlist)
dt = tlist[2] - tlist[1]
N = length(tlist)
fs = 2π / dt
freqs = collect(fftshift(fftfreq(N, fs)))
spectrum = abs2.(fftshift(fft(signal)))
return freqs, spectrum
end
θ_freqs, θ_spectrum = get_spectrum(expvals_left[2][1,:] .- 0.125π, tlists[2]);
#θ_freqs, θ_spectrum = get_spectrum(sin.(ωₕ .* tlists[2]), tlists[2]);
plot(θ_freqs, θ_spectrum; marker=true, label="spectrum")
vline!([ωₕ,]; label="ωₕ", xlim=(0, 2ωₕ))
# +
frame=:mixed
tlists, omega_vals, expvals_left, expvals_right = propagate_scheme(;
args_nonadiabatic...,
parallel=true,
ret=:expvals,
frame,
);
plot_full_pos_mom_dynamics(
tlists,
expvals_left, expvals_right;
show_standard_deviation=false,
frame
)
# -