BloqadeLattices.AbstractLatticeType
AbstractLattice{D}

Supertype for all D dimensional lattices.

Implementation

lattice_vectors and lattice_sites functions must be defined which should both return an indexable iterable containing the Bravais lattice vectors and lattice sites respectively. (e.g.: GeneralLattice returns a tuple of tuples containing the Bravais lattice vectors and lattice sites).

BloqadeLattices.AbstractRegionType
AbstractRegion{D}

Supertype for all D dimensional regions used to define bounds on lattices.

Implementation

The following should be overriden:

  • Base.in: Returns Bool on whether a point exists in the region
  • Base.mod: Maps points outside the region back into the region
  • distance: Calculates distance between points with periodic boundary conditions enabled
BloqadeLattices.AtomListType
AtomList{D, T} <: AbstractVector{NTuple{D, T}}
AtomList(atoms::Vector{<:NTuple})

A list of atoms in D dimensional space.

BloqadeLattices.BoundedLatticeType
struct BoundedLattice{L<:AbstractLattice, R<:AbstractRegion}

Defines a lattice bounded by a region with the option for periodic boundary conditions.

Fields

  • lattice <: AbstractLattice: Lattice to be bounded.
  • region <: AbstractRegion: Region that bounds the underlying lattice.
  • site_positions::AtomList: Positions of the atoms inside region.
  • pbc::Bool: Enable/Disable behavior for Periodic Boundary Conditions.
BloqadeLattices.ByDensityMethod
ByDensity(values; colormap="Grays", vmin=minimum(values), vmax=maximum(values))

For specifying the colors for density plots, where values are densities.

Keyword arguments

  • colormap is a string for specifying the color map, check the documentation of [Colors] package for the detailed description.
  • vmin and vmax are the color range.
BloqadeLattices.ChainLatticeType
struct ChainLattice <: AbstractLattice{1}

Type representing 1D Chain Lattice.

Used as an argument of generate_sites function to produce tiling in a chain pattern, with number of site repetitions being specified by the additional argument of generate_sites. Chain is a 1D Lattice, so there must be one integer argument as additional inputs.

Example

julia> generate_sites(ChainLattice(), 5)
5-element AtomList{1, Float64}:
 (0.0,)
 (1.0,)
 (2.0,)
 (3.0,)
 (4.0,)

Overriden functions to return lattice vectors and sites exists as lattice_vectors(::ChainLattice) and lattice_sites(::ChainLattice).

BloqadeLattices.DistanceGroupType
DistanceGroup

The vertices grouped by distances. One can use distancegroup[n] to get n-th nearest neighbors.

BloqadeLattices.GeneralLatticeType
GeneralLattice{D,K,T} <: AbstractLattice{D}
GeneralLattice(vectors, sites)

The general lattice type for tiling the space. Type parameter D is the dimension, K is the number of sites in a unit cell and T is the data type for coordinates, e.g. Float64. Input arguments are

  • vectors is a vector/tuple of D-tuple. Its length is D, it specifies the Bravais lattice vectors.
  • sites is a vector/tuple of D-tuple. Its length is K, it specifies the sites inside a Bravais cell.
BloqadeLattices.HoneycombLatticeType
struct HoneycombLattice <: AbstractLattice{2}

Type representing 2D Honeycomb Lattice.

Used as an argument of generate_sites function to produce tiling in a honeycomb pattern, with number of site repetitions being specified by additional arguments of generate_sites. Honeycomb is a 2D Lattice, so there must be two integer arguments as additional inputs.

Example

julia> generate_sites(HoneycombLattice(), 5, 5)
50-element AtomList{2, Float64}:
 (0.0, 0.0)
 (0.5, 0.2886751345948129)
...
 (6.0, 3.4641016151377544)
 (6.5, 3.7527767497325675)

Overriden functions to return lattice vectors and sites exists as lattice_vectors(::HoneycombLattice) and lattice_sites(::HoneycombLattice).

