tensorcircuit.templates.hamiltonians¶

tensorcircuit.templates.hamiltonians.heisenberg_hamiltonian(lattice: AbstractLattice, j_coupling: float | List[float] | Tuple[float, ...] = 1.0, interaction_scope: str = 'neighbors') Any[source]¶

Generates the sparse matrix of the Heisenberg Hamiltonian for a given lattice.

The Heisenberg Hamiltonian is defined as: \(H = J\sum_{i,j} (X_i X_j + Y_i Y_j + Z_i Z_j)\) where the sum is over a specified set of interacting pairs {i,j}.

Parameters:
  • lattice (AbstractLattice) – An instance of a class derived from AbstractLattice, which provides the geometric information of the system.

  • j_coupling (Union[float, List[float], Tuple[float, ...]], optional) – The coupling constants. Can be a single float for an isotropic model (Jx=Jy=Jz) or a list/tuple of 3 floats for an anisotropic model (Jx, Jy, Jz). Defaults to 1.0.

  • interaction_scope (str, optional) – Defines the range of interactions. - “neighbors”: Includes only nearest-neighbor pairs (default). - “all”: Includes all unique pairs of sites.

Returns:

The Hamiltonian as a backend-agnostic sparse matrix.

Return type:

Any

tensorcircuit.templates.hamiltonians.rydberg_hamiltonian(lattice: AbstractLattice, omega: float, delta: float, c6: float) Any[source]¶

Generates the sparse matrix of the Rydberg atom array Hamiltonian.

The Hamiltonian is defined as: .. math:

H = sum_i frac{Omega}{2} X_i
  • sum_i frac{delta}{2} bigl(1 - Z_i bigr)

  • sum_{i<j} frac{V_{ij}}{4} bigl(1 - Z_i bigr)bigl(1 - Z_j bigr)

= sum_i frac{Omega}{2} X_i
  • sum_i frac{delta}{2} Z_i

  • sum_{i<j} frac{V_{ij}}{4},bigl(Z_i Z_j - Z_i - Z_j bigr)

where \(V_{ij} = C6 / |r_i - r_j|^6\).

Note: Constant energy offset terms (proportional to the identity operator) are ignored in this implementation.

Parameters:
  • lattice (AbstractLattice) – An instance of a class derived from AbstractLattice, which provides site coordinates and the distance matrix.

  • omega (float) – The Rabi frequency (Ω) of the driving laser field.

  • delta (float) – The laser detuning (δ).

  • c6 (float) – The Van der Waals interaction coefficient (C6).

Returns:

The Hamiltonian as a backend-agnostic sparse matrix.

Return type:

Any