Skip to content

Initializing quantum devices

Each Device in QoolQit wraps a Pulser device and defines the hardware characteristics that the program will be compiled to and later executed on.

from qoolqit import MockDevice, AnalogDevice

# An example of an ideal device
device_ideal = MockDevice()

# An example of a real device
device_real = AnalogDevice()

Create a QoolQit device directly from a Pulser device

Custom QoolQit device can be created by either subclassing the Device class or build it straight from any pulser.devices object:

from qoolqit.devices import Device
from pulser import devices

# Wrap a Pulser device object into a QoolQit Device
device_from_pulser = Device(pulser_device=devices.AnalogDevice)
AnalogDevice

Notes

  • Advanced users may also pass a prebuilt default_converter to the constructor to start in a custom unit system:
    from qoolqit import UnitConverter
    custom_default = UnitConverter.from_energy(C6=device_from_pulser._C6, upper_amp=2.0)
    device_custom = Device(pulser_device=devices.AnalogDevice, default_converter=custom_default)
    

Unit conversion

Each device has a default unit converter. These are the unit values used when converting an adimensional program in the Rydberg analog model to the physical units of Pulser devices for hardware execution.

device_real.converter
UnitConverter(time = 79.577, energy = 12.566, distance = 6.403)

The converter handles the logic of converting the adimensional QoolQit model to Pulser units. For theoretical details on how this conversion works between the Rydberg analog model and the implementation that Pulser uses you can check the Rydberg analog model page.

By default, each device creates a default converter where the energy unit is set as that device’s maximum amplitude. If you make no changes to the device’s converter, this means that amplitude values in the range \( [0, 1] \) will be converted to values in the range \( [0, \Omega_{\max}] \).

Customizing units

For advanced users, customizing the unit conversion factors is possible.

device_real.set_time_unit(50.0)

device_real.set_energy_unit(10.0)

device_real.set_distance_unit(6.0)
UnitConverter(time = 50.000, energy = 20.000, distance = 5.925)
UnitConverter(time = 100.000, energy = 10.000, distance = 6.651)
UnitConverter(time = 53.893, energy = 18.555, distance = 6.000)

Restoring defaults

You can always restore the default converter:

device_real.reset_converter()
UnitConverter(time = 79.577, energy = 12.566, distance = 6.403)