BloqadeLattices.KagomeLatticeType
struct KagomeLattice <: AbstractLattice{2}

Type representing 2D Kagome Lattice.

Used as an argument of generate_sites function to produce tiling in a Kagome pattern, with number of site repetitions being specified by additional arguments of generate_sites. Kagome is a 2D Lattice, so there must be two integer arguments as additional inputs.

Example

julia> generate_sites(KagomeLattice(), 3, 3)
27-element AtomList{2, Float64}:
 (0.0, 0.0)
 (0.25, 0.4330127018922193)
 ...
 (3.25, 2.1650635094610964)
 (3.75, 2.1650635094610964)

Overriden functions to return lattice vectors and sites exists as lattice_vectors(::KagomeLattice) and lattice_sites(::KagomeLattice).

BloqadeLattices.LiebLatticeType
struct LiebLattice <: AbstractLattice{2}

Type representing 2D Lieb Lattice.

Used as an argument of generate_sites function to produce tiling in a Lieb (square-depleted) pattern, with number of site repetitions being specified by additional arguments of generate_sites. Lieb is a 2D Lattice, so there must be two integer arguments as additional inputs.

Example

julia> generate_sites(LiebLattice(), 3, 3)
27-element AtomList{2, Float64}:
 (0.0, 0.0)
 (0.5, 0.0)
...
 (2.5, 2.0)
 (2.0, 2.5)

Overriden functions to return lattice vectors and sites exists as lattice_vectors(::LiebLattice) and lattice_sites(::LiebLattice).

BloqadeLattices.MaskedGridType
MaskedGrid{T}
MaskedGrid(xs, ys, mask)

Masked square lattice contains 3 fields, the x-coordinates, y-coordinates and a mask. e.g. MaskedGrid([0.0, 1.0, 3.0], [0.0, 2.0,6.0], Bool[1 0 0; 0 1 1; 0 1 0]) specifies the following lattice:

     y₁   y₂        y₃
     ↓    ↓         ↓
x₁ → ●    ⋅         ●
x₂ → ⋅    ●         ●

x₃ → ⋅    ●         ⋅
BloqadeLattices.ParallelepipedMethod
Parallelepiped(vecs)
Parallelepiped(vecs::T) where {T<:Real}

Define a region (either a line segment, parallelogram, or parallelepiped depending on the dimensions of vecs) using a single value or column vectors in a matrix that can be used to create a BoundedLattice.

julia> Parallelepiped(2.0) # can bound a 1D lattice
Parallelepiped{1, Float64}([2.0;;], [0.5;;])

julia> bounds = zeros((2,2)); # Create 2x2 matrix to store vectors defining 2D region

julia> bounds[:,1] .= (3,3); bounds[:,2] .= (4,0); # Column Vectors define the Parallelogram

julia> Parallelepiped(bounds)
Parallelepiped{2, Float64}([3.0 4.0; 3.0 0.0], [0.0 0.3333333333333333; 0.25 -0.25])
BloqadeLattices.RectangularLatticeType
struct RectangularLattice <: AbstractLattice{2}

Type representing 2D Rectangular Lattice.

Used as an argument of generate_sites function to produce tiling in a Rectangular pattern, with number of site repetitions being specified by additional arguments of generate_sites. Rectangular is a 2D Lattice, so there must be two integer arguments as additional inputs. This type also enables the user to modify the length of one of the Bravais lattice vectors, by passing a single integer on construction as the aspect ratio.

Example

julia> generate_sites(RectangularLattice(2.0), 2, 2)
4-element AtomList{2, Float64}:
 (0.0, 0.0)
 (1.0, 0.0)
 (0.0, 2.0)
 (1.0, 2.0)

Overriden functions to return lattice vectors and sites exists as lattice_vectors(::RectangularLattice) and lattice_sites(::RectangularLattice).

BloqadeLattices.SquareLatticeType
struct SquareLattice <: AbstractLattice{2}

Type representing 2D Square Lattice.

