netket.graph.Grid

class netket.graph.Grid(extent=None, *, length=None, pbc=True)[source]

Constructs a hypercubic lattice given its extent in all dimensions.

Parameters
  • extent (Optional[Sequence[int]]) – Size of the lattice along each dimension. It must be a list with integer components >= 1.

  • pbc (Union[bool, Sequence[bool]]) – If True, the grid will have periodic boundary conditions (PBC); if False, the grid will have open boundary conditions (OBC). This parameter can also be a list of booleans with same length as the parameter length, in which case each dimension will have PBC/OBC depending on the corresponding entry of pbc.

Examples

Construct a 5x10 square lattice with periodic boundary conditions:

>>> import netket
>>> g=netket.graph.Grid(extent=[5, 10], pbc=True)
>>> print(g.n_nodes)
50

Construct a 2x2x3 cubic lattice with open boundary conditions:

>>> g=netket.graph.Grid(extent=[2,2,3], pbc=False)
>>> print(g.n_nodes)
12
Return type

Lattice