MultiCouplingTerms¶
full name: tenpy.networks.terms.MultiCouplingTerms
parent module:
tenpy.networks.terms
type: class
-
class
tenpy.networks.terms.
MultiCouplingTerms
(L)[source]¶ Bases:
tenpy.networks.terms.CouplingTerms
Operator names, site indices and strengths representing general M-site coupling terms.
Generalizes the
coupling_terms
ofCouplingTerms
to M-site couplings. The structure of the nested dictionarycoupling_terms
is similar, but we allow an arbitrary recursion depth of the dictionary.- Parameters
- Lint
Number of sites.
- Attributes
- Lint
Number of sites.
- coupling_termsdict of dict
Nested dictionaries of the following form:
{i: {('opname_i', 'opname_string_ij'): {j: {('opname_j', 'opname_string_jk'): {k: {('opname_k', 'opname_string_kl'): ... {l: {'opname_l': strength } } ... } } } } } }
For a M-site coupling, this involves a nesting depth of
2*M
dictionaries. Note that alwaysi < j < k < ... < l
, but entries withj,k,l >= L
are allowed for the case ofbc_MPS == 'infinite'
, when they indicate couplings between different iMPS unit cells.
Methods
add_coupling_term
(self, strength, i, j, …)Add a two-site coupling term on given MPS sites.
add_multi_coupling_term
(self, strength, …)Add a multi-site coupling term.
add_to_graph
(self, graph[, _i, _d1, _label_left])Add terms from
coupling_terms
to an MPOGraph.coupling_term_handle_JW
(self, strength, …)Helping function to call before
add_multi_coupling_term()
.max_range
(self)Determine the maximal range in
coupling_terms
.multi_coupling_term_handle_JW
(self, …[, …])Helping function to call before
add_multi_coupling_term()
.plot_coupling_terms
(self, ax, lat[, …])“Plot coupling terms into a given lattice.
remove_zeros
(self[, tol_zero, _d0])Remove entries close to 0 from
coupling_terms
.to_TermList
(self)Convert
onsite_terms
into aTermList
.to_nn_bond_Arrays
(self, sites)Convert the
coupling_terms
into Arrays on nearest neighbor bonds.-
add_multi_coupling_term
(self, strength, ijkl, ops_ijkl, op_string='Id')[source]¶ Add a multi-site coupling term.
- Parameters
- strengthfloat
The strength of the coupling term.
- ijkllist of int
The MPS indices of the sites on which the operators acts. With i, j, k, … = ijkl, we require that they are ordered ascending,
i < j < k < ...
and that0 <= i < N_sites
. Inidces >= N_sites indicate couplings between different unit cells of an infinite MPS.- ops_ijkllist of str
Names of the involved operators on sites i, j, k, ….
- op_string(list of) str
Names of the operator to be inserted between the operators, e.g., op_string[0] is inserted between i and j. A single name holds for all in-between segments.
-
multi_coupling_term_handle_JW
(self, strength, term, sites, op_string=None)[source]¶ Helping function to call before
add_multi_coupling_term()
.Handle/figure out Jordan-Wigner strings if needed.
- Parameters
- strengthfloat
The strength of the term.
- termlist of (str, int)
List of tuples
(op_i, i)
where i is the MPS index of the site the operator named op_i acts on. We require the operators to be sorted (strictly ascending) by sites. If necessary, callorder_combine_term()
beforehand.- siteslist of
Site
Defines the local Hilbert space for each site. Used to check whether the operators need Jordan-Wigner strings.
- op_stringNone | str
Operator name to be used as operator string between the operators, or
None
if the Jordan Wigner string should be figured out.
- Returns
- strength, ijkl, ops_ijkl, op_string :
Arguments for
MultiCouplingTerms.add_multi_coupling_term()
such that the added term corresponds to the parameters of this function.
-
max_range
(self)[source]¶ Determine the maximal range in
coupling_terms
.- Returns
- max_rangeint
The maximum of
j - i
for the i, j occuring in a term ofcoupling_terms
.
-
add_to_graph
(self, graph, _i=None, _d1=None, _label_left=None)[source]¶ Add terms from
coupling_terms
to an MPOGraph.- Parameters
- graph
MPOGraph
The graph into which the terms from
coupling_terms
should be added.- _i, _d1, _label_leftNone
Should not be given; only needed for recursion.
- graph
-
remove_zeros
(self, tol_zero=1e-15, _d0=None)[source]¶ Remove entries close to 0 from
coupling_terms
.- Parameters
- tol_zerofloat
Entries in
coupling_terms
with strength < tol_zero are considered to be zero and removed.- _d0None
Should not be given; only needed for recursion.
-
to_TermList
(self)[source]¶ Convert
onsite_terms
into aTermList
.- Returns
- term_list
TermList
Representation of the terms as a list of terms.
- term_list
-
add_coupling_term
(self, strength, i, j, op_i, op_j, op_string='Id')¶ Add a two-site coupling term on given MPS sites.
- Parameters
- strengthfloat
The strength of the coupling term.
- i, jint
The MPS indices of the two sites on which the operator acts. We require
0 <= i < N_sites
andi < j
, i.e., op_i acts “left” of op_j. If j >= N_sites, it indicates couplings between unit cells of an infinite MPS.- op1, op2str
Names of the involved operators.
- op_stringstr
The operator to be inserted between i and j.
-
coupling_term_handle_JW
(self, strength, term, sites, op_string=None)¶ Helping function to call before
add_multi_coupling_term()
.- Parameters
- strengthfloat
The strength of the coupling term.
- term[(str, int), (str, int)]
List of two tuples
(op, i)
where i is the MPS index of the site the operator named op acts on.- siteslist of
Site
Defines the local Hilbert space for each site. Used to check whether the operators need Jordan-Wigner strings.
- op_stringNone | str
Operator name to be used as operator string between the operators, or
None
if the Jordan Wigner string should be figured out.
- Returns
- strength, i, j, op_i, op_j, op_string:
Arguments for
MultiCouplingTerms.add_multi_coupling_term()
such that the added term corresponds to the parameters of this function.
-
plot_coupling_terms
(self, ax, lat, style_map='default', common_style={'linestyle': '--'}, text=None, text_pos=0.4)¶ “Plot coupling terms into a given lattice.
This function plots the
coupling_terms
- Parameters
- ax
matplotlib.axes.Axes
The axes on which we should plot.
- lat
Lattice
The lattice for plotting the couplings, most probably the
M.lat
of the corresponding modelM
, seelat
.- style_mapfunction | None
Function which get’s called with arguments
i, j, op_i, op_string, op_j, strength
for each two-site coupling and should return a keyword-dictionary with the desired plot-style for this coupling. By default (None
), the linewidth is given by the absolute value of strength, and the linecolor depends on the phase of strength (using the hsv colormap).- common_styledict
Common style, which overwrites values of the dictionary returned by style_map. A
'label'
is only used for the first plotted line.- text: format_string | None
If not
None
, we add text labeling the couplings in the plot. Available keywords arei, j, op_i, op_string, op_j, strength
as well asstrength_abs, strength_angle, strength_real
.- text_posfloat
Specify where to put the text on the line between i (0.0) and j (1.0), e.g. 0.5 is exactly in the middle between i and j.
- ax
See also
tenpy.models.lattice.Lattice.plot_sites
plot the sites of the lattice.
-
to_nn_bond_Arrays
(self, sites)¶ Convert the
coupling_terms
into Arrays on nearest neighbor bonds.- Parameters
- Returns
- H_bondlist of {
Array
| None} The
coupling_terms
rewritten assum_i H_bond[i]
for MPS indicesi
.H_bond[i]
acts on sites(i-1, i)
,None
represents 0. Legs of eachH_bond[i]
are['p0', 'p0*', 'p1', 'p1*']
.
- H_bondlist of {