Used as an argument of generate_sites function to produce tiling in a square pattern, with number of site repetitions being specified by additional arguments of generate_sites. Square is a 2D Lattice, so there must be two integer arguments as additional inputs.

Example

julia> generate_sites(SquareLattice(), 4, 4)
16-element AtomList{2, Float64}:
 (0.0, 0.0)
 (1.0, 0.0)
 ...
 (2.0, 3.0)
 (3.0, 3.0)

Overriden functions to return lattice vectors and sites exists as lattice_vectors(::SquareLattice) and lattice_sites(::SquareLattice).

BloqadeLattices.TriangularLatticeType
struct TriangularLattice <: AbstractLattice{2}

Type representing 2D Square Lattice.

Used as an argument of generate_sites function to produce tiling in a triangle pattern, with number of site repetitions being specified by additional arguments of generate_sites. Triangle is a 2D Lattice, so there must be two integer arguments as additional inputs.

Example

julia> generate_sites(TriangularLattice(), 3, 3)
9-element AtomList{2, Float64}:
 (0.0, 0.0)
 (1.0, 0.0)
 ...
 (2.0, 1.7320508075688772)
 (3.0, 1.7320508075688772)

Overriden functions to return lattice vectors and sites exists as lattice_vectors(::TriangularLattice) and lattice_sites(::TriangularLattice).

Base.deleteat!Method
deleteat!(sites::AtomList, indices...)

Deletes an atom from sites via its index/indices.

When sites is displayed after deletion the atoms will be renumbered to maintain a proper integer sequence, e.g. given a sequence of atoms numbered "1,2,3,4", if atom 3 is deleted then the new ordering will be "1,2,3".

julia> sites = generate_sites(SquareLattice(), 2, 2, scale=6.7)
4-element AtomList{2, Float64}:
 (0.0, 0.0)
 (6.7, 0.0)
 (0.0, 6.7)
 (6.7, 6.7)

julia> deleteat!(sites, 2, 3)
2-element AtomList{2, Float64}:
 (0.0, 0.0)
 (6.7, 6.7)
Base.inMethod
Base.in(x,region::Parallelepiped{D,T}) where {D,T} = all(in_range.(region.vecs_inv * [x...,]))

Given a point x, check if exists in the region.

julia> bounds = zeros(2,2);

julia> bounds[:,1] .= (3,3); bounds[:,2] .= (4,0);

julia> p = Parallelepiped(bounds)
Parallelepiped{2, Float64}([3.0 4.0; 3.0 0.0], [0.0 0.3333333333333333; 0.25 -0.25])

julia> (0.0, 0.0) ∈ p
true

julia> (5.0, 1.0) ∈ p
false
BloqadeLattices.clip_axesMethod
clip_axes(sites::AtomList{D, T}, bounds::Vararg{Tuple{T,T},D}) where {D, T}
clip_axes(bounds...)

Remove sites out of bounds, where bounds is specified by D D-tuples.

julia> sites = AtomList([(1.0, 2.0), (10.0, 3.0), (1.0, 12.0), (3.0, 5.0)])
4-element AtomList{2, Float64}:
 (1.0, 2.0)
 (10.0, 3.0)
 (1.0, 12.0)
 (3.0, 5.0)

julia> clip_axes(sites, (-5.0, 5.0), (-5.0, 5.0))
2-element AtomList{2, Float64}:
 (1.0, 2.0)
 (3.0, 5.0)
BloqadeLattices.dimensionMethod
dimension(lattice::BoundedLattice{L,C})

Returns the dimensions of the BoundedLattice (e.g.: 2 for 2D, 3 for 3D)

julia> bl = parallelepiped_region(ChainLattice(),(4,);pbc=true) # create a 1D BoundedLattice

julia> dimension(bl)
1

julia> bl = parallelepiped_region(SquareLattice(),(3,0),(0,2);) # create a 2D BoundedLattice

julia> dimension(bl)
2
BloqadeLattices.distanceMethod
distance(x, y)
distance(region::Parallelepiped{D,T},x,y)

