OnsiteTerms

class tenpy.networks.terms.OnsiteTerms(L)[source]

Bases: object

Operator names, site indices and strengths representing onsite terms.

Represents a sum of onsite terms where the operators are only given by their name (in the form of a string). What the operator represents is later given by a list of Site with get_op().

Parameters
Lint

Number of sites.

Attributes
Lint

Number of sites.

onsite_termslist of dict

Filled by meth:add_onsite_term. For each index i a dictionary {'opname': strength} defining the onsite terms.

Methods

add_onsite_term(self, strength, i, op)

Add a onsite term on a given MPS site.

add_to_graph(self, graph)

Add terms from onsite_terms to an MPOGraph.

add_to_nn_bond_Arrays(self, H_bond, sites, …)

Add self.onsite_terms into nearest-neighbor bond arrays.

remove_zeros(self[, tol_zero])

Remove entries close to 0 from onsite_terms.

to_Arrays(self, sites)

Convert the onsite_terms into a list of np_conserved Arrays.

to_TermList(self)

Convert onsite_terms into a TermList.

add_onsite_term(self, strength, i, op)[source]

Add a onsite term on a given MPS site.

Parameters
strengthfloat

The strength of the term.

iint

The MPS index of the site on which the operator acts. We require 0 <= i < L.

opstr

Name of the involved operator.

add_to_graph(self, graph)[source]

Add terms from onsite_terms to an MPOGraph.

Parameters
graphMPOGraph

The graph into which the terms from onsite_terms should be added.

to_Arrays(self, sites)[source]

Convert the onsite_terms into a list of np_conserved Arrays.

Parameters
siteslist of Site

Defines the local Hilbert space for each site. Used to translate the operator names into Array.

Returns
onsite_arrayslist of Array

Onsite terms represented by self. Entry i of the list lives on sites[i].

remove_zeros(self, tol_zero=1e-15)[source]

Remove entries close to 0 from onsite_terms.

Parameters
tol_zerofloat

Entries in onsite_terms with strength < tol_zero are considered to be zero and removed.

add_to_nn_bond_Arrays(self, H_bond, sites, finite, distribute=(0.5, 0.5))[source]

Add self.onsite_terms into nearest-neighbor bond arrays.

Parameters
H_bondlist of {Array | None}

The coupling_terms rewritten as sum_i H_bond[i] for MPS indices i. H_bond[i] acts on sites (i-1, i), None represents 0. Legs of each H_bond[i] are ['p0', 'p0*', 'p1', 'p1*']. Modified in place.

siteslist of Site

Defines the local Hilbert space for each site. Used to translate the operator names into Array.

distribute(float, float)

How to split the onsite terms (in the bulk) into the bond terms to the left (distribute[0]) and right (distribute[1]).

finitebool

Boundary conditions of the MPS, MPS.finite. If finite, we distribute the onsite term of the

to_TermList(self)[source]

Convert onsite_terms into a TermList.

Returns
term_listTermList

Representation of the terms as a list of terms.