qml.spin.transverse_ising¶
-
transverse_ising
(lattice, n_cells, coupling=1.0, h=1.0, boundary_condition=False, neighbour_order=1)[source]¶ Generates the Hamiltonian for the transverse-field Ising model on a lattice.
The Hamiltonian is represented as:
\[\hat{H} = -J \sum_{<i,j>} \sigma_i^{z} \sigma_j^{z} - h\sum_{i} \sigma_{i}^{x}\]where
J
is the coupling parameter defined for the Hamiltonian,h
is the strength of the transverse magnetic field andi,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 (float or List[float] or List[math.array[float]]) – Coupling between spins. It can be a number, a list of length equal to
neighbour_order
or a square matrix of shape(num_spins, num_spins)
, wherenum_spins
is the total number of spins. Default value is 1.0.h (float) – Value of external magnetic field. Default is 1.0.
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 transverse-field Ising model.
- Return type
Example
>>> n_cells = [2,2] >>> j = 0.5 >>> h = 0.1 >>> spin_ham = qml.spin.transverse_ising("square", n_cells, coupling=j, h=h) >>> spin_ham ( -0.5 * (Z(0) @ Z(1)) + -0.5 * (Z(0) @ Z(2)) + -0.5 * (Z(1) @ Z(3)) + -0.5 * (Z(2) @ Z(3)) + -0.1 * X(0) + -0.1 * X(1) + -0.1 * X(2) + -0.1 * X(3) )