Distance between two points.

If just points x and y are provided, the Euclidean distance is calculated.

If a region is provided, then it is automatically assumed periodic boundary conditions are enabled and the smallest possible distance between the two points is returned.

julia> distance((0.0, 0.0), (1.0, 1.0))
1.4142135623730951

julia> bounds = zeros(2,2); bounds[:,1] .= (3, 0); bounds[:,2] .= (0, 3);

julia> distance(Parallelepiped(bounds), (0.5, 0.5), (2.5, 2.5))
1.4142135623730951
BloqadeLattices.distanceMethod
distance(lattice::BoundedLattice,x,y)

Returns the distance between two points in the BoundedLattice.

Points x and y can be any iterable and must have the same dimensions as the BoundedLattice (ex: (x,y) for a 2D lattice, (x,y,z) for a 3D lattice).

If the Periodic Boundary Condition option has been set to true for the BoundedLattice, the smallest distance between points (modulo the region) is returned, otherwise the standard Euclidean metric is used.

julia> bl = parallelepiped_region(SquareLattice(), (1,0),(0,1);) # Define 2D BoundedLattice

julia> distance(bl, (0.1, 0.1), (0.5, 1.1)) # distance between two points
1.077032961426901

julia> bl_pbc = parallelepiped_region(SquareLattice(), (1,0),(0,1);pbc=true) # Define 2D BoundedLattice with Periodic Boundary Condition

julia> distance(bl_pbc, (0.1, 0.1), (0.5, 1.1)) # distance with periodic boundary condition enabled
0.4
BloqadeLattices.generate_sitesMethod
generate_sites(lattice::AbstractLattice{D}, repeats::Vararg{Int,D}; scale=1.0)

Returns an AtomList instance by tiling the specified lattice. The tiling repeat the sites of the lattice m times along the first dimension, n times along the second dimension, and so on. scale is a real number that re-scales the lattice constant and atom locations.

BloqadeLattices.generate_sites_in_regionMethod
generate_sites_in_region(lattice::AbstractLattice{D}, region::AbstractRegion{D})

Generates sites from the lattice that are present in the region.

julia> generate_sites_in_region(ChainLattice(), Parallelepiped(4.0))
4-element Vector{Tuple{Float64}}:
 (0.0,)
 (1.0,)
 (2.0,)
 (3.0,)

julia> bounds = zeros(2,2)
2×2 Matrix{Float64}:
 0.0  0.0
 0.0  0.0

julia> bounds[:,1] .= (0.0, 2.0); bounds[:,2] .= (2.0, 0.0);

julia> generate_sites_in_region(SquareLattice(), Parallelepiped(bounds))
4-element Vector{Tuple{Float64, Float64}}:
 (0.0, 0.0)
 (1.0, 0.0)
 (0.0, 1.0)
 (1.0, 1.0)
BloqadeLattices.grouped_nearestMethod
grouped_nearest(tree::KDTree, siteindex::Int, nsites::Int; atol=1e-8)

Find the nsites closest vertices to siteindex, and group them by distance. Difference of the distances smaller than the atol (default is 1e-8) are treated as the same Returns a DistanceGroup instance.

julia> atoms = generate_sites(HoneycombLattice(), 5, 5);

julia> tree = make_kdtree(atoms);

julia> gn = grouped_nearest(tree, 23, 20)
DistanceGroup([23, 14, 22, 24, 15, 13, 21, 25, 33, 31, 12, 16, 32, 4, 6, 34, 26, 17, 5, 41], [1, 2, 5, 11, 14, 18, 21])

julia> gn[0]  # the 0-th nearest neighbor is defined by vertex itself
1-element Vector{Int64}:
 23

julia> gn[1]  # nearest neighbors
3-element Vector{Int64}:
 14
 22
 24

julia> gn[2]  # second nearest neighbors
6-element Vector{Int64}:
 15
 13
 21
 25
 33
 31
