full name: tenpy.networks.site.multi_sites_combine_charges
Adjust the charges of the given sites (in place) such that they can be used together.
When we want to contract tensors corresponding to different
Siteinstances, these sites need to share a single
ChargeInfo. This function adjusts the charges of these sites such that they can be used together.
Deprecated since version 0.7.3: Deprecated in favore of the new, more powerful
set_common_charges(). Be aware of the slightly different argument structure though, namely that this function keeps charges not included in same_charges, whereas you need to include them explicitly into the new_charges argument of set_common_charges.
sites (list of
Site) – The sites to be combined. Modified in place.
[[(int, int|str), (int, int|str), ...], ...]) – Defines which charges actually are the same, i.e. their quantum numbers are added up. Each charge is specified by a tuple
(s, i)= (int, int|str), where s gives the index of the site within
sitesand i the index or name of the charge in the
ChargeInfoof this site.
perms – For each site the permutation performed on the physical leg to sort by charges.
- Return type
list of ndarray
>>> from tenpy.networks.site import * >>> ferm = SpinHalfFermionSite(cons_N='N', cons_Sz='Sz') >>> spin = SpinSite(1.0, 'Sz') >>> ferm.leg.chinfo is spin.leg.chinfo False >>> print(spin.leg) +1 0 [[-2] 1 [ 0] 2 [ 2]] 3 >>> multi_sites_combine_charges([ferm, spin], same_charges=[[(0, 1), (1, 0)]]) [array([0, 1, 2, 3]), array([0, 1, 2])] >>> # no permutations where needed >>> ferm.leg.chinfo is spin.leg.chinfo True >>> ferm.leg.chinfo.names ['N', '2*Sz'] >>> print(spin.leg) +1 0 [[ 0 -2] 1 [ 0 0] 2 [ 0 2]] 3