netket.graph.Lattice

class netket.graph.Lattice(basis_vectors, extent, *, pbc=True, atoms_coord=[])[source]

Bases: netket.graph.graph.NetworkX

A lattice built translating a unit cell and adding edges between nearest neighbours sites.

The unit cell is defined by the basis_vectors and it can contain an arbitrary number of atoms. Each atom is located at an arbitrary position and is labelled by an integer number, meant to distinguish between the different atoms within the unit cell. Periodic boundary conditions can also be imposed along the desired directions. There are three different ways to refer to the lattice sites. A site can be labelled by a simple integer number (the site index) or by its coordinates (actual position in space).

__init__(basis_vectors, extent, *, pbc=True, atoms_coord=[])[source]

Constructs a new Lattice given its side length and the features of the unit cell.

Parameters
  • basis_vectors – The basis vectors of the unit cell.

  • extent – The number of copies of the unit cell.

  • pbc (bool) – If True then the constructed lattice will have periodic boundary conditions, otherwise open boundary conditions are imposed (default=``True``).

  • atoms_coord – The coordinates of different atoms in the unit cell (default=one atom at the origin).

Examples

Constructs a rectangular 3X4 lattice with periodic boundary conditions.

>>> import netket
>>> g=netket.graph.Lattice(basis_vectors=[[1,0],[0,1]],extent=[3,4])
>>> print(g.n_nodes)
12
Attributes
atoms_coord

Coordinates of atoms in the unit cell.

basis_vectors
n_edges

The number of edges in the graph.

Return type

int

n_nodes

The number of nodes (or vertices) in the graph

Return type

int

Methods
adjacency_list()

List containing the adjacency list of the graph where each node is represented by an integer in [0, n_nodes)

Return type

List[List]

atom_label(site)[source]
automorphisms()

Symmetry group containing the automorphisms of the graph

Return type

SymmGroup

coord_to_site(coord)[source]
distances()

List containing the distances between the nodes. The fact that some node may not be reachable from another is represented by -1

Return type

List[List]

edges(color=False)

Iterator over the edges of the graph

Return type

Generator

Parameters

color (Union[bool, int]) –

is_bipartite()

True if the graph is bipartite

Return type

bool

is_connected()

True if the graph is connected

Return type

bool

nodes()

Iterator over the nodes of the graph

Return type

Generator

site_to_coord(site)[source]
site_to_vector(site)[source]
vector_to_coord(vector)[source]