BloqadeLattices.img_atomsMethod
img_atoms(atoms::AtomList;
    colors = [DEFAULT_LINE_COLOR[], ...],
    texts = ["1", "2", ...],
    vectors = [],
    format = :svg,
    filename = nothing,
    kwargs...
    )
img_atoms(bounded_lattice::BoundedLattice;
    colors = [DEFAULT_LINE_COLOR[], ...],
    texts = ["1", "2", ...],
    vectors = [],
    format = :svg,
    filename = nothing,
    kwargs...
    )

Plots atoms or bounded_lattice.site_positions with colors specified by colors and texts specified by texts. You will need a VSCode, Pluto notebook or Jupyter notebook to show the image. If you want to write this image to the disk without displaying it in a frontend, please try

julia> img_atoms(generate_sites(SquareLattice(), 5, 5); filename="test.png")

Keyword Arguments

  • colors is a vector of colors for nodes
  • texts is a vector of string displayed on nodes
  • vectors is a vector of (startloc, endloc) pair to specify a list of arrows.
  • format can be :svg, :pdf or :png
  • filename can be a filename string with suffix .svg, .png or .pdf

Extra Keyword Arguments

  • background_color = DEFAULT_BACKGROUND_COLOR[]
  • scale::Float64 = 1 is a multiplicative factor to rescale the atom distance for better visualization
  • xpad::Float64 = 2.5 is the padding space in x axis
  • ypad::Float64 = 1.5 is the padding space in y axis
  • unit::Int = 60 is the number of pixel per unit distance

axes

  • axes_text_color = DEFAULT_TEXT_COLOR[]
  • axes_text_fontsize::Float64 = 16.0
  • axes_num_of_xticks = 5
  • axes_num_of_yticks = 5
  • axes_x_offset::Float64 = 0.1
  • axes_y_offset::Float64 = 0.06
  • axes_unit::String = "μm"

node

  • node_text_fontsize::Float64 = 16.0
  • node_text_color = DEFAULT_TEXT_COLOR[]
  • node_stroke_color = DEFAULT_LINE_COLOR[]
  • node_stroke_linewidth = 1
  • node_fill_color = DEFAULT_NODE_COLOR[]

bond

  • bond_color = DEFAULT_LINE_COLOR[]
  • bond_linewidth::Float64 = 1.0

blockade

  • blockade_radius::Float64=0, atoms within blockade_radius will be connected by edges.
  • blockade_style::String = "none"
  • blockade_stroke_color = DEFAULT_LINE_COLOR[]
  • blockade_fill_color = "transparent"
  • blockade_fill_opacity::Float64 = 0.5
  • blockade_stroke_linewidth = 1.0 # in pt

arrow

  • arrow_linewidth
  • arrow_color
  • arrow_head_length

grid

  • grid_stroke_color="#AAAAAA"
  • grid_stroke_width::Float64=1
  • grid_stroke_style::String="dashed"
BloqadeLattices.img_maskedgridMethod
img_maskedgrid(maskedgrid::MaskedGrid;
    colors=[DEFAULT_LINE_COLOR[], ...],
    texts=["1", "2", ...],
    vectors=[],
    format=:svg,
    filename=nothing,
    kwargs...
    )

Draw a maskedgrid with colors specified by colors and texts specified by texts. You will need a VSCode, Pluto notebook or Jupyter notebook to show the image.

Keyword Arguments

  • colors is a vector of colors for nodes
  • texts is a vector of string displayed on nodes
  • vectors is a vector of arrows
  • format can be :svg, :pdf or :png
  • filename can be a filename string with suffix .svg, .png or .pdf

Extra Keyword Arguments

  • background_color = DEFAULT_BACKGROUND_COLOR[]
  • scale::Float64 = 1 is a multiplicative factor to rescale the atom distance for better visualization
  • xpad::Float64 = 2.5 is the padding space in x axis
  • ypad::Float64 = 1.5 is the padding space in y axis
  • unit::Int = 60 is the number of pixel per unit distance

