# netket.graph.Lattice¶

class netket.graph.Lattice

A generic 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), by its coordinates (actual position in space), or by a set of integers (the site vector), which indicates how many translations of each basis vectors have been performed while building the graph. The i-th component refers to translations along the i-th basis_vector direction.

__init__(self: netket._C_netket.graph.Lattice, basis_vectors: List[List[float]], extent: List[int], pbc: List[bool] = [], atoms_coord: List[List[float]] = []) → None

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 – 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_sites)
12


Methods

 __init__(self, basis_vectors, extent, pbc, …) Constructs a new Lattice given its side length and the features of the unit cell. atom_label(self, site) Member function returning the atom label indicating which of the unit cell atoms is located at a given a site index. site_to_coord(self, site) Member function returning the coordinates of a given site index. site_to_vector(self, site) Member function returning the site vector corresponding to a given site index. vector_to_coord(self, site_vector, atom_label) Member function returning the coordinates of a given atom characterized by a given site vector. vector_to_site(self, site_vector) Member function returning the site index corresponding to a given site vector.

Attributes

 adjacency_list The adjacency list of the graph where each node is represented by an integer in [0, n_sites). automorphisms The automorphisms of the graph, including translation symmetries only. basis_vectors The basis vectors of the lattice. coordinates The coordinates of the atoms in the lattice. distances The distances between the nodes. edges The graph edges. is_bipartite Whether the graph is bipartite. is_connected Whether the graph is connected. n_dim The dimension of the lattice. n_sites The number of vertices in the graph.
property adjacency_list

The adjacency list of the graph where each node is represented by an integer in [0, n_sites).

Type

list

atom_label(self: netket._C_netket.graph.Lattice, site: int) → int

Member function returning the atom label indicating which of the unit cell atoms is located at a given a site index.

Parameters

site – The site index.

property automorphisms

The automorphisms of the graph, including translation symmetries only.

Type

list[list]

property basis_vectors

The basis vectors of the lattice.

Type

list[list]

property coordinates

The coordinates of the atoms in the lattice.

Type

list[list]

property distances

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

Type

list[list]

property edges

The graph edges.

Type

list

property is_bipartite

Whether the graph is bipartite.

Type

bool

property is_connected

Whether the graph is connected.

Type

bool

property n_dim

The dimension of the lattice.

Type

int

property n_sites

The number of vertices in the graph.

Type

int

site_to_coord(self: netket._C_netket.graph.Lattice, site: int) → List[float]

Member function returning the coordinates of a given site index.

Args:

site: The site index.

site_to_vector(self: netket._C_netket.graph.Lattice, site: int) → List[int]

Member function returning the site vector corresponding to a given site index.

Parameters

site – The site index.

Examples

Constructs a square 2X2 lattice without periodic boundary conditions and prints the site vectors corresponding to given site indices.

>>> import netket
>>> g=netket.graph.Lattice(basis_vectors=[[1.,0.],[0.,1.]], extent=[2,2], pbc=[0,0])
>>> print(list(map(int,g.site_to_vector(0))))
[0, 0]
>>> print(list(map(int,g.site_to_vector(1))))
[0, 1]
>>> print(list(map(int,g.site_to_vector(2))))
[1, 0]
>>> print(list(map(int,g.site_to_vector(3))))
[1, 1]

vector_to_coord(self: netket._C_netket.graph.Lattice, site_vector: List[int], atom_label: int) → List[float]

Member function returning the coordinates of a given atom characterized by a given site vector.

Args:

site_vector: The site vector. atom_label: Which of the atoms in the unit cell.

vector_to_site(self: netket._C_netket.graph.Lattice, site_vector: List[int]) → int

Member function returning the site index corresponding to a given site vector.

Args:

site_vector: The site vector.