qse.calc#

Calculators are high level wrappers on different backend and let us offload the computational workload.

Submodules#

Classes#

Calculator

Base-class for all QSE calculators.

ExactSimulator

A calculator that evoles the qubit system exactly.

Myqlm

QSE-Calculator for MyQLM.

Pulser

QSE-Calculator for pulser.

Qutip

Base-class for all QSE calculators.

Functions#

blockade_radius(rabi_frequency[, c6])

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.

abstract calculate()[source]#

Do the calculation.

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.

get_sij()[source]#

Get spin correlation s_ij. If the hamiltonian isn’t simulated, it triggers simulation first.

Returns:

np.ndarray – Array of NxN shape containing spin correlations.

See also

qse.magnetic.get_sij

structure_factor_from_sij(L1: int, L2: int, L3: int)[source]#

Get the structure factor.

Parameters:
  • L1 (int) – Extent of lattice in x direction.

  • L2 (int) – Extent of lattice in y direction.

  • L3 (int) – Extent of lattice in z direction.

Returns:

np.ndarray – Array containing the structure factor.

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.Calculator

QSE-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.

calculate()[source]#

Run the calculation.

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.Calculator

QSE-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.

build_sequence()[source]#

Build the sequence of operations involving the qubit coordinates, amplitude pulse and detuning pulse.

calculate(progress=True)[source]#

Run the calculation.

class qse.calc.Qutip(qbits, amplitude, detuning)[source]#

Bases: qse.calc.calculator.Calculator

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.

calculate(e_ops=None)[source]#

Do the calculation.