axes

  • axes_text_color = DEFAULT_TEXT_COLOR[]
  • axes_text_fontsize::Float64 = 16.0
  • axes_num_of_xticks = 5
  • axes_num_of_yticks = 5
  • axes_x_offset::Float64 = 0.1
  • axes_y_offset::Float64 = 0.06
  • axes_unit::String = "μm"

node

  • node_text_fontsize::Float64 = 16.0
  • node_text_color = DEFAULT_TEXT_COLOR[]
  • node_stroke_color = DEFAULT_LINE_COLOR[]
  • node_stroke_linewidth = 1
  • node_fill_color = DEFAULT_NODE_COLOR[]

bond

  • bond_color = DEFAULT_LINE_COLOR[]
  • bond_linewidth::Float64 = 1.0

blockade

  • blockade_radius::Float64=0, atoms within blockade_radius will be connected by edges.
  • blockade_style::String = "none"
  • blockade_stroke_color = DEFAULT_LINE_COLOR[]
  • blockade_fill_color = "transparent"
  • blockade_fill_opacity::Float64 = 0.5
  • blockade_stroke_linewidth = 1.0 # in pt

arrow

  • arrow_linewidth
  • arrow_color
  • arrow_head_length

grid

  • grid_stroke_color="#AAAAAA"
  • grid_stroke_width::Float64=1
  • grid_stroke_style::String="dashed"
BloqadeLattices.lattice_sitesMethod
lattice_sites(::ChainLattice)

Returns the Bravais Lattice sites for a Chain lattice as a Tuple of Tuples containing floats.

The sites are defined as:

  • (0.0,)
BloqadeLattices.lattice_sitesMethod
lattice_sites(lattice::AbstractLattice)

Returns sites in a Bravais lattice unit cell as a Tuple of D-Tuple, where D is the space dimension.

BloqadeLattices.lattice_sitesMethod
lattice_sites(::HoneycombLattice)

Returns the Bravais Lattice sites for a Honeycomb lattice as a Tuple of Tuples containing floats.

The sites are defined as:

  • (0.0, 0.0)
  • (0.5, 0.5√3)
BloqadeLattices.lattice_sitesMethod
lattice_sites(::KagomeLattice)

Returns the Bravais Lattice sites for a Lieb lattice as a Tuple of Tuples containing floats.

The sites are defined as:

  • (0.0, 0.0)
  • (0.25, 0.25√3)
  • (0.75, 0.25√3)
BloqadeLattices.lattice_sitesMethod
lattice_sites(::LiebLattice)

Returns the Bravais Lattice sites for a Lieb lattice as a Tuple of Tuples containing floats.

The sites are defined as:

  • (0.0, 0.0)
  • (0.5, 0.0)
  • (0.0, 0.5)
BloqadeLattices.lattice_sitesMethod
lattice_sites(::RectangularLattice)

Returns the Bravais Lattice sites for a Rectangular lattice as a Tuple of Tuples containing floats.

The sites are defined as:

  • (0.0, 0.0)
BloqadeLattices.lattice_sitesMethod
lattice_sites(::SquareLattice)

Returns the Bravais Lattice sites for a Square lattice as a Tuple of Tuples containing floats.

The sites are defined as:

  • (0.0, 0.0)
BloqadeLattices.lattice_sitesMethod
lattice_sites(::TriangularLattice)

Returns the Bravais Lattice sites for a Triangular lattice as a Tuple of Tuples containing floats.

The sites are defined as:

  • (0.0, 0.0)
BloqadeLattices.lattice_sitesMethod
lattice_sites(lattice::BoundedLattice{L,C})

Returns the underlying site vectors that define the unit-cell of the BoundedLattice

julia> bl = parallelepiped_region(SquareLattice(),(3,0),(0,2);) # create a 2D BoundedLattice

julia> lattice_sites(bl) # lattice vectors used in Bravais Lattice definition of underlying SquareLattice
((0.0, 0.0), )
BloqadeLattices.lattice_vectorsMethod
lattice_vectors(::ChainLattice)

