Skip to content

Base

AtomArrangement

Bases: ProgramStart, TransformTrait

n_atoms property

n_atoms

number of atoms (filled sites) in the register.

n_dims property

n_dims

number of dimensions in the register.

n_sites property

n_sites

number of sites in the register.

n_vacant property

n_vacant

number of vacant sites in the register.

enumerate

enumerate()

enumerate all locations in the register.

Source code in src/bloqade/ir/location/base.py
def enumerate(self) -> Generator[LocationInfo, None, None]:
    """enumerate all locations in the register."""
    raise NotImplementedError

figure

figure(fig_kwargs=None, **assignments)

obtain a figure object from the atom arrangement.

Source code in src/bloqade/ir/location/base.py
def figure(self, fig_kwargs=None, **assignments):
    """obtain a figure object from the atom arrangement."""
    return get_atom_arrangement_figure(self, fig_kwargs, **assignments)

ParallelRegister

ParallelRegister(register, cluster_spacing)

Bases: ProgramStart

Parallel Register

Source code in src/bloqade/ir/location/base.py
@beartype
def __init__(self, register: AtomArrangement, cluster_spacing: ScalarType):
    self._register = register
    self._cluster_spacing = cast(cluster_spacing)

    if register.n_atoms > 0:
        # calculate bounding box
        # of this register
        location_iter = register.enumerate()
        (x, y) = next(location_iter).position
        x_min = x
        x_max = x
        y_min = y
        y_max = y

        for location_info in location_iter:
            (x, y) = location_info.position
            x_min = x.min(x_min)
            x_max = x.max(x_max)
            y_min = y.min(y_min)
            y_max = y.max(y_max)

        shift_x = (x_max - x_min) + cluster_spacing
        shift_y = (y_max - y_min) + cluster_spacing

        register_locations = [
            list(location_info.position) for location_info in register.enumerate()
        ]
        register_filling = [
            location_info.filling.value for location_info in register.enumerate()
        ]
        shift_vectors = [[shift_x, cast(0)], [cast(0), shift_y]]
    else:
        raise ValueError("No locations to parallelize.")

    self.register_locations = register_locations
    self.register_filling = register_filling
    self.shift_vectors = shift_vectors
    super().__init__(self)