netket.graph.Grid

Contents

netket.graph.Grid#

class netket.graph.Grid[source]#

Bases:

Constructs a hypercubic lattice given its extent in all dimensions.

Parameters:
  • extent (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.

  • color_edges (bool) – generates nearest-neighbour edges colored according to direction i.e. edges along Cartesian direction #i have color i cannot be used with max_neighbor_order or custom_edges

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

Return type:

Lattice

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