Skip to content

Bravais

BoundedBravais

BoundedBravais(parent=None)

Bases: AtomArrangement

Source code in src/bloqade/builder/base.py
def __init__(
    self,
    parent: Optional["Builder"] = None,
) -> None:
    self.__parent__ = parent

__match_args__ class-attribute instance-attribute

__match_args__ = ('shape', 'lattice_spacing')

Base classe for Bravais lattices [AtomArrangement][bloqade.ir.location.base.AtomArrangement].

n_dims property

n_dims

dimension of the lattice

Returns:

Name Type Description
int

dimension of the lattice

coordinates

coordinates(index)

calculate the coordinates of a cell in the lattice given the cell index.

Source code in src/bloqade/ir/location/bravais.py
@beartype
def coordinates(self, index: List[int]) -> NDArray:
    """calculate the coordinates of a cell in the lattice
    given the cell index.
    """
    # damn! this is like stone age broadcasting
    vectors = np.array(self.cell_vectors())
    index = np.array(index)
    pos = np.sum(vectors.T * index, axis=1)
    return pos + np.array(self.cell_atoms())

scale

scale(factor)

Scale the current location with a factor.

(x,y) -> factor*(x,y)

Parameters:

Name Type Description Default
factor str | Real | Decimal | Scalar

scale factor

required

Returns:

Name Type Description
BoundedBravais BoundedBravais

The lattice with the scaled locations

Source code in src/bloqade/ir/location/bravais.py
@beartype
def scale(self, factor: ScalarType) -> "BoundedBravais":
    """Scale the current location with a factor.

    (x,y) -> factor*(x,y)

    Args:
        factor (str | Real | Decimal | Scalar): scale factor

    Returns:
        BoundedBravais: The lattice with the scaled locations
    """
    factor = cast(factor)
    obj = self.__new__(type(self))
    for f in fields(self):
        if f.name == "lattice_spacing":
            obj.lattice_spacing = factor * self.lattice_spacing
        else:
            setattr(obj, f.name, getattr(self, f.name))
    return obj

Chain

Chain(L, *, lattice_spacing=1.0, vertical_chain=False)

Bases: BoundedBravais

Chain lattice.

  • 1D lattice
  • primitive (cell) vector(s)
    • a1 = (1,0).
  • unit cell (1 atom(s))
    • loc (0,0)

Parameters:

Name Type Description Default
L int

number of sites in the chain

required
lattice_spacing (Scalar, Real)

lattice spacing. Defaults to 1.0.

1.0
  • Possible Next: continue with . to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in src/bloqade/ir/location/bravais.py
@beartype
def __init__(
    self, L: int, *, lattice_spacing: ScalarType = 1.0, vertical_chain: bool = False
):
    self.L = L
    self.lattice_spacing = cast(lattice_spacing)
    self.vertical_chain = vertical_chain
    super().__init__()

Honeycomb

Honeycomb(L1, L2=None, *, lattice_spacing=1.0)

Bases: BoundedBravais

