Closed Adrien-Kahn closed 2 years ago
Here is a minimal working example:
from pulser import Pulse, Register, Sequence
from pulser.simulation import Simulation
from pulser.devices import MockDevice
import qutip
reg = Register.rectangle(1,2)
p = Pulse.ConstantPulse(4, 40, 80, 0)
seq = Sequence(reg, MockDevice)
seq.declare_channel('ryd','rydberg_local', 0)
seq.add(p, 'ryd')
simtest = Simulation(seq)
restest = simtest.run()
# Overlap with |gg>
print([abs(state.overlap(qutip.basis(4,3)))**2 for state in restest.states])
[Edited for self-containment]
Output:
[1.0, 0.9996002665950946, 0.998404263138335, 0.9964215525372951]
The first value corresponds to the initial state, so we are only given 3 updated states, while 4 values for the Hamiltonian were provided.
While implementing these changes, there appeared some issues related to the interpolation of the call method of the QobjEvo
. I'm still working on this, but it will take longer than expected.
When simulating a 4ns sequence,
res.states
only contains 4 states, including the initial state. However, since 4 values for the Hamiltonian were provided, the initial state could be updated 4 times, so that we would have a total of 5 states inres.states
with the initial state.Manually setting the
evaluation_times
of thesimulation
does not help because the setter checks that the largest time is smaller thanself.times[-1]
which is equal to the duration of the sequence minus 1.