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=None, tensors: None | Sequence[Sequence[Tensor]] | dict[tuple[int, int], Tensor] = None)[source]#
A PEPS instance on a specified lattice can be initialized as empty or with optional tensors already assigned to each lattice site.
i), ii) iii) geometry and tensors. Here, the tensors and geometry must be compatible in terms of non-equivalent sites ?
PEPS inherits key methods (e.g., sites, bonds, dims) from the associated lattice geometry.
Empty PEPS has no tensors assigned. 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 legExample 1#
import yastn import yastn.tn.fpeps as fpeps 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 object having 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
Example 2#
# directly pass the pattern of tensors in the unit cell as a dictionary. The geometry is created implicitly. psi = fpeps.PepsExtended(tensors={ (0,0):A00, (0,1):A01, (1,0):A01, (1,1):A00 }) # # or equivalently # psi = fpeps.PepsExtended(tensors=[[A00, A01], [A01, A00]])
- clone()[source]#
Returns a deep copy 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()[source]#
Returns an independent copy of the PEPS instance with each
yastn.Tensor
object in the network sharing the same data blocks as the original instance. This method does not create a deep copy of tensors; each tensor in the copied PEPS will reference the same blocks as in the original.
- 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.
Examples are given in quickstart.
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:
config (module | _config(NamedTuple)) – YASTN configuration
in_dict (dict) – dictionary containing serialized PEPS-related object, i.e., a result of
yastn.tn.fpeps.Peps.save_to_dict()
, oryastn.tn.fpeps.EnvCTM.save_to_dict()
.
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.
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.
Equivalent operations in yastn.Tensor
are here.
t' t
\ \
| \
/ _\_____
/ | | t' t
/--|--| A |-------\ \ \
/ | |_______| \ __\_\__
l --/ | | \ \-- r l --| |-- r
| | __ \ === | a |
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:
top (yastn.Tensor) – The top tensor of the cell.
btm (yastn.Tensor) – The 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.
- 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
.