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, \(<i,j>\) represents the indices for neighbouring sites and \(\sigma\) is a Pauli operator.

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

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

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

  • boundary_condition (bool or list[bool]) – Specifies whether or not to enforce periodic boundary conditions for the 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 = np.array([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))
)