1.2. qlinks.lattice.square_lattice#

Classes

LocalOperator(*args, **kwargs)

Plaquette(lattice, site[, _mask])

Plaquette operator on a square lattice.

SquareLattice(length_x, length_y[, links])

A square lattice with periodic boundary condition.

Vertex(lattice, site[, _mask])

class qlinks.lattice.square_lattice.SquareLattice(length_x, length_y, links=None)[source]#

Bases: object

A square lattice with periodic boundary condition.

Parameters:
  • length_x (int) – The length of lattice in x direction.

  • length_y (int) – The length of lattice in y direction.

  • links (ndarray[Any, dtype[int64]] | None) – The link data in shape (n_links,), optional.

length_x: int#
length_y: int#
property shape: Tuple[int, int]#
property size: int#
property index: int#
Returns:

The integer representation of the binary link data.

Raises:

ValueError – If the link data is not binary or emtpy.

site_index(site)[source]#
Parameters:

site (Site)

Return type:

int

iter_plaquettes()[source]#
Return type:

Iterator[Plaquette]

Return type:

ndarray[Any, dtype[int64]]

Parameters:
Return type:

None

charge(site)[source]#
Parameters:

site (Site)

Return type:

int | float

axial_flux(idx, axis=0)[source]#

Compute the electric flux along the axis.

▲ | │ │ | ▼ ▲

──►o──|──►o──► │

▲ | │

—│——▼—- axis=1 ◄──o◄─|───o◄──

▲ | │ │ | ▼

axis=0 ──►

Parameters:
  • idx (int) – The idx-th row or column in lattice. Negative values or values greater than the length are permissible.

  • axis (int | None) – 0 for x-axis and 1 for y-axis, default 0.

Returns:

The total electric flux flowing along the axis, in unit of e/2.

Return type:

float

Notes

The flux cross-section is perpendicular to the axis.

bipartite_index(idx, axis=0)[source]#

Bi-partition the lattice links along the axis at the idx-th row or column.


|│ ▲ │ |│ │

──o──────|o──

———-|—- axis=1

|│ │ |

──o──────|o──

|│ │ |


axis=0 ──►

Parameters:
  • idx (int) – The idx-th row or column in lattice.

  • axis (int | None) – 0 for x-axis and 1 for y-axis, default 0.

Return type:

Tuple[ndarray[Any, dtype[int64]], ndarray[Any, dtype[int64]]]

Returns: A tuple of two arrays:
  • first_partition_idx: The indices of links in the first partition.

  • second_partition_idx: The indices of links in the second partition.

adjacency_matrix()[source]#

Returns:

Return type:

ndarray[Any, dtype[int64]]

as_graph()[source]#
Return type:

MultiDiGraph

__init__(length_x, length_y, links=None)#
Parameters:
  • length_x (int)

  • length_y (int)

  • links (ndarray[Any, dtype[int64]] | None)

Return type:

None

class qlinks.lattice.square_lattice.LocalOperator(*args, **kwargs)[source]#

Bases: Protocol

lattice: SquareLattice#
site: Site#
Return type:

ndarray[Any, dtype[int64]]

flippable(basis)[source]#
Parameters:

basis (ComputationBasis)

Return type:

ndarray[Any, dtype[bool_]]

__init__(*args, **kwargs)#
class qlinks.lattice.square_lattice.Plaquette(lattice, site, _mask=None)[source]#

Bases: LocalOperator

Plaquette operator on a square lattice.

Parameters:
  • lattice (SquareLattice) – The lattice on which the plaquette operator acts.

  • site (Site) – The site on lower-left corner of the plaquette.

  • _mask (int) – The binary mask of the plaquette operator, optional.

Examples:

Return type:

ndarray[Any, dtype[int64]]

flippable(basis)[source]#
Parameters:

basis (ComputationBasis)

Return type:

ndarray[Any, dtype[bool_]]

__init__(lattice, site, _mask=None)#
Parameters:
Return type:

None

class qlinks.lattice.square_lattice.Vertex(lattice: 'SquareLattice', site: 'Site', _mask: 'int' = None)[source]#

Bases: LocalOperator

Parameters:
static order()[source]#
Return type:

ndarray[Any, dtype[int64]]

Return type:

ndarray[Any, dtype[int64]]

flippable(basis)[source]#
Parameters:

basis (ComputationBasis)

Return type:

ndarray[Any, dtype[bool_]]

__init__(lattice, site, _mask=None)#
Parameters:
Return type:

None