netket.operator.Heisenberg#
- netket.operator.Heisenberg(hilbert, graph, J=1.0, sign_rule=None, dtype=None, *, acting_on_subspace=None, cls=<class 'netket.operator._local_operator.jax.LocalOperatorJax'>)[source]#
Constructs an Heisenberg operator given a hilbert space and a graph providing the connectivity of the lattice.
- Parameters:
hilbert (
AbstractHilbert
) β Hilbert space the operator acts on.graph (
AbstractGraph
) β The graph upon which this hamiltonian is defined.J (
float
|Sequence
[float
]) β The strength of the coupling. Default is 1. Can pass a sequence of coupling strengths with coloured graphs: edges of colour n will have coupling strength J[n]sign_rule (
None
|bool
|Sequence
[bool
]) β If True, Marshalβs sign rule will be used. On a bipartite lattice, this corresponds to a basis change flipping the Sz direction at every odd site of the lattice. For non-bipartite lattices, the sign rule cannot be applied. Defaults to True if the lattice is bipartite, False otherwise. If a sequence of coupling strengths is passed, defaults to False and a matching sequence of sign_rule must be specified to override itdtype (
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 nodei β [0, ..., graph.n_nodes - 1]
, corresponds toacting_on_subspace[i] β [0, ..., hilbert.n_sites]
. Must be a list of length graph.n_nodes. Passing a single integerstart
is equivalent to[start, ..., start + graph.n_nodes - 1]
.cls (type[_LocalOperatorT])
- Return type:
TypeVar
(_LocalOperatorT
, bound=LocalOperatorBase
)
Examples
Constructs a
Heisenberg
operator for a 1D system.>>> import netket as nk >>> g = nk.graph.Hypercube(length=20, n_dim=1, pbc=True) >>> hi = nk.hilbert.Spin(s=0.5, total_sz=0, N=g.n_nodes) >>> op = nk.operator.Heisenberg(hilbert=hi, graph=g) >>> print(op) LocalOperatorJax(dim=20, #acting_on=20 locations, constant=0.0, dtype=float64)