braket.ahs.atom_arrangement module

class braket.ahs.atom_arrangement.SiteType(value)[source]

Bases: Enum

An enumeration.

VACANT = 'Vacant'
FILLED = 'Filled'
class braket.ahs.atom_arrangement.AtomArrangementItem(coordinate: tuple[Number, Number], site_type: SiteType)[source]

Bases: object

Represents an item (coordinate and metadata) in an atom arrangement.

coordinate: tuple[Number, Number]
site_type: SiteType
class braket.ahs.atom_arrangement.AtomArrangement[source]

Bases: object

Represents a set of coordinates that can be used as a register to an AnalogHamiltonianSimulation.

add(coordinate: tuple[Number, Number] | np.ndarray, site_type: SiteType = SiteType.FILLED) AtomArrangement[source]

Add a coordinate to the atom arrangement.

Parameters:
  • coordinate (Union[tuple[Number, Number], ndarray]) – The coordinate of the atom (in meters). The coordinates can be a numpy array of shape (2,) or a tuple of int, float, Decimal

  • site_type (SiteType) – The type of site. Optional. Default is FILLED.

Returns:

AtomArrangement – returns self (to allow for chaining).

coordinate_list(coordinate_index: Number) list[Number][source]

Returns all the coordinates at the given index.

Parameters:

coordinate_index (Number) – The index to get for each coordinate.

Returns:

list[Number] – The list of coordinates at the given index.

Example

To get a list of all x-coordinates: coordinate_list(0) To get a list of all y-coordinates: coordinate_list(1)

discretize(properties: DiscretizationProperties) AtomArrangement[source]

Creates a discretized version of the atom arrangement, rounding all site coordinates to the closest multiple of the resolution. The types of the sites are unchanged.

Parameters:

properties (DiscretizationProperties) – Capabilities of a device that represent the resolution with which the device can implement the parameters.

Raises:

DiscretizationError – If unable to discretize the program.

Returns:

AtomArrangement – A new discretized atom arrangement.

classmethod from_square_lattice(spacing: Number, canvas: Canvas, site_type: SiteType = SiteType.FILLED) AtomArrangement[source]

Create a square lattice arrangement within a canvas.

Parameters:
  • spacing (Number) – Distance between adjacent atoms in meters.

  • canvas (Canvas) – Canvas defining the boundary where atoms can be placed.

  • site_type (SiteType) – The type of sites to create. Default is FILLED.

Returns:

AtomArrangement – A new atom arrangement with atoms placed in a square lattice.

Raises:

ValueError – If spacing is not positive.

classmethod from_rectangular_lattice(spacing_x: Number, spacing_y: Number, canvas: Canvas, site_type: SiteType = SiteType.FILLED) AtomArrangement[source]

Create a rectangular lattice arrangement within a canvas.

Parameters:
  • spacing_x (Number) – Distance between adjacent atoms in x direction in meters.

  • spacing_y (Number) – Distance between adjacent atoms in y direction in meters.

  • canvas (Canvas) – Canvas defining the boundary where atoms can be placed.

  • site_type (SiteType) – The type of sites to create. Default is FILLED.

Returns:

AtomArrangement – A new atom arrangement with atoms placed in a rectangular lattice.

Raises:

ValueError – If either spacing is not positive.

classmethod from_triangular_lattice(spacing: Number, canvas: Canvas, site_type: SiteType = SiteType.FILLED) AtomArrangement[source]

Create a triangular lattice arrangement within a canvas.

A triangular lattice has the same spacing between all nearest neighbors. The lattice vectors are (spacing, 0) and (spacing/2, spacing*sqrt(3)/2).

Parameters:
  • spacing (Number) – Distance between nearest neighbor atoms in meters.

  • canvas (Canvas) – Canvas defining the boundary where atoms can be placed.

  • site_type (SiteType) – The type of sites to create. Default is FILLED.

Returns:

AtomArrangement – A new atom arrangement with atoms placed in a triangular lattice.

Raises:

ValueError – If spacing is not positive.

classmethod from_honeycomb_lattice(spacing: Number, canvas: Canvas, site_type: SiteType = SiteType.FILLED) AtomArrangement[source]

Create a honeycomb lattice arrangement within a canvas.

A honeycomb lattice is a triangular Bravais lattice with a two-atom basis. The spacing parameter refers to the nearest neighbor distance.

Parameters:
  • spacing (Number) – Distance between nearest neighbor atoms in meters.

  • canvas (Canvas) – Canvas defining the boundary where atoms can be placed.

  • site_type (SiteType) – The type of sites to create. Default is FILLED.

Returns:

AtomArrangement – A new atom arrangement with atoms placed in a honeycomb lattice.

Raises:

ValueError – If spacing is not positive.

classmethod from_bravais_lattice(a1: tuple[Number, Number], a2: tuple[Number, Number], canvas: Canvas, basis: list[tuple[Number, Number]] | None = None, site_type: SiteType = SiteType.FILLED) AtomArrangement[source]

Create a general Bravais lattice arrangement within a canvas.

Parameters:
  • a1 (tuple[Number, Number]) – First lattice vector (x, y) in meters.

  • a2 (tuple[Number, Number]) – Second lattice vector (x, y) in meters.

  • canvas (Canvas) – Canvas defining the boundary where atoms can be placed.

  • basis (list[tuple[Number, Number]], optional) – Basis vectors for decorated lattice. If None, uses a single atom at (0, 0). Default is None.

  • site_type (SiteType) – The type of sites to create. Default is FILLED.

Returns:

AtomArrangement – A new atom arrangement with atoms placed in a Bravais lattice.

Raises:

ValueError – If lattice vectors are parallel or zero.