qlinks.lattice package#
Submodules#
qlinks.lattice.chain module#
- class qlinks.lattice.chain.ChainLattice(length, boundary_condition=BoundaryCondition.OPEN)[source]#
Bases:
LatticeGraphOne-dimensional chain.
- Sites:
i = 0, …, L - 1
- Open boundary:
links i -> i + 1 for i = 0, …, L - 2
- Periodic boundary:
same as open, plus L - 1 -> 0
- boundary_condition: BoundaryCondition | str#
qlinks.lattice.graph module#
- class qlinks.lattice.graph.LatticeGraph(sites, links, plaquettes=(), boundary_condition=BoundaryCondition.OPEN, translations=<factory>)[source]#
Bases:
objectPure geometry/topology object.
This class knows only about sites, links, incidence, adjacency, plaquettes, and translations. It knows nothing about physical variables, Gauss laws, dimers, spins, Hamiltonians, or constraints.
- boundary_condition: BoundaryCondition | str#
- property link_endpoints: ndarray[tuple[Any, ...], dtype[int64]]#
Array of shape (num_links, 2), with columns [source, target].
- incidence_matrix()[source]#
Return the oriented site-link incidence matrix B.
Convention:
B[source, link] = -1 B[target, link] = +1
This is the natural convention for divergence-like constraints.
- plaquette_incidence_matrix()[source]#
Return oriented link-plaquette incidence matrix.
The matrix has shape
(num_links, num_plaquettes)and entriesB[link, plaquette] = +1 or -1
depending on the orientation of the link in the plaquette boundary.
- translate_site(site_id, displacement)[source]#
Translate a site by an integer lattice displacement.
Returns None if the translation is not defined, e.g. for an open-boundary site translated out of the system.
- oriented_link_between(source, target)[source]#
Return (link_id, orientation) for a directed traversal source -> target.
orientation = +1 means traversal agrees with stored link orientation. orientation = -1 means traversal is opposite to stored link orientation.
- __init__(sites, links, plaquettes=(), boundary_condition=BoundaryCondition.OPEN, translations=<factory>)#
qlinks.lattice.honeycomb module#
- class qlinks.lattice.honeycomb.HoneycombLattice(lx, ly, boundary_condition=BoundaryCondition.OPEN)[source]#
Bases:
LatticeGraphHoneycomb lattice in a brick-wall representation.
- Unit cell:
A(x, y), sublattice 0 B(x, y), sublattice 1
- Site id:
site_id(x, y, sublattice) = 2 * (x * ly + y) + sublattice
- Links:
z: A(x, y) -> B(x, y) x: A(x, y) -> B(x - 1, y) y: A(x, y) -> B(x, y - 1)
- Hexagon plaquette around cell (x, y):
A(x,y) B(x,y) A(x+1,y) B(x+1,y-1) A(x+1,y-1) B(x,y-1)
This representation is convenient for QDM/QLM hexagon ring exchange.
- lx#
- ly#
qlinks.lattice.square module#
- class qlinks.lattice.square.SquareLattice(lx, ly, boundary_condition=BoundaryCondition.OPEN)[source]#
Bases:
LatticeGraphTwo-dimensional square lattice.
Site id convention:
site_id(x, y) = x * Ly + y
Link orientation convention:
x-link: (x, y) -> (x + 1, y) y-link: (x, y) -> (x, y + 1)
Plaquette orientation convention:
- counter-clockwise loop:
bottom edge: +x right edge: +y top edge: -x left edge: -y
- lx#
- ly#
qlinks.lattice.triangular module#
- class qlinks.lattice.triangular.TriangularLattice(lx, ly, boundary_condition=BoundaryCondition.OPEN, *, include_triangles=True, include_rhombi=True)[source]#
Bases:
LatticeGraph2D triangular lattice.
- Site convention:
site_id(x, y) = x * ly + y
- Primitive vectors:
a1 = (1, 0) a2 = (1/2, sqrt(3)/2)
- Link directions:
a: (x, y) -> (x + 1, y) b: (x, y) -> (x, y + 1) c: (x, y) -> (x - 1, y + 1)
- Plaquettes:
- triangle_up / triangle_down:
elementary triangular loops.
- rhombus_ab / rhombus_bc / rhombus_ca:
four-link lozenge loops. These are the natural QDM resonance plaquettes on triangular lattices.
- __init__(lx, ly, boundary_condition=BoundaryCondition.OPEN, *, include_triangles=True, include_rhombi=True)[source]#
- lx#
- ly#
qlinks.lattice.types module#
- class qlinks.lattice.types.BoundaryCondition(*values)[source]#
Bases:
StrEnumSupported lattice boundary conditions.
- OPEN = 'open'#
- PERIODIC = 'periodic'#
- class qlinks.lattice.types.Site(id, cell, sublattice=0, position=())[source]#
Bases:
objectGeometry-level site metadata.
- id:
Consecutive integer site id.
- cell:
Unit-cell coordinate, e.g. (x,), (x, y), etc.
- sublattice:
Sublattice label. For Bravais lattices, this can be 0.
- position:
Real-space embedding coordinate. This is for geometry/debugging/plotting. It should not be used as the primary index in performance-sensitive code.
- __init__(id, cell, sublattice=0, position=())#
- class qlinks.lattice.types.Link(id, source, target, kind='', wrap=False)[source]#
Bases:
objectOriented link metadata.
The link orientation is source -> target.
This orientation defines the sign convention in the incidence matrix:
incidence[source, link] = -1 incidence[target, link] = +1
- kind:
A geometry-dependent link type, e.g. “x”, “y”, “diag”, etc.
- wrap:
True if this link crosses a periodic boundary.
- __init__(id, source, target, kind='', wrap=False)#
- class qlinks.lattice.types.OrientedLink(link_id, orientation)[source]#
Bases:
objectA link with an orientation relative to a plaquette boundary.
orientation = +1 means the plaquette traverses the link along its stored source -> target direction.
orientation = -1 means the plaquette traverses the link opposite to its stored source -> target direction.
- __init__(link_id, orientation)#
- class qlinks.lattice.types.Plaquette(id, links, orientations, sites, kind='', anchor_cell=())[source]#
Bases:
objectOriented elementary loop.
- links:
Link ids around the loop.
- orientations:
- For each link in the loop:
+1 if traversed along the stored link orientation, -1 if traversed opposite to the stored link orientation.
- sites:
Site ids around the loop. This is metadata useful for debugging, plotting, and later local operator construction.
kind: Geometry-dependent plaquette type.
anchor_cell: Unit-cell coordinate used to label this plaquette.
- property boundary: tuple[OrientedLink, ...]#
Return the oriented boundary links of this plaquette.
- __init__(id, links, orientations, sites, kind='', anchor_cell=())#
Module contents#
- class qlinks.lattice.BoundaryCondition(*values)[source]#
Bases:
StrEnumSupported lattice boundary conditions.
- OPEN = 'open'#
- PERIODIC = 'periodic'#
- class qlinks.lattice.ChainLattice(length, boundary_condition=BoundaryCondition.OPEN)[source]#
Bases:
LatticeGraphOne-dimensional chain.
- Sites:
i = 0, …, L - 1
- Open boundary:
links i -> i + 1 for i = 0, …, L - 2
- Periodic boundary:
same as open, plus L - 1 -> 0
- boundary_condition: BoundaryCondition | str#
- class qlinks.lattice.HoneycombLattice(lx, ly, boundary_condition=BoundaryCondition.OPEN)[source]#
Bases:
LatticeGraphHoneycomb lattice in a brick-wall representation.
- Unit cell:
A(x, y), sublattice 0 B(x, y), sublattice 1
- Site id:
site_id(x, y, sublattice) = 2 * (x * ly + y) + sublattice
- Links:
z: A(x, y) -> B(x, y) x: A(x, y) -> B(x - 1, y) y: A(x, y) -> B(x, y - 1)
- Hexagon plaquette around cell (x, y):
A(x,y) B(x,y) A(x+1,y) B(x+1,y-1) A(x+1,y-1) B(x,y-1)
This representation is convenient for QDM/QLM hexagon ring exchange.
- lx#
- ly#
- class qlinks.lattice.KagomeLattice(lx, ly, boundary_condition=BoundaryCondition.OPEN, *, include_triangles=True, include_hexagons=True)[source]#
Bases:
LatticeGraphTwo-dimensional kagome lattice with a three-site triangular unit cell.
- Unit cell:
A(x, y), sublattice 0 B(x, y), sublattice 1 C(x, y), sublattice 2
- Primitive vectors:
a1 = (1, 0) a2 = (1/2, sqrt(3)/2)
- Link convention:
Each unit cell contributes six nearest-neighbor bonds:
ab : A(x, y) -> B(x, y) ab_prev : A(x, y) -> B(x - 1, y) ac : A(x, y) -> C(x, y) ac_prev : A(x, y) -> C(x, y - 1) bc : B(x, y) -> C(x, y) bc_next : B(x, y) -> C(x + 1, y - 1)
- Plaquettes:
triangle_up / triangle_down are included for visualization and local geometry diagnostics. Kagome QDM/QLM resonance terms use only the hexagon plaquettes returned by
qdm_plaquette_ids()andqlm_plaquette_ids().
- __init__(lx, ly, boundary_condition=BoundaryCondition.OPEN, *, include_triangles=True, include_hexagons=True)[source]#
- lx#
- ly#
- class qlinks.lattice.LatticeGraph(sites, links, plaquettes=(), boundary_condition=BoundaryCondition.OPEN, translations=<factory>)[source]#
Bases:
objectPure geometry/topology object.
This class knows only about sites, links, incidence, adjacency, plaquettes, and translations. It knows nothing about physical variables, Gauss laws, dimers, spins, Hamiltonians, or constraints.
- boundary_condition: BoundaryCondition | str#
- property link_endpoints: ndarray[tuple[Any, ...], dtype[int64]]#
Array of shape (num_links, 2), with columns [source, target].
- incidence_matrix()[source]#
Return the oriented site-link incidence matrix B.
Convention:
B[source, link] = -1 B[target, link] = +1
This is the natural convention for divergence-like constraints.
- plaquette_incidence_matrix()[source]#
Return oriented link-plaquette incidence matrix.
The matrix has shape
(num_links, num_plaquettes)and entriesB[link, plaquette] = +1 or -1
depending on the orientation of the link in the plaquette boundary.
- translate_site(site_id, displacement)[source]#
Translate a site by an integer lattice displacement.
Returns None if the translation is not defined, e.g. for an open-boundary site translated out of the system.
- oriented_link_between(source, target)[source]#
Return (link_id, orientation) for a directed traversal source -> target.
orientation = +1 means traversal agrees with stored link orientation. orientation = -1 means traversal is opposite to stored link orientation.
- __init__(sites, links, plaquettes=(), boundary_condition=BoundaryCondition.OPEN, translations=<factory>)#
- class qlinks.lattice.Link(id, source, target, kind='', wrap=False)[source]#
Bases:
objectOriented link metadata.
The link orientation is source -> target.
This orientation defines the sign convention in the incidence matrix:
incidence[source, link] = -1 incidence[target, link] = +1
- kind:
A geometry-dependent link type, e.g. “x”, “y”, “diag”, etc.
- wrap:
True if this link crosses a periodic boundary.
- __init__(id, source, target, kind='', wrap=False)#
- class qlinks.lattice.OrientedLink(link_id, orientation)[source]#
Bases:
objectA link with an orientation relative to a plaquette boundary.
orientation = +1 means the plaquette traverses the link along its stored source -> target direction.
orientation = -1 means the plaquette traverses the link opposite to its stored source -> target direction.
- __init__(link_id, orientation)#
- class qlinks.lattice.Plaquette(id, links, orientations, sites, kind='', anchor_cell=())[source]#
Bases:
objectOriented elementary loop.
- links:
Link ids around the loop.
- orientations:
- For each link in the loop:
+1 if traversed along the stored link orientation, -1 if traversed opposite to the stored link orientation.
- sites:
Site ids around the loop. This is metadata useful for debugging, plotting, and later local operator construction.
kind: Geometry-dependent plaquette type.
anchor_cell: Unit-cell coordinate used to label this plaquette.
- property boundary: tuple[OrientedLink, ...]#
Return the oriented boundary links of this plaquette.
- __init__(id, links, orientations, sites, kind='', anchor_cell=())#
- class qlinks.lattice.Site(id, cell, sublattice=0, position=())[source]#
Bases:
objectGeometry-level site metadata.
- id:
Consecutive integer site id.
- cell:
Unit-cell coordinate, e.g. (x,), (x, y), etc.
- sublattice:
Sublattice label. For Bravais lattices, this can be 0.
- position:
Real-space embedding coordinate. This is for geometry/debugging/plotting. It should not be used as the primary index in performance-sensitive code.
- __init__(id, cell, sublattice=0, position=())#
- class qlinks.lattice.SquareLattice(lx, ly, boundary_condition=BoundaryCondition.OPEN)[source]#
Bases:
LatticeGraphTwo-dimensional square lattice.
Site id convention:
site_id(x, y) = x * Ly + y
Link orientation convention:
x-link: (x, y) -> (x + 1, y) y-link: (x, y) -> (x, y + 1)
Plaquette orientation convention:
- counter-clockwise loop:
bottom edge: +x right edge: +y top edge: -x left edge: -y
- lx#
- ly#
- class qlinks.lattice.TriangularLattice(lx, ly, boundary_condition=BoundaryCondition.OPEN, *, include_triangles=True, include_rhombi=True)[source]#
Bases:
LatticeGraph2D triangular lattice.
- Site convention:
site_id(x, y) = x * ly + y
- Primitive vectors:
a1 = (1, 0) a2 = (1/2, sqrt(3)/2)
- Link directions:
a: (x, y) -> (x + 1, y) b: (x, y) -> (x, y + 1) c: (x, y) -> (x - 1, y + 1)
- Plaquettes:
- triangle_up / triangle_down:
elementary triangular loops.
- rhombus_ab / rhombus_bc / rhombus_ca:
four-link lozenge loops. These are the natural QDM resonance plaquettes on triangular lattices.
- __init__(lx, ly, boundary_condition=BoundaryCondition.OPEN, *, include_triangles=True, include_rhombi=True)[source]#
- lx#
- ly#