Environment BoundaryMPS#
Boundary MPS approach for contracting finite lattice. It supports expectation values, including long-range correlations, sampling, etc.
- class yastn.tn.fpeps.EnvBoundaryMPS(psi, opts_svd, setup='l', opts_var=None)[source]#
Boundary MPS class for finite PEPS contraction.
A PEPS instance on a specified lattice can be initialized as empty (with no tensors assiged) or with tensors assigned to each unique lattice site.
PEPS inherits key methods (e.g., sites, bonds, dims) from the associated lattice geometry. Supports
[]
notation to get/set individual tensors. PEPS tensors can be either rank-5 (including physical legs) or rank-4 (without physical legs). Leg enumeration follows the order: top, left, bottom, right, and physical leg.- Parameters:
geometry (SquareLattice | CheckerboardLattice | RectangularUnitcell) – Specify lattice geometry.
tensors (Optional[Sequence[Sequence[Tensor]] | dict[tuple[int,int],Tensor]]]) – Fill in the Peps lattice with tensors. Each unique sites should get assigned in a way consistent with the geometry.
Example
import yastn import yastn.tn.fpeps as fpeps # PEPS with CheckerboarLattice geometry and no tensors assigned. # geometry = fpeps.CheckerboardLattice() psi = fpeps.Peps(geometry) config = yastn.make_config(sym='U1') leg = yastn.Leg(config, s=1, t=(0, 1), D=(1, 1)) # # for rank-5 tensors # A00 = yastn.rand(config, legs=[leg.conj(), leg, leg, leg.conj(), leg]) psi[0, 0] = A00 # # Currently, 5-leg PEPS tensors are fused by __setitem__ as ((top-left)(bottom-right) physical). # This is done to work with objects having a smaller number of blocks. assert psi[0, 0].ndim == 3 assert (psi[0, 0].unfuse_legs(axes=(0, 1)) - A00).norm() < 1e-13 # PEPS with no physical legs is also possible. # # for rank-4 tensors # B00 = yastn.rand(config, legs=[leg.conj(), leg, leg, leg.conj()]) psi[0, 0] = B00 assert psi[0, 0].ndim == 4 # PEPS with tensors assigned during initialization # psi = fpeps.Peps(geometry, tensors={(0, 0): A00, (0, 1): A01}) # # or equivalently # psi = fpeps.Peps(geometry, tensors=[[A00, A01], [A01, A00]]) # above, some provided tensors are redundant, although this redundancy is consistent with the geometry.
- measure_1site(O, site=None)[source]#
Calculate all 1-point expectation values <O_j> in a finite PEPS.
Takes CTM environments and operators.
- Parameters:
O (dict[tuple[int, int], dict[int, operators]]) – mapping sites with list of operators at each site.
- measure_2site(O, P, opts_svd, opts_var=None)[source]#
Calculate all 2-point correlations <O_i P_j> in a finite PEPS.
Takes CTM environments and operators.
- Parameters:
O, P (dict[tuple[int, int], dict[int, operators]],) – mapping sites with list of operators at each site.
- sample(projectors, number=1, opts_svd=None, opts_var=None, progressbar=False, return_probabilities=False, flatten_one=True, **kwargs)[source]#
Sample random configurations from PEPS. Output a dictionary linking sites with lists of sampled projectors` keys for each site. Projectors should be summing up to identity – this is not checked.
- Parameters:
projectors (Dict[Any, yast.Tensor] | Sequence[yast.Tensor] | Dict[Site, Dict[Any, yast.Tensor]]) – Projectors to sample from. We can provide a dict(key: projector), where the sampled results will be given as keys, and the same set of projectors is used at each site. For a list of projectors, the keys follow from enumeration. Finally, we can provide a dictionary between each site and sets of projectors.
number (int) – Number of independent samples.
progressbar (bool) – Whether to display progressbar. The default is
False
.return_probabilities (bool) – Whether to return a tuple (samples, probabilities). The default is
False
, where a dict samples is returned.flatten_one (bool) – Whether, for number==1, pop one-element lists for each lattice site to return samples={site: ind, } instead of {site: [ind]}. The default is
True
.