Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Rydbergchain system and add test #161

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions src/quantum_system_templates/rydberg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ function lift(x::Char,i::Int, N::Int)
qubits[i] = x
return join(qubits)
end

@doc raw"""
RydbergChainSystem(;
N::Int=3, # number of atoms
C::Float64=862690*2π,
distance::Float64=10.0, # μm
cutoff_order::Int=2, # 1 is nearest neighbor, 2 is next-nearest neighbor, etc.
local_detune::Bool=false, # If true, include one local detuning pattern.
all2all::Bool=true, # If true, include all-to-all interactions.
ignore_Y_drive::Bool=false, # If true, ignore the Y drive. (In the experiments, X&Y drives are implemented by Rabi amplitude and its phase.)
) -> QuantumSystem

Returns a `QuantumSystem` object for the Rydberg atom chain in the spin basis
Expand All @@ -46,10 +48,13 @@ H = \sum_i 0.5*\Omega_i(t)\cos(\phi_i(t)) \sigma_i^x - 0.5*\Omega_i(t)\sin(\phi_


# Keyword Arguments
- `N`: Number of atoms.
- `C`: The Rydberg interaction strength in MHz*μm^6.
- `distance`: The distance between atoms in μm.
- `cutoff_order`: Interaction range cutoff, 1 is nearest neighbor, 2 is next nearest neighbor.
- `local_detune`: If true, include one local detuning pattern.
- `all2all`: If true, include all-to-all interactions.
- `ignore_Y_drive`: If true, ignore the Y drive. (In the experiments, X&Y drives are implemented by Rabi amplitude and its phase.)
"""
function RydbergChainSystem(;
N::Int=3, # number of atoms
Expand All @@ -60,23 +65,24 @@ function RydbergChainSystem(;
all2all::Bool=true,
ignore_Y_drive::Bool=false,
)
PAULIS = Dict("I" => [1 0; 0 1], "X" => [0 1; 1 0], "Y" => [0 -im; im 0], "Z" => [1 0; 0 -1], "n" => [0 0; 0 1])
PAULIS = Dict(:I => [1 0; 0 1], :X => [0 1; 1 0], :Y => [0 -im; im 0], :Z => [1 0; 0 -1], :n => [0 0; 0 1])

if all2all
H_drift = zeros(ComplexF64, 2^N, 2^N)
for gap in 0:N-2
for i in 1:N-gap-1
H_drift += C * operator_from_string(
generate_pattern_with_gap(N, i, gap),
PAULIS
lookup = PAULIS
) / ((gap + 1) * distance)^6
end
end
else
if cutoff_order == 1
H_drift = sum([C*operator_from_string(generate_pattern(N,i),PAULIS)/(distance^6) for i in 1:N-1])
H_drift = sum([C*operator_from_string(generate_pattern(N,i),lookup=PAULIS)/(distance^6) for i in 1:N-1])
elseif cutoff_order == 2
H_drift = sum([C*operator_from_string(generate_pattern(N,i),PAULIS)/(distance^6) for i in 1:N-1])
H_drift += sum([C*operator_from_string(generate_pattern_with_gap(N,i,1),PAULIS)/((2*distance)^6) for i in 1:N-2])
H_drift = sum([C*operator_from_string(generate_pattern(N,i),lookup=PAULIS)/(distance^6) for i in 1:N-1])
H_drift += sum([C*operator_from_string(generate_pattern_with_gap(N,i,1),lookup=PAULIS)/((2*distance)^6) for i in 1:N-2])
else
error("Higher cutoff order not supported")
end
Expand All @@ -85,17 +91,17 @@ function RydbergChainSystem(;
H_drives = Matrix{ComplexF64}[]

# Add global X drive
Hx = sum([0.5*operator_from_string(lift('X',i,N), PAULIS) for i in 1:N])
Hx = sum([0.5*operator_from_string(lift('X',i,N), lookup=PAULIS) for i in 1:N])
push!(H_drives, Hx)

if !ignore_Y_drive
# Add global Y drive
Hy = sum([0.5*operator_from_string(lift('Y',i,N), PAULIS) for i in 1:N])
Hy = sum([0.5*operator_from_string(lift('Y',i,N), lookup=PAULIS) for i in 1:N])
push!(H_drives, Hy)
end

# Add global detuning
H_detune = -sum([operator_from_string(lift('n',i,N), PAULIS) for i in 1:N])
H_detune = -sum([operator_from_string(lift('n',i,N), lookup=PAULIS) for i in 1:N])
push!(H_drives, H_detune)

params = Dict{Symbol, Any}(
Expand All @@ -114,3 +120,7 @@ function RydbergChainSystem(;
params=params,
)
end

@testitem "Rydberg system test" begin
@test RydbergChainSystem(N=3,cutoff_order=2,all2all=false) isa QuantumSystem
end
Loading