Skip to content

Commit

Permalink
add ahs test (#4)
Browse files Browse the repository at this point in the history
* add ahs test

* add test

* Delete .gitignore

Signed-off-by: maolinml <86260930+maolinml@users.noreply.github.com>

Signed-off-by: maolinml <86260930+maolinml@users.noreply.github.com>
Co-authored-by: Mao Lin <maonlinml@amazon.com>
  • Loading branch information
maolinml and Mao Lin authored Nov 15, 2022
1 parent 26b6dfb commit 8978ecf
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions PyBraket/test/ahs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,39 @@ using Braket: AtomArrangement, AtomArrangementItem, TimeSeries, DrivingField, Aw
@test length(local_result.measurements) == 1_000
end=#
end


@testset "AHS_Local_simulator" begin
a = 5.5e-6

register = AtomArrangement()
push!(register, AtomArrangementItem((0, 0) .* a))

Ω_max = 2.5e6
t_max = 2π/(Ω_max)
Ω = TimeSeries()
Ω[0.0] = Ω_max
Ω[t_max] = Ω_max

ϕ = TimeSeries()
ϕ[0.0] = 0.0
ϕ[t_max] = 0.0

Δ = TimeSeries()
Δ[0.0] = 0.0
Δ[t_max] = 0.0

drive = DrivingField(Ω, ϕ, Δ)
ahs_program = AnalogHamiltonianSimulation(register, drive)

ahs_local = LocalSimulator("braket_ahs")
local_result = result(run(ahs_local, ahs_program, shots=1_000))

g_count = 0
for meas in local_result.measurements
g_count += meas.post_sequence[1]
end

@test g_count == 1_000

end

0 comments on commit 8978ecf

Please sign in to comment.