Custom Observables

NetKet provides the freedom to have user’s defined Observables, which are measured during the learning procedure. Custom Observables follow the same concepts discussed for custom Hamiltonians. It is possible to add an observable specifying the relevant operators in the Observables section of the input. For the moment, this functionality is limited to lattice observables which are sums of -local operators:

where the operators act on an (arbitrary) subset of sites. In order to define your custom Observable, you need to specify the operators . Notice that here the Hilbert space is derived from the definition of the Hamiltonian, thus users must specify Observables compatible with the Hamiltonian Hilbert space.

Local Operators

The local operators are specified giving their matrix elements, and a list of sites on which they act. For example, to specify a single-site operator acting on site , and with a local Hilbert space of two elements , you must provide a matrix

In general, for a -local operator acting on local Hilbert spaces with quantum numbers, you must provide a matrix

Parameter Possible values Description Default value
ActingOn List of list of integers The sites on which each acts on None
Name String Chosen name of the observable None
Operators List of floating/complex matrices For each , the matrix elements of in the -local Hilbert space None


for i in range(L):
    #\sum_i sigma^x(i)

    'Operators'      : sigmaxop,
    'ActingOn'       : sites,
    'Name'           : 'SigmaX',