qse.calc#
Calculators are high level wrappers on different backend and let us offload the computational workload.
Submodules#
Classes#
Base-class for all QSE calculators. |
|
A calculator that evoles the qubit system exactly. |
|
QSE-Calculator for MyQLM. |
|
QSE-Calculator for pulser. |
|
Base-class for all QSE calculators. |
Functions#
|
Calculate the blockade radius based on the Rabi frequency and C6 coefficient. |
Package Contents#
- qse.calc.blockade_radius(rabi_frequency, c6=5420158.53)[source]#
Calculate the blockade radius based on the Rabi frequency and C6 coefficient. The blockade radius is a measure of the distance at which the Rydberg blockade effect occurs, preventing simultaneous excitation of nearby atoms.
- Parameters:
rabi_frequency (float) – The Rabi frequency (in rads/μs) associated with the atomic transition.
c6 (float, optional) – The C6 coefficient (in rads/μs * μm^6) for the van der Waals interaction. Default is 5420158.53.
- Returns:
float – The blockade radius (in μm).
Notes
The blockade radius is calculated as:
\[r_b = \left( \frac{C_6}{\Omega} \right)^{1/6}\]where \(\Omega\) is the Rabi frequency and \(C_6\) is the van der Waals coefficient.
- class qse.calc.Calculator(qbits, label: str, is_calculator_available: bool, installation_message: str)[source]#
Base-class for all QSE calculators.
- Parameters:
label (str) – Name used for all files. Not supported by all calculators. May contain a directory, but please use the directory parameter for that instead.
qbits (Qbits object) – Optional Qbits object to which the calculator will be attached. When restarting, qbits will get its positions and unit-cell updated from file.
- get_spins()[source]#
Get spin expectation values. If the hamiltonian isn’t simulated, it triggers simulation first.
- Returns:
np.ndarray – Array of Nx3 containing spin expectation values.
See also
- class qse.calc.ExactSimulator(amplitude=None, detuning=None)[source]#
A calculator that evoles the qubit system exactly. Only supported for a single qubit.
- Parameters:
amplitude (qse.Signal, qse.Signals) – The amplitude pulse.
detuning (qse.Signal, qse.Signals) – The detuning pulse.
Notes
For a single qubit the Hamiltonian is
\[H = \frac{\Omega}{2} e^{-i\phi}|0\rangle\langle 1| + \frac{\Omega}{2} e^{i\phi}|0\rangle\langle 1| -\delta|1\rangle\langle 1|\]where \(\Omega\) is the amplitude, \(\phi\) the phase and \(\delta\) the detuning. Setting the phase to zero and adding a constant \(I\delta/2\) we get
\[H = \frac{\Omega X + \delta Z}{2}\]Then the time evolution unitary is given by
\[U(t) = e^{-iH t} = \cos(\Delta t/2) I - i \sin(\Delta t/2) \frac{\Omega X + \delta Z}{\Delta}\]Where \(\Delta=\sqrt{\delta^2+\Omega^2}\).
- class qse.calc.Myqlm(qbits=None, amplitude=None, detuning=None, qpu=None, label='myqlm-run', wtimes=True)[source]#
Bases:
qse.calc.calculator.CalculatorQSE-Calculator for MyQLM.
- Parameters:
qbits (qse.Qbits) – The qbits object.
amplitude (qse.Signal) – The amplitude pulse.
detuning (qse.Signal) – The detuning pulse.
qpu (qat.qpus) – The Quantum Processing Unit for executing the job.
label (str) – The label. Defaults to “pulser-run”.
wtimes (bool) – Whether to print the times. Defaults to True.
- class qse.calc.Pulser(qbits=None, amplitude=None, detuning=None, channel='rydberg_global', magnetic_field=None, device=None, emulator=None, label='pulser-run', wtimes=True)[source]#
Bases:
qse.calc.calculator.CalculatorQSE-Calculator for pulser.
- Parameters:
qbits (qse.Qbits) – The qbits object.
amplitude (qse.Signal, qse.Signals, pulser.waveforms.Waveform) – The amplitude pulse.
detuning (qse.Signal, qse.Signals, pulser.waveforms.Waveform) – The detuning pulse.
channel (str) – Which channel to use. For example “rydberg_global” for Rydberg or “mw_global” for microwave. Defaults to “rydberg_global”.
magnetic_field (np.ndarray | list) – A magnetic field. Must be a 3-component array or list. Can only be passed when using the Microwave channel (“mw_global”).
device (pulser.devices.Device) – The device. Defaults to pulser.devices.MockDevice.
emulator – The emulator. Defaults to QutipEmulator.
label (str) – The label. Defaults to “pulser-run”.
wtimes (bool) – Whether to print the times. Defaults to True.
Examples
A simple example of using the Pulser calculator:
import qse qbits = qse.lattices.square(4.0, 3, 3) duration = 400 amp = qse.Signal([1.01], duration) det = qse.Signal([0.12], duration) pcalc = qse.calc.Pulser( qbits=qbits, amplitude=amp, detuning=det) pcalc.build_sequence() pcalc.calculate() pcalc.get_spins()
10.0%. Run time: 0.03s. Est. time left: 00:00:00:00
20.0%. Run time: 0.06s. Est. time left: 00:00:00:00
30.0%. Run time: 0.09s. Est. time left: 00:00:00:00
40.0%. Run time: 0.12s. Est. time left: 00:00:00:00
50.0%. Run time: 0.15s. Est. time left: 00:00:00:00
60.0%. Run time: 0.18s. Est. time left: 00:00:00:00
70.0%. Run time: 0.21s. Est. time left: 00:00:00:00
80.0%. Run time: 0.24s. Est. time left: 00:00:00:00
90.0%. Run time: 0.26s. Est. time left: 00:00:00:00
100.0%. Run time: 0.29s. Est. time left: 00:00:00:00
Total run time: 0.29s
time in compute and simulation = 0.5043220520019531 s.
array([[-0.00969476, -0.32252248, 0.92650917], [-0.00445941, -0.31324353, 0.92746763], [-0.00969476, -0.32252248, 0.92650917], [-0.00445941, -0.31324353, 0.92746763], [ 0.00822629, -0.31255377, 0.92795807], [-0.00445941, -0.31324353, 0.92746763], [-0.00969476, -0.32252248, 0.92650917], [-0.00445941, -0.31324353, 0.92746763], [-0.00969476, -0.32252248, 0.92650917]])Notes
Pulser will only use the x-y coordinates of the Qbits object.
Pulser is an open-source Python software package. It provides easy-to-use libraries for designing and simulating pulse sequences that act on programmable arrays of neutral qbits, a promising platform for quantum computation and simulation. Online documentation: https://pulser.readthedocs.io White paper: Quantum 6, 629 (2022) Source code: pasqal-io/Pulser License: Apache 2.0 - see [LICENSE](pasqal-io/Pulser) for details.
- class qse.calc.Qutip(qbits, amplitude, detuning)[source]#
Bases:
qse.calc.calculator.CalculatorBase-class for all QSE calculators.
- Parameters:
label (str) – Name used for all files. Not supported by all calculators. May contain a directory, but please use the directory parameter for that instead.
qbits (Qbits object) – Optional Qbits object to which the calculator will be attached. When restarting, qbits will get its positions and unit-cell updated from file.