qml.spin.heisenberg

heisenberg(lattice, n_cells, coupling=None, boundary_condition=False, neighbour_order=1)[source]

Generates the Hamiltonian for the Heisenberg model on a lattice.

The Hamiltonian is represented as:

\[\hat{H} = J\sum_{<i,j>}(\sigma_i^x\sigma_j^x + \sigma_i^y\sigma_j^y + \sigma_i^z\sigma_j^z)\]

where J is the coupling constant defined for the Hamiltonian, and i,j represent the indices for neighbouring spins.

Parameters
  • lattice (str) – Shape of the lattice. Input values can be 'chain', 'square', 'rectangle', 'honeycomb', 'triangle', or 'kagome'.

  • n_cells (List[int]) – Number of cells in each direction of the grid.

  • coupling (List[List[float]] or List[math.array[float]]) – Coupling between spins. It can be a 2D array of shape (neighbour_order, 3) or a 3D array of shape (3, num_spins, num_spins), where num_spins is the total number of spins.

  • boundary_condition (bool or list[bool]) – Defines boundary conditions for different lattice axes, default is False indicating open boundary condition.

  • neighbour_order (int) – Specifies the interaction level for neighbors within the lattice. Default is 1, indicating nearest neighbours.

Returns

Hamiltonian for the heisenberg model.

Return type

Sum

Example

>>> n_cells = [2,2]
>>> j = [[0.5, 0.5, 0.5]]
>>> spin_ham = qml.spin.heisenberg("square", n_cells, coupling=j)
>>> spin_ham
(
0.5 * (X(0) @ X(1))
+ 0.5 * (Y(0) @ Y(1))
+ 0.5 * (Z(0) @ Z(1))
+ 0.5 * (X(0) @ X(2))
+ 0.5 * (Y(0) @ Y(2))
+ 0.5 * (Z(0) @ Z(2))
+ 0.5 * (X(1) @ X(3))
+ 0.5 * (Y(1) @ Y(3))
+ 0.5 * (Z(1) @ Z(3))
+ 0.5 * (X(2) @ X(3))
+ 0.5 * (Y(2) @ Y(3))
+ 0.5 * (Z(2) @ Z(3))
)