Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aarontrowbridge committed Jun 5, 2024
1 parent 36e5c61 commit 88c5ef1
Showing 1 changed file with 32 additions and 22 deletions.
54 changes: 32 additions & 22 deletions src/quantum_system_templates/rydberg.jl
Original file line number Diff line number Diff line change
@@ -1,25 +1,4 @@
@doc raw"""
RydbergChainSystem(;
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.
) -> QuantumSystem

Returns a `QuantumSystem` object for the Rydberg atom chain in the spin basis
|g⟩ = |0⟩ = [1, 0], |r⟩ = |1⟩ = [0, 1].
```math
H = \sum_i 0.5*\Omega_i(t)\cos(\phi_i(t)) \sigma_i^x - 0.5*\Omega_i(t)\sin(\phi_i(t)) \sigma_i^y - \sum_i \Delta_i(t)n_i + \sum_{i<j} \frac{C}{|i-j|^6} n_i n_j
```
# Keyword Arguments
- `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.
"""
function generate_pattern(N::Int, i::Int)
# Create an array filled with 'I'
qubits = fill('I', N)
Expand All @@ -40,6 +19,7 @@ function generate_pattern_with_gap(N::Int, i::Int, gap::Int)
end
return join(qubits)
end

"""
Embed a character into a string at a specific position.
"""
Expand All @@ -49,7 +29,28 @@ function lift(x::Char,i::Int, N::Int)
return join(qubits)
end

@doc raw"""
RydbergChainSystem(;
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.
) -> QuantumSystem
Returns a `QuantumSystem` object for the Rydberg atom chain in the spin basis
|g⟩ = |0⟩ = [1, 0], |r⟩ = |1⟩ = [0, 1].
```math
H = \sum_i 0.5*\Omega_i(t)\cos(\phi_i(t)) \sigma_i^x - 0.5*\Omega_i(t)\sin(\phi_i(t)) \sigma_i^y - \sum_i \Delta_i(t)n_i + \sum_{i<j} \frac{C}{|i-j|^6} n_i n_j
```
# Keyword Arguments
- `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.
"""
function RydbergChainSystem(;
N::Int=3, # number of atoms
C::Float64=862690*2π,
Expand All @@ -64,7 +65,10 @@ function RydbergChainSystem(;
H_drift = zeros(ComplexF64, 2^N, 2^N)
for gap in 0:N-2
for i in 1:N-gap-1
H_drift += C*kron_from_dict(generate_pattern_with_gap(N,i,gap),PAULIS)/(((gap+1)*distance)^6)
H_drift += C * kron_from_dict(
generate_pattern_with_gap(N, i, gap),
PAULIS
) / ((gap + 1) * distance)^6
end
end
else
Expand All @@ -77,18 +81,23 @@ function RydbergChainSystem(;
error("Higher cutoff order not supported")
end
end

H_drives = Matrix{ComplexF64}[]

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

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

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

params = Dict{Symbol, Any}(
:N => N,
:C => C,
Expand All @@ -97,6 +106,7 @@ function RydbergChainSystem(;
:local_detune => local_detune,
:all2all => all2all,
)

return QuantumSystem(
H_drift,
H_drives;
Expand Down

0 comments on commit 88c5ef1

Please sign in to comment.