netket.operator.GraphOperator

Contents

netket.operator.GraphOperator#

netket.operator.GraphOperator(hilbert, graph, site_ops=[], bond_ops=[], bond_ops_colors=[], dtype=None, *, acting_on_subspace=None, cls=<class 'netket.operator._local_operator.jax.LocalOperatorJax'>)[source]#

A graph-based quantum operator. In its simplest terms, this is the sum of local operators living on the edge of an arbitrary graph.

A GraphOperator is constructed giving a hilbert space and either a list of operators acting on sites or a list acting on the bonds. Users can specify the color of the bond that an operator acts on, if desired. If none are specified, the bond operators act on all edges.

Parameters:
  • hilbert (AbstractHilbert) – Hilbert space the operator acts on.

  • graph (AbstractGraph) – The graph whose vertices and edges are considered to construct the operator

  • site_ops – A list of operators in matrix form that act on the nodes of the graph. The default is an empty list. Note that if no site_ops are specified, the user must give a list of bond operators.

  • bond_ops – A list of operators that act on the edges of the graph. The default is None. Note that if no bond_ops are specified, the user must give a list of site operators.

  • bond_ops_colors – A list of edge colors, specifying the color each bond operator acts on. The default is an empty list.

  • dtype (Union[None, str, type[Any], dtype, _SupportsDType]) – Data type of the matrix elements.

  • acting_on_subspace (None | list[int] | int) – Specifies the mapping between nodes of the graph and Hilbert space sites, so that graph node i ∈ [0, ..., graph.n_nodes], corresponds to acting_on_subspace[i] ∈ [0, ..., hilbert.n_sites]. Must be a list of length graph.n_nodes. Passing a single integer start is equivalent to [start, ..., start + graph.n_nodes - 1].

  • cls (type[_LocalOperatorT])

Return type:

TypeVar(_LocalOperatorT, bound= LocalOperatorBase)

Examples

Constructs a GraphOperator operator for a 2D system.

>>> import netket as nk
>>> sigmax = [[0, 1], [1, 0]]
>>> mszsz = [[1, 0, 0, 0], [0, -1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]]
>>> edges = [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8],
... [8, 9], [9, 10], [10, 11], [11, 12], [12, 13], [13, 14], [14, 15],
... [15, 16], [16, 17], [17, 18], [18, 19], [19, 0]]
>>> g = nk.graph.Graph(edges=edges)
>>> hi = nk.hilbert.Spin(0.5, N=g.n_nodes)
>>> op = nk.operator.GraphOperator(
... hi, site_ops=[sigmax], bond_ops=[mszsz], graph=g)
>>> print(op)
LocalOperatorJax(dim=20, #acting_on=40 locations, constant=0.0, dtype=float64)