class netket.graph.Grid(extent=None, *, length=None, pbc=True, **kwargs)ΒΆ

Constructs a hypercubic lattice given its extent in all dimensions.

  • 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.

  • kwargs – Additional keyword arguments are passed on to the constructor of netket.graph.Lattice.


Construct a 5x10 square lattice with periodic boundary conditions:

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

Construct a 2x2x3 cubic lattice with open boundary conditions:

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