Returns the Bravais lattice vectors for a Chain lattice as a Tuple of Tuples containing floats.

The vectors are defined as:

  • 𝐚₁ = (1.0,)
BloqadeLattices.lattice_vectorsMethod
lattice_vectors(lattice::AbstractLattice)

Returns Bravais lattice vectors as a D-Tuple of D-Tuple, where D is the space dimension.

BloqadeLattices.lattice_vectorsMethod
lattice_vectors(::HoneycombLattice)

Returns the Bravais lattice vectors for a Honeycomb lattice as a Tuple of Tuples containing floats.

The vectors are defined as:

  • 𝐚₁ = (1.0, 0.0)
  • 𝐚₂ = (0.5, 0.5√3)
BloqadeLattices.lattice_vectorsMethod
lattice_vectors(::KagomeLattice)

Returns the Bravais lattice vectors for a Kagome lattice as a Tuple of Tuples containing floats.

The vectors are defined as:

  • 𝐚₁ = (1.0, 0.0)
  • 𝐚₂ = (0.5, 0.5√3)
BloqadeLattices.lattice_vectorsMethod
lattice_vectors(::LiebLattice)

Returns the Bravais lattice vectors for a Lieb lattice as a Tuple of Tuples containing floats.

The vectors are defined as:

  • 𝐚₁ = (1.0, 0.0)
  • 𝐚₂ = (0.0, 1.0)
BloqadeLattices.lattice_vectorsMethod
lattice_vectors(r::RectangularLattice)

Returns the Bravais lattice vectors for a Rectangular lattice as a Tuple of Tuples containing floats.

The vectors are defined as:

  • 𝐚₁ = (1.0, 0.0)
  • 𝐚₂ = (0.0, r.aspect_ratio), where aspect_ratio is a Float64.
BloqadeLattices.lattice_vectorsMethod
lattice_vectors(::SquareLattice)

Returns the Bravais lattice vectors for a Square lattice as a Tuple of Tuples containing floats.

The vectors are defined as:

  • 𝐚₁ = (1.0, 0.0)
  • 𝐚₂ = (0.0, 1.0)
BloqadeLattices.lattice_vectorsMethod
lattice_vectors(::TriangularLattice)

Returns the Bravais lattice vectors for a Triangular lattice as a Tuple of Tuples containing floats.

The vectors are defined as:

  • 𝐚₁ = (1.0, 0.0)
  • 𝐚₂ = (0.5, 0.5√3)
BloqadeLattices.lattice_vectorsMethod
lattice_vectors(lattice::BoundedLattice{L,C})

Returns the underlying Bravais lattice vectors of the BoundedLattice

julia> bl = parallelepiped_region(SquareLattice(),(3,0),(0,2);) # create a 2D BoundedLattice

julia> lattice_vectors(bl) # lattice vectors used in Bravais Lattice definition of underlying SquareLattice
((1.0, 0.0), (0.0, 1.0))
BloqadeLattices.make_gridMethod
make_grid(sites::AtomList; atol=...)

Create a MaskedGrid from the sites. It is required by lattice preparation of Rydberg array. Because the grid will sort the sites by rows, we need atol (default value is 10 time sit data precision) determines up to what level of round off error, two atoms belong to the same row.

BloqadeLattices.offset_axesMethod
offset_axes(sites::AtomList{D, T}, offsets::Vararg{T,D}) where {D, T}
offset_axes(offsets...)

Offset the sites by distance specified by offsets.

julia> sites = AtomList([(1.0, 2.0), (10.0, 3.0), (1.0, 12.0), (3.0, 5.0)])
4-element AtomList{2, Float64}:
 (1.0, 2.0)
 (10.0, 3.0)
 (1.0, 12.0)
 (3.0, 5.0)

