quantax.sites.Sites#

class quantax.sites.Sites#

A collection of multiple spins or fermions that make up the quantum system.

__init__(nsites: int, is_fermion: bool = False, coord: ndarray | None = None)#
Parameters:
  • nsites – The number of sites in the system.

  • is_fermion – Whether the system is made of fermions or spins. Default to False (spins).

  • coord – The coordinates of sites. This doesn’t have to be specified if the spatial information is unnecessary.

property nsites: int#

The number of sites

property nstates: int#

The number of qubits, which should be nsites for spins and 2 * nsites for spinful fermions.

property ndim: int#

The number of spatial dimensions, e.g. 2 for square lattice and 3 for cubic.

property is_fermion: bool#

Whether the system is made of fermions

property coord: ndarray#

Real space coordinates of all sites

property dist: ndarray#

Matrix of the real space distance between all site pairs.

Tip

dist[2, 3] is the distance between site 2 and 3.

property sign: ndarray#

Matrix of the sign between all site pairs, which is non-trivial only for fermionic systems with anti-periodic boundary conditions.

Tip

sign[2, 3] is the sign of the bond connecting site 2 and 3.

get_neighbor(n_neighbor: int | Sequence[int] = 1, return_sign: bool = False) ndarray | Sequence[ndarray] | tuple#

Gets n’th-nearest neighbor site pairs.

Parameters:
  • n_neighbor – The n’th-nearest neighbor to obtain. The nearest neighbor is given by 1. If it’s a sequence, then multiple neighbors will be returned in the same order.

  • return_sign – Whether this function should also return the sign of neighbor bonds. The sign is non-trivial only for fermionic systems with anti-periodic boundary conditions.

Returns:

neighbor

If n_neighbor is int, then a 2D numpy array with each row a pair of neighbor site indeces. If n_neighbor is sequence, then a list with each item a 2D numpy array corresponding to n_neighbor items.

sign

The sign of neighbor bonds. Only provided if return_sign is True.

plot(figsize: Sequence[int | float] = (10, 10), markersize: int | float | None = None, color: str | Sequence[str] = 'C0', show_index: bool = True, index_fontsize: int | float | None = None, neighbor_bonds: int | Sequence[int] = 1) Figure#

Plot the sites and neighbor bonds in the real space.

Parameters:
  • figsize – Figure size.

  • markersize – Size of markers that represent the sites.

  • color – Color of sites in the figure.

  • show_index – Whether to show index number at each site.

  • index_fontsize – Fontsize if the index number is shown.

  • neighbor_bonds – The n’th-nearest neighbor bonds to show. Set this value to 0 to hide all bonds.

Returns:

A matplotlib figure containing the geometrical plot of sites.