qml.spin.generate_lattice¶
- generate_lattice(lattice, n_cells, boundary_condition=False, neighbour_order=1)[source]¶
Generates a
Latticeobject for a given lattice shape and number of cells.- 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.
boundary_condition (bool or list[bool]) – Defines boundary conditions in different lattice axes. Default is
Falseindicating open boundary condition.neighbour_order (int) – Specifies the interaction level for neighbors within the lattice. Default is 1, indicating nearest neighbour.
- Returns:
lattice object.
- Return type:
Example
>>> shape = 'square' >>> n_cells = [2, 2] >>> boundary_condition = [True, False] >>> lattice = qml.spin.generate_lattice(shape, n_cells, boundary_condition) >>> lattice.edges [(2, 3, 0), (0, 2, 0), (1, 3, 0), (0, 1, 0)]
Lattice details
The following lattice shapes are currently supported.
'chain': linear arrangement of sites in one dimension'square': square arrangement of sites in two dimensions'rectangle': rectangular arrangement of sites in two dimensions'triangle': triangular arrangement of sites in two dimensions [Phys. Rev. B 7, 5017 (1973)]'honeycomb': honeycomb arrangement of sites in two dimensions'kagome': kagome arrangement of sites in two dimensions [Prog. Theor. Phys. 6, 306 (1951)]'lieb': Lieb arrangement of sites in two dimensions [arXiv:1004.5172]'cubic': cubic arrangement of sites in three dimensions'bcc': body-centered cubic arrangement of sites in three dimensions'fcc': face-centered cubic arrangement of sites in three dimensions'diamond': diamond arrangement of sites in three dimensions