Creating PEPS#

Initializing empty PEPS#

PEPS is an instance of a class yastn.tn.fpeps.Peps, utilizing a lattice geometry setup (e.g., SquareLattice or CheckerboardLattice). Each unique lattice site is associated with a tensor, following the layout specified by the lattice geometry.

  # leg ordering of PEPS tensors is
  # top, left, bottom, right, physical

              top `0th`
                 ╲
                  ╲
              ┌────┴────┐
left `1st` ───┤ A_{x,y} ├─── right `3rd`
              └──┬────┬─┘
                 |     ╲
                 |      ╲
            phys `4th`  bottom `2nd`
class yastn.tn.fpeps.Peps(geometry, tensors: None | Sequence[Sequence[Tensor]] | dict[tuple[int, int], Tensor] = None)[source]#

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.
clone() yastn.tn.fpeps.Peps[source]#

Returns a deep clone of the PEPS instance by cloning each tensor in the network. Each tensor in the cloned PEPS will contain its own independent data blocks.

copy() yastn.tn.fpeps.Peps[source]#

Returns a deep copy of the PEPS instance by copy each tensor in the network. Each tensor in the copied PEPS will contain its own independent data blocks.

save_to_dict() dict[source]#

Serialize PEPS into a dictionary.

shallow_copy() yastn.tn.fpeps.Peps[source]#

New instance of yastn.tn.mps.Peps pointing to the same tensors as the old one.

Shallow copy is usually sufficient to retain the old PEPS.

transfer_mpo(n=0, dirn='v') yastn.tn.mps.MpsMpo[source]#

Converts a specified row or column of the PEPS into a Matrix Product Operator (MPO) representation, facilitating boundary or contraction calculations along that direction.

For tensors with physical legs, the MPO is composed of DoublePepsTensor instances (2-layered tensors, see yastn.tn.fpeps.DoublePepsTensor) For tensors without a physical leg directly use Peps tensors (1-layer).

Parameters:
  • n (int) – index of row or column.

  • dirn (str) – ‘v’ for column, ‘h’ for row.

Initializing product PEPS#

yastn.tn.fpeps.product_peps(geometry, vectors) Peps[source]#

Initialize PEPS in a product state composed of provided vectors for all lattice sites.

Vectors can have effective rank ndim=1 for (pure) state and ndim=2 for purification/operator. In the latter case, two legs will be fused into one physical PEPS leg. Virtual legs of dimension one with zero charge are added automatically. For vectors, their possibly non-zero charge is incorporated by adding an auxiliary leg with dimension one.

Parameters:
  • geometry (SquareLattice | CheckerboardLattice) – lattice geometry.

  • vectors (yastn.Tensor | Dict[tuple[Int, Int], yastn.Tensor]) – If yastn.Tensor is provided, it gets repeated across the lattice. If dict is provided, it should specify a map between each unique lattice site and the corresponding vector.

See examples at Kibble-Zurek quench in 2D transverse-field Ising model.

Import and export PEPS#

PEPS instances can be saved as Python dict after serialization by yastn.tn.fpeps.Peps.save_to_dict(). This enables saving the PEPS structure, lattice geometry, and tensor data for storage or transfer. A PEPS object can later be deserialized back using yastn.tn.fpeps.load_from_dict().

yastn.tn.fpeps.load_from_dict(config, d) Peps[source]#

Create PEPS-related object from dictionary. Works for yastn.tn.fpeps.Peps, yastn.tn.fpeps.EnvCTM.

Parameters:

Double-layer PEPS#

Calculation of expectation values of interests requires contraction of PEPS with its conjugate. This amounts to the contraction of the PEPS network composed of reduced rank-4 tensors \(a\), which is obtained by tracing over the physical index in tensors \(A\) and it’s conjugate \(A^{\dagger}\). It is supported by a special class yastn.tn.fpeps.Peps2Layers, that outputs tensor \(a\) in the form of yastn.tn.fpeps.DoublePepsTensor while accessed with [] for a given site.

class yastn.tn.fpeps.Peps2Layers(bra, ket=None)[source]#

PEPS class supporting <bra|ket> contraction.

If ket is not provided, ket = bra.

Double PEPS Tensor#

The auxiliary class allows treating top and bottom PEPS tensors—to be contracted along physical dimensions—as a single tensor of rank-4 for various operations. It provides a dispatching mechanism for efficient contraction in construction of enlarge corners in CTMRG or boundary MPS algorithms.

            t't
             ╲╲
             ╱ ╲
            ╱   ╲                                     t't
           ╱ ┌───┴───┐                                 ╲╲
       /──┼──┤   A   ├─────\                            ╲╲
      ╱   |  └─┬────┬┘      ╲                         ┌──┴┴───┐
l ───/    |    |     ╲       \─── r     ════     l ───┤   a   ├─── r
l'───\    |    |   ___╲      /─── r'    ════     l'───┤       ├─── r'
      ╲   |  ┌─┴──┴──┐╲╲    ╱                         └──┬┬───┘
       \──┼──┤   A'  ├─╲╲──/                              ╲╲
          ╲  └─┬─────┘  ╲╲                                 ╲╲
           ╲  ╱          ╲╲                                b'b
            ‾‾            ╲╲
                          b'b

Note that in the following diagram the virtual legs of the peps tensor are labelled by \(t\) (top), \(l\) (left), \(b\) (bottom), and \(r\) (right) in an anticlockwise fashion. For the conjugate tensor, similarly, they are labelled by \({t'}\), \({l'}\), \({b'}\) and \({r'}\). Swap gates are placed where the legs cross. This gives a simple structure for the contracted tensors on the \(2D\) lattice, respecting the global fermionic order.

class yastn.tn.fpeps.DoublePepsTensor(bra, ket, transpose=(0, 1, 2, 3), op=None, swaps=None)[source]#

Class that treats a pair of tensors forming a site of double-layer PEPS as a single tensor.

Parameters:
  • bra (yastn.Tensor) – The “bra” (or top) tensor of the cell.

  • ket (yastn.Tensor) – The “ket” (or bottom) tensor of the cell.

  • transpose (tuple[int, int int, int]) – Transposition with respect to canonical order of PEPS legs.

clone()[source]#

Makes a clone of yastn.tn.fpeps.DoublePepsTensor by cloning-ing all constituent tensors forming a new instance of DoublePepsTensor.

conj()[source]#

Conjugate DoublePepsTensor.

copy()[source]#

Makes a copy of yastn.tn.fpeps.DoublePepsTensor by copying-ing all constituent tensors forming a new instance of DoublePepsTensor.

fuse_layers()[source]#

Fuse the top and bottom tensors into a single yastn.Tensor.

get_legs(axes=None)[source]#

Returns the legs of the DoublePepsTensor along specified axes.

get_shape(axes=None)[source]#

Returns the shape of the DoublePepsTensor along specified axes.

tensordot(b, axes, reverse=False)[source]#

tensordot(DublePepsTensor, b, axes) with tenor leg order conventions matching the default for tensordot. tensordot(self, b, axes, reverse=True) corresponds to tensordot(b, self, axes).

transpose(axes)[source]#

Transposition of DoublePepsTensor. Only cyclic permutations are allowed.