19
19
# Let's start by importing the required libraries:
20
20
21
21
using Bloqade
22
- using PythonCall
22
+ using Bloqade . CairoMakie
23
23
using KrylovKit
24
24
using SparseArrays
25
25
26
- plt = pyimport (" matplotlib.pyplot" );
27
-
28
26
# # Ground State Properties
29
27
30
28
# We start by probing the ground state properties of the Rydberg Hamiltonian in a 1D system.
59
57
60
58
# To compare, we first plot the density profile when ``\Delta= -2π \times 10`` MHz:
61
59
62
- fig, ax = plt. subplots (figsize = (10 , 4 ))
63
- ax. bar (1 : nsites, density_g[1 , :])
64
- ax. set_xticks (1 : nsites)
65
- ax. set_xlabel (" Sites" )
66
- ax. set_ylabel (" Rydberg density" )
67
- ax. set_title (" Density Profile: 1D Chain, Δ = -2π * 10 MHz" )
60
+ fig = Figure (size= (800 , 320 ))
61
+ ax = Axis (fig[1 , 1 ], xlabel = " Sites" , ylabel = " Rydberg density" , title = " Density Profile: 1D Chain, Δ = -2π * 10 MHz" , xticks = 1 : nsites)
62
+ barplot! (ax, 1 : nsites, density_g[1 , :])
68
63
fig
69
64
70
65
# We can see that the Rydberg densities in this case are close to 0 for all sites. In contrast, for ``\Delta= 2π \times 10`` MHz, the density shows a clear ``Z_2`` ordered profile:
71
- fig, ax = plt. subplots (figsize = (10 , 4 ))
72
- ax. bar (1 : nsites, density_g[30 , :])
73
- ax. set_xticks (1 : nsites)
74
- ax. set_xlabel (" Sites" )
75
- ax. set_ylabel (" Rydberg density" )
76
- ax. set_title (" Density Profile: 1D Chain, Δ = 2π * 10 MHz" )
66
+ fig = Figure (size= (800 , 320 ))
67
+ ax = Axis (fig[1 , 1 ], xlabel = " Sites" , ylabel = " Rydberg density" , title = " Density Profile: 1D Chain, Δ = 2π * 10 MHz" , xticks = 1 : nsites)
68
+ barplot! (ax, 1 : nsites, density_g[30 , :])
77
69
fig
78
70
79
71
# More generally, we can plot an order parameter as a function of ``\Delta`` to clearly see the onset of phase transition.
@@ -83,13 +75,10 @@ order_para = map(1:Δ_step) do ii
83
75
return sum (density_g[ii, 1 : 2 : nsites]) - sum (density_g[ii, 2 : 2 : nsites]) # density on odd sites - density on even sites
84
76
end
85
77
86
- fig, ax = plt. subplots (figsize = (10 , 4 ))
87
- ax. plot (Δ / 2 π, order_para)
88
- ax. set_xlabel (" Δ/2π (MHz) " )
89
- ax. set_ylabel (" Order parameter" )
78
+ fig = Figure (size= (800 , 320 ))
79
+ ax = Axis (fig[1 , 1 ], xlabel = " Δ/2π (MHz)" , ylabel = " Order parameter" )
80
+ lines! (ax, Δ / (2 π), order_para)
90
81
fig
91
-
92
- # From the density profile of ground states and the change in the order parameter, we can observe a phase transition with changing ``\Delta``.
93
82
# Below, we show that by slowly changing the parameters of the Hamiltonian, we can follow the trajectory of the ground states and adiabatically evolve the atoms from the ground state to the ``Z_2``
94
83
# ordered state.
95
84
@@ -106,13 +95,12 @@ U2 = 2π * 10;
106
95
Δ = piecewise_linear (clocks = [0.0 , 0.6 , 2.1 , total_time], values = [U1, U1, U2, U2]);
107
96
108
97
# We plot the two waveforms:
109
- fig, (ax1, ax2) = plt . subplots (ncols = 2 , figsize = ( 12 , 4 ))
110
- Bloqade . plot! ( ax1, Ω )
111
- ax1 . set_ylabel ( " Ω /2π (MHz)" )
112
- Bloqade. plot! (ax2, Δ )
113
- ax2 . set_ylabel ( " Δ/2π (MHz) " )
98
+ fig = Figure (size = ( 960 , 320 ))
99
+ ax1 = Axis (fig[ 1 , 1 ], ylabel = " Ω/2π (MHz) " )
100
+ ax2 = Axis (fig[ 1 , 2 ], ylabel = " Δ /2π (MHz)" )
101
+ Bloqade. plot! (ax1, Ω / ( 2 π) )
102
+ Bloqade . plot! (ax2, Δ / ( 2 π) )
114
103
fig
115
-
116
104
# We generate the positions for a 1D atomic chain again:
117
105
118
106
nsites = 9
@@ -136,19 +124,13 @@ densities = []
136
124
for _ in TimeChoiceIterator (integrator, 0.0 : 1e-3 : total_time)
137
125
push! (densities, rydberg_density (reg))
138
126
end
139
- D = hcat (densities... );
140
-
141
- # and finally plot the time-dependent dynamics of Rydberg density for each site:
142
- fig, ax = plt. subplots (figsize = (10 , 4 ))
143
- shw = ax. imshow (real (D), interpolation = " nearest" , aspect = " auto" , extent = [0 , total_time, 0.5 , nsites + 0.5 ])
144
- ax. set_xlabel (" time (μs)" )
145
- ax. set_ylabel (" site" )
146
- ax. set_xticks (0 : 0.2 : total_time)
147
- ax. set_yticks (1 : nsites)
148
- bar = fig. colorbar (shw)
149
- fig
127
+ D = hcat (densities... )' ;
150
128
151
- # We can clearly see that a ``Z_2`` ordered state has been generated by the specified adiabatic pulse sequence.
129
+ fig = Figure (size= (800 , 320 ))
130
+ ax = Axis (fig[1 , 1 ], xlabel = " time (μs)" , ylabel = " site" , xticks= 0 : 0.2 : total_time, yticks= (0.5 : 1 : nsites, string .(1 : nsites)))
131
+ shw = heatmap! (ax, LinRange (0.0 , total_time, size (D, 1 )), LinRange (0.5 , nsites - 0.5 , size (D, 2 )), real (D))
132
+ Colorbar (fig[1 , 2 ], shw, label = " Rydberg density" )
133
+ fig
152
134
# We can also confirm it by plotting the bitstring distribution at the final time step:
153
135
154
136
bitstring_hist (reg; nlargest = 20 )
@@ -194,11 +176,11 @@ total_time = 2.9
194
176
U = 2 π * 15.0
195
177
Δ = piecewise_linear (clocks = [0.0 , 0.3 , 2.6 , total_time], values = [- U, - U, U, U]);
196
178
197
- fig, (ax1, ax2) = plt. subplots (ncols = 2 , figsize = (10 , 4 ))
179
+ fig = Figure (size= (800 , 320 ))
180
+ ax1 = Axis (fig[1 , 1 ], ylabel = " Ω/2π (MHz)" )
181
+ ax2 = Axis (fig[1 , 2 ], ylabel = " Δ/2π (MHz)" )
198
182
Bloqade. plot! (ax1, Ω)
199
- ax1. set_ylabel (" Ω/2π (MHz)" )
200
183
Bloqade. plot! (ax2, Δ)
201
- ax2. set_ylabel (" Δ/2π (MHz)" )
202
184
fig
203
185
204
186
# Then, we use the waveforms and atom positions to create a Hamiltonian and define a time evolution problem:
@@ -213,13 +195,10 @@ densities = [];
213
195
for _ in TimeChoiceIterator (integrator, 0.0 : 1e-3 : total_time)
214
196
push! (densities, rydberg_density (reg))
215
197
end
216
- D = hcat (densities... )
217
-
218
- fig, ax = plt. subplots (figsize = (10 , 4 ))
219
- shw = ax. imshow (real (D), interpolation = " nearest" , aspect = " auto" , extent = [0 , total_time, 0.5 , nsites + 0.5 ])
220
- ax. set_xlabel (" time (μs)" )
221
- ax. set_ylabel (" site" )
222
- ax. set_xticks (0 : 0.2 : total_time)
223
- ax. set_yticks (1 : nsites)
224
- bar = fig. colorbar (shw)
198
+ D = hcat (densities... )'
199
+
200
+ fig = Figure (size= (800 , 320 ))
201
+ ax = Axis (fig[1 , 1 ], xlabel = " time (μs)" , ylabel = " site" , xticks= 0 : 0.2 : total_time, yticks= (0.5 : 1 : nsites, string .(1 : nsites)))
202
+ shw = heatmap! (ax, LinRange (0.0 , total_time, size (D, 1 )), LinRange (0.5 , nsites - 0.5 , size (D, 2 )), real (D))
203
+ Colorbar (fig[1 , 2 ], shw, label = " Rydberg density" )
225
204
fig
0 commit comments