julia> offset_axes(sites, 1.0, 3.0)
4-element AtomList{2, Float64}:
 (2.0, 5.0)
 (11.0, 6.0)
 (2.0, 15.0)
 (4.0, 8.0)
BloqadeLattices.parallelepiped_regionMethod
parallelepiped_region(lattice::AbstractLattice{D},M::Vararg{NTuple{D,Int},D};pbc::Bool=false;scale::Real=1)

Create a BoundedLattice given an existing lattice and tuples defining a parallelogram/paralelepiped /line segment defined by vectors that are integer multiples of the lattice vectors in lattice.

Periodic Boundary Conditions can be enable/disabled via pbc. Tuples must be the same length and quantity as the dimensions of the lattice argument.

julia> parallelepiped_region(SquareLattice(),(2,0),(0,2);pbc=true);

julia> parallelepiped_region(KagomeLattice(),(2,2),(-2,2));
BloqadeLattices.random_dropoutMethod
random_dropout(sites::AtomList{D, T}, ratio::Real) where {D, T}
random_dropout(ratio)

Randomly drop out ratio * number of sites atoms from sites, where ratio ∈ [0, 1].

BloqadeLattices.rescale_axesMethod
rescale_axes(sites::AtomList{D, T}, scale::Real) where {D, T}
rescale_axes(scale)

Rescale the sites by a constant scale.

julia> sites = AtomList([(1.0, 2.0), (10.0, 3.0), (1.0, 12.0), (3.0, 5.0)])
4-element AtomList{2, Float64}:
 (1.0, 2.0)
 (10.0, 3.0)
 (1.0, 12.0)
 (3.0, 5.0)

julia> rescale_axes(sites, 2.0)
4-element AtomList{2, Float64}:
 (2.0, 4.0)
 (20.0, 6.0)
 (2.0, 24.0)
 (6.0, 10.0)
BloqadeLattices.rydberg_interaction_matrixMethod
rydberg_interaction_matrix(atoms, C::Real)
rydberg_interaction_matrix(lattice::BoundedLattice{L,R},C::Real)

Generate the interaction matrix given an indexable iterable atoms containg atom positions and the Rydberg interaction constant C.

A BoundedLattice can be used in place of atoms which generates the Rydberg interaction matrix for the lattice, factoring in Periodic Boundary Conditions.

See also two_body_interaction_matrix

julia> atoms = [(0.0,), (1.0,), (2.0,), (3.0,)]; # 1D chain of atoms

julia> rydberg_interaction_matrix(atoms, 2π * 862690) # provide Rydberg constant
4×4 UpperTriangular{Float64, Matrix{Float64}}:
 0.0  5.42044e6  84694.4         7435.45
  ⋅   0.0            5.42044e6  84694.4
  ⋅    ⋅             0.0            5.42044e6
  ⋅    ⋅              ⋅             0.0

julia> bl = parallelepiped_region(SquareLattice(),(2,0),(0,2);pbc=true); 

julia> rydberg_interaction_matrix(bl, 2π * 862690)
4×4 UpperTriangular{Float64, Matrix{Float64}}:
 0.0  5.42044e6  5.42044e6  6.77555e5
  ⋅   0.0        6.77555e5  5.42044e6
  ⋅    ⋅         0.0        5.42044e6
  ⋅    ⋅          ⋅         0.0
BloqadeLattices.two_body_interaction_matrixMethod
two_body_interaction_matrix(f, atoms)

Generates an interaction matrix given a function f that accepts two atom positions at a time and an indexable iterable atoms containing atom positions.

See also rydberg_interaction_matrix

julia> atoms = [(0.0,), (1.0,), (2.0,), (3.0,)]; # 1D chain, can also be AtomList

julia> two_body_interaction_matrix(atoms) do x,y return 1/distance(x,y) end
4×4 UpperTriangular{Float64, Matrix{Float64}}:
 0.0  1.0  0.5  0.333333
  ⋅   0.0  1.0  0.5
  ⋅    ⋅   0.0  1.0
  ⋅    ⋅    ⋅   0.0