OnsiteTerms

Inheritance Diagram

Inheritance diagram of tenpy.networks.terms.OnsiteTerms

Methods

OnsiteTerms.__init__(L)

Initialize self.

OnsiteTerms.add_onsite_term(strength, i, op)

Add a onsite term on a given MPS site.

OnsiteTerms.add_to_graph(graph)

Add terms from onsite_terms to an MPOGraph.

OnsiteTerms.add_to_nn_bond_Arrays(H_bond, …)

Add self.onsite_terms into nearest-neighbor bond arrays.

OnsiteTerms.from_hdf5(hdf5_loader, h5gr, subpath)

Load instance from a HDF5 file.

OnsiteTerms.remove_zeros([tol_zero])

Remove entries close to 0 from onsite_terms.

OnsiteTerms.save_hdf5(hdf5_saver, h5gr, subpath)

Export self into a HDF5 file.

OnsiteTerms.to_Arrays(sites)

Convert the onsite_terms into a list of np_conserved Arrays.

OnsiteTerms.to_TermList()

Convert onsite_terms into a TermList.

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

Bases: tenpy.tools.hdf5_io.Hdf5Exportable

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

L (int) – Number of sites.

L

Number of sites.

Type

int

onsite_terms

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

Type

list of dict

add_onsite_term(strength, i, op)[source]

Add a onsite term on a given MPS site.

Parameters
  • strength (float) – The strength of the term.

  • i (int) – The MPS index of the site on which the operator acts. We require 0 <= i < L.

  • op (str) – Name of the involved operator.

add_to_graph(graph)[source]

Add terms from onsite_terms to an MPOGraph.

Parameters

graph (MPOGraph) – The graph into which the terms from onsite_terms should be added.

to_Arrays(sites)[source]

Convert the onsite_terms into a list of np_conserved Arrays.

Parameters

sites (list of Site) – Defines the local Hilbert space for each site. Used to translate the operator names into Array.

Returns

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

Return type

list of Array

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

Remove entries close to 0 from onsite_terms.

Parameters

tol_zero (float) – Entries in onsite_terms with strength < tol_zero are considered to be zero and removed.

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

Add self.onsite_terms into nearest-neighbor bond arrays.

Parameters
  • H_bond (list 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.

  • sites (list 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]).

  • finite (bool) – Boundary conditions of the MPS, MPS.finite. If finite, we distribute the onsite term of the

to_TermList()[source]

Convert onsite_terms into a TermList.

Returns

term_list – Representation of the terms as a list of terms.

Return type

TermList

classmethod from_hdf5(hdf5_loader, h5gr, subpath)[source]

Load instance from a HDF5 file.

This method reconstructs a class instance from the data saved with save_hdf5().

Parameters
  • hdf5_loader (Hdf5Loader) – Instance of the loading engine.

  • h5gr (Group) – HDF5 group which is represent the object to be constructed.

  • subpath (str) – The name of h5gr with a '/' in the end.

Returns

obj – Newly generated class instance containing the required data.

Return type

cls

save_hdf5(hdf5_saver, h5gr, subpath)[source]

Export self into a HDF5 file.

This method saves all the data it needs to reconstruct self with from_hdf5().

This implementation saves the content of __dict__ with save_dict_content(), storing the format under the attribute 'format'.

Parameters
  • hdf5_saver (Hdf5Saver) – Instance of the saving engine.

  • h5gr (:class`Group`) – HDF5 group which is supposed to represent self.

  • subpath (str) – The name of h5gr with a '/' in the end.