Honeycomb lattice.

  • 2D lattice
  • primitive (cell) vector(s)
    • a1 = (1, 0)
    • a2 = (½, sqrt(3)/2)
  • unit cell (2 atom(s))
    • loc1 (0, 0)
    • loc2 (½, 1/(2*sqrt(3))

Parameters:

Name Type Description Default
L1 int

number of unit cells in linear direction. n_atoms = L1 * L1 * 2.

required
L2 Optional[int]

number of unit cells in direction a2. n_atoms = L1 * L2 * 2, default is L1.

None
lattice_spacing (Scalar, Real)

lattice spacing. Defaults to 1.0.

1.0
  • Possible Next: continue with . to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in src/bloqade/ir/location/bravais.py
@beartype
def __init__(
    self, L1: int, L2: Optional[int] = None, *, lattice_spacing: ScalarType = 1.0
):
    if L2 is None:
        L2 = L1

    self.L1 = L1
    self.L2 = L2
    self.lattice_spacing = cast(lattice_spacing)

    super().__init__()

Kagome

Kagome(L1, L2=None, *, lattice_spacing=1.0)

Bases: BoundedBravais

Kagome lattice.

  • 2D lattice
  • primitive (cell) vector(s)
    • a1 = (1, 0)
    • a2 = (½, sqrt(3)/2)
  • unit cell (3 atom(s))
    • loc1 (0, 0)
    • loc2 (0.5, 0)
    • loc3 (0.25 ,0.25sqrt(3))

Parameters:

Name Type Description Default
L1 int

number of sites in linear direction. n_atoms = 3 * L1 * L1.

required
L2 Optional[int]

number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1.

None
lattice_spacing (Scalar, Real)

lattice spacing. Defaults to 1.0.

1.0
  • Possible Next: continue with . to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in src/bloqade/ir/location/bravais.py
@beartype
def __init__(
    self, L1: int, L2: Optional[int] = None, *, lattice_spacing: ScalarType = 1.0
):
    if L2 is None:
        L2 = L1

    self.L1 = L1
    self.L2 = L2
    self.lattice_spacing = cast(lattice_spacing)
    super().__init__()

Lieb

Lieb(L1, L2=None, *, lattice_spacing=1.0)

Bases: BoundedBravais

Lieb lattice.

  • 2D lattice
  • primitive (cell) vector(s)
    • a1 = (1, 0)
    • a2 = (0, 1)
  • unit cell (3 atom(s))
    • loc1 (0, 0)
    • loc2 (0.5, 0)
    • loc3 (0 ,0.5)

Parameters:

Name Type Description Default
L1 int

number of unit cells in linear direction. n_atoms = 3* L1 * L1.

required
L2 Optional[int]

number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1.

None
lattice_spacing (Scalar, Real)

lattice spacing. Defaults to 1.0.

1.0
  • Possible Next: continue with . to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in src/bloqade/ir/location/bravais.py
@beartype
def __init__(
    self, L1: int, L2: Optional[int] = None, *, lattice_spacing: ScalarType = 1.0
):
    if L2 is None:
        L2 = L1
    self.L1 = L1
    self.L2 = L2
    self.lattice_spacing = cast(lattice_spacing)

Rectangular

Rectangular(
    width,
    height,
    *,
    lattice_spacing_x=1.0,
    lattice_spacing_y=1.0
)

Bases: BoundedBravais

Rectangular lattice.

  • 2D lattice
  • primitive (cell) vector(s)
    • a1 = (1,0)
    • a2 = (0,1)
  • unit cell (1 atom(s))
    • loc (0,0)

Parameters:

Name Type Description Default
width int

number of sites in x direction.

required
height int

number of sites in y direction.

required
lattice_spacing_x (Scalar, Real)

lattice spacing. Defaults to 1.0.

1.0
lattice_spacing_y (Scalar, Real)

lattice spacing in y direction. optional.

1.0
  • Possible Next: continue with . to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in src/bloqade/ir/location/bravais.py
@beartype
def __init__(
    self,
    width: int,
    height: int,
    *,
    lattice_spacing_x: ScalarType = 1.0,
    lattice_spacing_y: ScalarType = 1.0,
):
    self.width = width
    self.height = height
    self.lattice_spacing_x = cast(lattice_spacing_x)
    self.lattice_spacing_y = (
        cast(lattice_spacing_y)
        if lattice_spacing_y is not None
        else self.lattice_spacing_x
    )

    super().__init__()

Square

Square(L1, L2=None, *, lattice_spacing=1.0)

Bases: BoundedBravais

Square lattice.

  • 2D lattice
  • primitive (cell) vector(s)
    • a1 = (1,0)
    • a2 = (0,1)
  • unit cell (1 atom(s))
    • loc (0,0)

Parameters:

Name Type Description Default
L1 int

number of sites in linear direction. n_atoms = L1 * L1.

required
L2 Optional[int]

number of sites in direction a2. n_atoms = L1 * L2, default is L1

None
lattice_spacing (Scalar, Real)

lattice spacing. Defaults to 1.0.

1.0
  • Possible Next: continue with . to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in src/bloqade/ir/location/bravais.py
@beartype
def __init__(
    self, L1: int, L2: Optional[int] = None, *, lattice_spacing: ScalarType = 1.0
):
    if L2 is None:
        L2 = L1
    self.L1 = L1
    self.L2 = L2
    self.lattice_spacing = cast(lattice_spacing)
    super().__init__()

Triangular

Triangular(L1, L2=None, *, lattice_spacing=1.0)

Bases: BoundedBravais

Triangular lattice.

  • 2D lattice
  • primitive (cell) vector(s)
    • a1 = (1, 0)
    • a2 = (½, sqrt(3)/2)
  • unit cell (1 atom(s))
    • loc (0, 0)

Parameters:

Name Type Description Default
L int

number of sites in linear direction. n_atoms = L * L.

required
L2 Optional[int]

number of sites along a2 direction, n_atoms = L1 * L2, default is L1.

None
lattice_spacing (Scalar, Real)

lattice spacing. Defaults to 1.0.

1.0
  • Possible Next: continue with . to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in src/bloqade/ir/location/bravais.py
@beartype
def __init__(
    self, L1: int, L2: Optional[int] = None, *, lattice_spacing: ScalarType = 1.0
):
    if L2 is None:
        L2 = L1
    self.L1 = L1
    self.L2 = L2
    self.lattice_spacing = cast(lattice_spacing)

    super().__init__()