# Environment¶

class ctm.generic.env.ENV(chi, state=None, ctm_args=<config.CTMARGS object>, global_args=<config.GLOBALARGS object>)[source]
Parameters
• chi (int) – environment bond dimension $$\chi$$

• state (IPEPS) – wavefunction

• ctm_args (CTMARGS) – CTM algorithm configuration

• global_args (GLOBALARGS) – global configuration

For each pair of (vertex, on-site tensor) in the elementary unit cell of state, create corresponding environment tensors: Half-row/column tensors T’s and corner tensors C’s. The corner tensors have dimensions $$\chi \times \chi$$ and the half-row/column tensors have dimensions $$\chi \times \chi \times D^2$$ (D might vary depending on the corresponding dimension of on-site tensor). The environment of each double-layer tensor (A) is composed of eight different tensors:

y\x -1 0 1
-1  C T C
0  T A T
1  C T C


The individual tensors making up the environment of a site are defined by four directional vectors $$d = (x,y)_{\textrm{environment tensor}} - (x,y)_\textrm{A}$$ as follows:

C(-1,-1)   T        (1,-1)C
|(0,-1)
T--(-1,0)--A(0,0)--(1,0)--T
|(0,1)
C(-1,1)    T         (1,1)C


Environment tensors of some ENV object e are accesed through its members C and T by providing a tuple of coordinates and directional vector to the environment tensor:

coord=(0,0)                # tuple(x,y) identifying vertex on the square lattice
rel_dir_vec_C=(-1,-1)      # tuple(rx,ry) identifying one of the four corner tensors
rel_dir_vec_T=(-1,0)       # tuple(rx,ry) identifying one of the four half-row/column tensors
C_upper_left= e.C[(coord,rel_dir_vec_C)] # return upper left corner tensor of site at coord
T_left= e.T[(coord,rel_dir_vec_T)]       # return left half-row tensor of site at coord


The index-position convention is as follows: Start from the index in the direction “up” <=> (0,-1) and continue anti-clockwise:

C--1 0--T--2 0--C
|       |       |
0       1       1
0               0
|               |
T--2         1--T
|               |
1               2
0       0       0
|       |       |
C--1 1--T--2 1--C


Note

The structure of fused double-layer legs, which are carried by T-tensors, is obtained by fusing on-site tensor (ket) with its conjugate (bra). The leg of ket always preceeds bra when fusing.

clone(ctm_args=<config.CTMARGS object>, global_args=<config.GLOBALARGS object>)[source]
Parameters
• ctm_args (CTMARGS) – CTM algorithm configuration

• global_args (GLOBALARGS) – global configuration

Create a clone of the environment.

Note

This operation preserves gradient tracking.

detach(ctm_args=<config.CTMARGS object>, global_args=<config.GLOBALARGS object>)[source]
Parameters
• ctm_args (CTMARGS) – CTM algorithm configuration

• global_args (GLOBALARGS) – global configuration

Get a detached “view” of the environment. See torch.Tensor.detach.

Note

This operation does not preserve gradient tracking.

extend(new_chi, ctm_args=<config.CTMARGS object>, global_args=<config.GLOBALARGS object>)[source]
Parameters
• new_chi (int) – new environment bond dimension

• ctm_args (CTMARGS) – CTM algorithm configuration

• global_args (GLOBALARGS) – global configuration

Create a new environment with all environment tensors enlarged up to environment dimension new_chi. The enlarged C, T tensors are padded with zeros.

Note

This operation preserves gradient tracking.

ctm.generic.env.init_env(state, env, ctm_args=<config.CTMARGS object>)[source]
Parameters
• state (IPEPS) – wavefunction

• env (ENV) – CTM environment

• ctm_args (CTMARGS) – CTM algorithm configuration

Initializes the environment env according to one of the supported options specified by CTMARGS.ctm_env_init_type

• "CONST" - all C and T tensors have all their elements intialized to a value 1

• "RANDOM" - all C and T tensors have elements with random numbers drawn from uniform distribution [0,1)

• "CTMRG" - tensors C and T are built from the on-site tensors of state