Working with Subspace
Due to the strong Rydberg interactions, only one Rydberg excitation is allowed if the atoms are close to each other. We typically take this as the blockade radius, $R_b$, which is the distance for which the Rydberg interaction is the same as the Rabi frequency, $\Omega$ (see Rydberg Blockade). This is the so-called blockade constraint.
In Bloqade, we can take advantage of this effect by allowing users to run emulation in a truncated subspace, i.e., by throwing out states that violate the blockade constraint. This can help accelerate the simulation and enables simulation for a larger system size. In this section, we will show how to create a blockade subspace, create registers in the subspace, obtain the Hamiltonian matrix in the subspace, and run emulation in the subspace.
Note that the blockade radius $R_b$ is the distance for which the Rydberg interaction is the same as the Rabi frequency, $\Omega$. For accurate simulation, however, it's not recommended to throw away the states that's close to the blockade radius. In other words, it's safer to set the subspace radius $R_s$ to be smaller than $R_b$, where we throw away the blockade violated states when the atoms are within $R_s$. For example, if we set $R_s = 1/2 * R_b$, we will be throwing away states that have interaction energies at least $2^6*\Omega$, which will be a good approximation. See the Rydberg Blockade page for recommendations on how to set $R_b$, $R_s$, and the atom lattice separation, $a$.
Create the Blockade Subspace
One can create a blockade subspace via the blockade_subspace
method if we know the atomic positions:
BloqadeMIS.blockade_subspace
— Functionblockade_subspace(atoms[, radius=1.0])
Create a blockade approximation subspace from given atom positions and radius.
For example, we can construct a blockade subspace of a square lattice using the code below:
using Bloqade
atoms = generate_sites(SquareLattice(), 3, 3, scale=5.1)
space = blockade_subspace(atoms, 5.2)
9-qubits 63-elements Subspace{Int64, Vector{Int64}}:
───┬────
1│ 0
2│ 1
3│ 2
⋮│ ⋮
61│ 337
62│ 340
63│ 341
We first created a $3*3$ square lattice with nearest neighbor atoms separated by $5.1$ μm. Then we have created a blockade subspace with the subspace radius, $R_s$, being $5.2$ μm. This means that if two atoms have a separation distance that is smaller than (or equal to) $5.2$ μm, then the blockade subspace does not contain states where both of them being in the Rydberg states. For the dictionary shown, the left is the new index of the states in the blockade subspace; in this case, there are 63 allowed states, which is much smaller than the full Hilbert space size 512. The vectors on the right correspond to the base-10 representations of the states in bitstrings.
Here space
is of the type Subspace
:
BloqadeExpr.Subspace
— TypeSubspace{S <: AbstractVector} <: AbstractSpace
A Dict
-like object stores the mapping between subspace and full space.
Other than using atomic positions and the subspace radius, we can also use a graph to create a subspace. In this case, the subspace corresponds to the space composed by the independent sets of this graph. Bloqade has an explicit function for this, by using a graph as an input, and produces the subspace as the output. Here is an example code:
using Graphs
g = SimpleGraph(5)
edge_set = [(1,2), (1, 4), (2, 5), (3, 4)]
for (i,j) in edge_set
add_edge!(g, i, j)
end
space = independent_set_subspace(g)
5-qubits 13-elements Subspace{Int64, Vector{Int64}}:
───┬───
1│ 0
2│ 1
3│ 2
⋮│ ⋮
11│ 20
12│ 21
13│ 24
Create Registers in the Subspace
One can create a register in the subspace by feeding the space
object instead of an integer for the common register interfaces, e.g.:
julia> zero_state(space)
SubspaceArrayReg{2, ComplexF64, Vector{ComplexF64}, Subspace{Int64, Vector{Int64}}}(5, ComplexF64[1.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im], Subspace{Int64, Vector{Int64}}(5, Dict(5 => 5, 16 => 9, 20 => 11, 24 => 13, 8 => 7, 17 => 10, 1 => 2, 0 => 1, 6 => 6, 4 => 4…), [0, 1, 2, 4, 5, 6, 8, 10, 16, 17, 20, 21, 24]))
julia> product_state(bit"000_000_001", space)
SubspaceArrayReg{2, ComplexF64, Vector{ComplexF64}, Subspace{Int64, Vector{Int64}}}(5, ComplexF64[0.0 + 0.0im, 1.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im, 0.0 + 0.0im], Subspace{Int64, Vector{Int64}}(5, Dict(5 => 5, 16 => 9, 20 => 11, 24 => 13, 8 => 7, 17 => 10, 1 => 2, 0 => 1, 6 => 6, 4 => 4…), [0, 1, 2, 4, 5, 6, 8, 10, 16, 17, 20, 21, 24]))
Alternatively, if you have an existing state stored as a subtype of AbstractVector
, you can also create the register using the constructor:
julia> state = rand(ComplexF64, length(space))
13-element Vector{ComplexF64}: 0.41360581038218813 + 0.14682300668968717im 0.06923045559531393 + 0.06562830923257679im 0.3009132371131623 + 0.8196358464056499im 0.41597518669526456 + 0.6531115428921477im 0.7223168051359367 + 0.5961552918504326im 0.28989871539094647 + 0.4873309158319542im 0.9338331643051732 + 0.7011172308111226im 0.7123925336504765 + 0.01714251100988662im 0.1741700383133964 + 0.21419331155034937im 0.9709906006359108 + 0.9319897188946181im 0.6656944340039144 + 0.7076246805687435im 0.5249805446195294 + 0.9007926505042311im 0.5624678417861914 + 0.9789106152746198im
julia> reg = SubspaceArrayReg(state, space)
SubspaceArrayReg{2, ComplexF64, Vector{ComplexF64}, Subspace{Int64, Vector{Int64}}}(5, ComplexF64[0.41360581038218813 + 0.14682300668968717im, 0.06923045559531393 + 0.06562830923257679im, 0.3009132371131623 + 0.8196358464056499im, 0.41597518669526456 + 0.6531115428921477im, 0.7223168051359367 + 0.5961552918504326im, 0.28989871539094647 + 0.4873309158319542im, 0.9338331643051732 + 0.7011172308111226im, 0.7123925336504765 + 0.01714251100988662im, 0.1741700383133964 + 0.21419331155034937im, 0.9709906006359108 + 0.9319897188946181im, 0.6656944340039144 + 0.7076246805687435im, 0.5249805446195294 + 0.9007926505042311im, 0.5624678417861914 + 0.9789106152746198im], Subspace{Int64, Vector{Int64}}(5, Dict(5 => 5, 16 => 9, 20 => 11, 24 => 13, 8 => 7, 17 => 10, 1 => 2, 0 => 1, 6 => 6, 4 => 4…), [0, 1, 2, 4, 5, 6, 8, 10, 16, 17, 20, 21, 24]))
Obtain the Hamiltonian Matrix in the Subspace
The matrix projected in the subspace of a given Hamiltonian can be obtained via mat
as well, e.g.:
julia> atoms = generate_sites(SquareLattice(), 3, 3, scale=5.1);
julia> space = blockade_subspace(atoms, 5.2);
julia> h1 = rydberg_h(atoms; Δ=2.0*2π, Ω=1.0*2π)
nqubits: 9 + ├─ [+] ∑ 2π ⋅ 8.627e5.0/|x_i-x_j|^6 n_i n_j ├─ [+] 2π ⋅ 0.5 ⋅ ∑ σ^x_i └─ [-] 2π ⋅ 2.0 ⋅ ∑ n_i
julia> mat(h1, space)
63×63 SparseMatrixCSC{ComplexF64, Int64} with 366 stored entries: ⎡⡞⢍⡊⢄⠑⡀⠑⠄⠈⠢⡀⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⎤ ⎢⠊⢌⢱⢖⠀⠈⠀⠐⠄⠀⠈⠀⠀⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⎥ ⎢⠑⠠⡀⠀⢟⣵⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⎥ ⎢⠑⠄⢀⠀⠀⠀⡟⢍⡄⠀⠀⠀⠀⠑⠄⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥ ⎢⠢⡀⠀⠁⠀⠀⠀⠉⢱⢖⠢⠢⠀⠢⡀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠢⡀⠀⠀⠀⎥ ⎢⠀⠈⠂⠀⢄⠀⠀⠀⠨⡂⠛⣤⢕⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡀⠀⎥ ⎢⠀⠀⠀⠀⠀⠑⢄⠀⠠⡀⠑⠑⠛⣤⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠂⎥ ⎢⠢⡀⠀⠀⠀⠀⠀⠁⠀⠈⠀⠀⠀⠁⢱⢖⠢⢂⠐⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥ ⎢⠀⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠨⢂⠛⣤⠅⠀⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥ ⎢⠀⠀⠀⠈⠀⠀⠢⡀⠀⠀⠀⠀⠀⠀⠐⢄⠁⠁⢱⢖⢂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥ ⎢⢄⠀⠀⠀⠀⠀⠀⠈⠂⠀⠀⠀⠀⠀⠀⠀⠀⠑⠈⠐⠛⣤⠤⡠⠀⢄⠀⢄⠀⠀⠀⠀⎥ ⎢⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡣⠱⢆⣑⠀⠢⠀⠑⠄⠀⠀⎥ ⎢⠀⠀⠀⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢄⠑⠘⠑⣤⢄⠀⠀⠠⡀⠀⎥ ⎢⠀⠀⠀⠀⠀⠑⠀⠀⠠⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢄⠈⠂⠀⠑⠛⣤⠤⡠⡈⠂⎥ ⎢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠄⠀⡀⠀⡣⠱⢆⣐⠄⎥ ⎣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⠈⠐⠜⠵⠇⎦
Other Operations in the Subspace
All other operations in the subspace are the same as the fullspace case. For example, to run an emulation in the subspace, one just need to use the subspace register SubspaceArrayReg
instead of the fullspace register ArrayReg
. The rest of the code are the same:
reg = zero_state(space)
prob = SchrodingerProblem(reg, 1.0, h1)
emulate!(prob)
statevec(reg)
63-element Vector{ComplexF64}:
0.13585307850388811 + 0.7346213876906675im
-0.0025450067101871437 + 0.03271936107717182im
-0.09136564439212766 + 0.14709932277558319im
-0.002545006710186996 + 0.032719361077171626im
0.03640229629720841 - 0.04785883792433167im
-0.09136564439212747 + 0.14709932277558346im
-0.003520337809249168 - 0.13351187766013684im
-0.009182822658231414 + 0.037741906756168286im
0.21572816867719485 - 0.10378379639436613im
-0.0010523745450196611 - 0.10411131375242312im
⋮
0.03640229629720796 - 0.047858837924331335im
0.0773713073956402 - 0.032764420083013536im
-0.007196192440743183 - 0.022872906698036075im
0.07737130739564041 - 0.0327644200830134im
0.13361821949331423 - 0.05657606453110492im
-0.0023091347726957104 + 0.021944696595877302im
-0.0018899409335649349 - 0.0019784347573578577im
-0.0018899409335649594 - 0.0019784347573578724im
-0.002966595829289374 + 0.0016052003624636947im
Measurements on the subspace register is the same as that in the full space.
Create Constrained Local Hamiltonians in the Subspace
Although we are able to emulate our Hamiltonian problem in the projected subspace, the long-range tail of the Rydberg interactions will be present in the subspace Hamiltonian. In certain cases, you may not want the long-range tail by only simulating a constrained short-range Hamiltonian, e.g. the PXP model. In this case, we can use Bloqade to easily deal with such problems for an arbitrary graph in an arbitrary dimension.
Let us take the PXP model in 1D as an example. We first create a 1D chain and then generate a subspace by projecting out states that have nearest-neighbor interactions.
atoms = generate_sites(ChainLattice(), 10, scale=5.1)
space = blockade_subspace(atoms, 5.2)
register = product_state(bit"0101010101", space)
h = 2π * 4.0 * SumOfX(length(atoms)) - 2π * 1.0 * SumOfN(length(atoms))
prob = SchrodingerProblem(register, 0.2, h)
emulate!(prob)
SchrodingerProblem:
register info:
type: SubspaceArrayReg{2, ComplexF64, Vector{ComplexF64}, Subspace{Int64, Vector{Int64}}}
storage size: 40 bytes
time span (μs): (0.0, 0.2)
equation:
storage size: 16.492 KiB
expression:
nqubits: 10
+
├─ [scale: 25.132741228718345] ∑ σ^x_i
└─ [scale: -6.283185307179586] ∑ n_i
algorithm: DP8(; stage_limiter! = trivial_limiter!, step_limiter! = trivial_limiter!, thread = static(false),)
options:
save_everystep: false
save_start: false
save_on: false
dense: false
reltol: 1.0e-10
abstol: 1.0e-10
alias_u0: true
After creating the subspace, we have built a Hamiltonian by explicitly summing up the Rabi frequency term and the detuning term by using SumOfX
and SumOfN
respectively. In this way, we have created a local constraint Hamiltonian (without the long-range interaction tail). Futhermore, if we want to emulate quantum dynamics under this Hamiltonian, we just need to create a subspace register and emulate the system under the created Hamiltonian.