PEPS Unit cell (varipeps.peps.PEPS_Unit_Cell)
- class varipeps.peps.PEPS_Unit_Cell(data: varipeps.peps.PEPS_Unit_Cell.Unit_Cell_Data, real_ix: int = 0, real_iy: int = 0, sanity_checks: bool = True)[source]
Bases:
objectClass to model a unit cell of a PEPS structure.
The structure of the unit cell is modeled by a two dimensional array with the first index corresponding to the x-axis and the second one to the y-axis. The array consists of integer labeling the different unique peps tensors in one unit cell (either starting with 0 or 1). For example for two rows with a AB/BA structure:
structure = [[0, 1], [1, 0]]
- Parameters:
data (
Unit_Cell_Data) – Instance of unit cell data classreal_ix (
int, optional) – Which real x index of data.structure correspond to x = 0 of this unit cell instance.Default:0real_iy (
int, optional) – Which real y index of data.structure correspond to y = 0 of this unit cell instance.Default:0- class Unit_Cell_Data(peps_tensors: List[PEPS_Tensor], structure: Tuple[Tuple[int, ...], ...])[source]
Bases:
objectClass to encapsulate the data of the unit cell which can be shared by more than one instance.
- Parameters:
peps_tensors (sequence of
PEPS_Tensor) – Sequence with the unique peps tensorsstructure (2d
jax.numpy.ndarray) – Two dimensional array modeling the structure of the unit cell. For details see the description of the parent unit cell class.
- copy() varipeps.peps.PEPS_Unit_Cell.Unit_Cell_Data[source]
Creates a (flat) copy of the unit cell data.
- Returns:
New instance of the unit cell data class.
- Return type:
- classmethod load_from_group(grp: Group) varipeps.peps.PEPS_Unit_Cell.Unit_Cell_Data[source]
Load the unit cell data from a HDF5 group.
- Parameters:
grp (
h5py.Group) – HDF5 group object to load the data from.
- peps_tensors: List[PEPS_Tensor]
- replace_peps_tensors(new_peps_tensors: List[PEPS_Tensor]) varipeps.peps.PEPS_Unit_Cell.Unit_Cell_Data[source]
Return new instance with the list of peps tensors replaced.
- Returns:
New instance of the unit cell data class with the list replaced.
- Return type:
- save_to_group(grp: Group) None[source]
Store the unit cell data into a HDF5 group.
- Parameters:
grp (
h5py.Group) – HDF5 group object to save the data into.
- __getitem__(key: Tuple[int | slice, int | slice]) List[List[PEPS_Tensor]][source]
Get PEPS tensors according to unit cell structure.
- change_D(new_D: int) PEPS_Unit_Cell[source]
Change iPEPS bond dimension of all tensors in the unit cell.
- Parameters:
new_D (
int) – New value for the iPEPS bond dimension.- Returns:
New instance of PEPS unit cell with the new tensor list.
- Return type:
- change_chi(new_chi: int, reset_max_chi: bool = False) PEPS_Unit_Cell[source]
Change environment bond dimension of all tensors in the unit cell.
- Parameters:
new_chi (
int) – New value for the environment bond dimension.reset_max_chi (
bool, optional) – Set maximal bond dimension to the same new value.Default:False- Returns:
New instance of PEPS unit cell with the new tensor list.
- Return type:
- copy() PEPS_Unit_Cell[source]
Performs a (flat) copy of the PEPS unit cell.
- Returns:
Copied instance of the unit cell.
- Return type:
- data: Unit_Cell_Data
- classmethod from_tensor_list(tensor_list: Sequence[PEPS_Tensor], structure: Sequence[Sequence[int]] | ndarray | Array) PEPS_Unit_Cell[source]
- get_indices(key: Tuple[int | slice, int | slice]) Sequence[Sequence[int]][source]
Get indices of PEPS tensors according to unit cell structure.
- get_len_unique_tensors() int[source]
Return the length of the list of the unique tensors the unit cell consists of.
- Returns:
Length of list of unique tensors
- Return type:
- get_unique_tensors() List[PEPS_Tensor][source]
Get the list of unique tensors the unit cell consists of.
- Returns:
List of unique tensors.
- Return type:
listofPEPS_Tensor
- increase_max_chi(new_max_chi: int) PEPS_Unit_Cell[source]
Change environment maximal bond dimension of all tensors in the unit cell.
- Parameters:
new_max_chi (
int) – New value for the maximal environment bond dimension.- Returns:
New instance of PEPS unit cell with the new tensor list.
- Return type:
- iter_all_columns(*, reverse: bool = False, only_unique: bool = False) Iterator[Tuple[int, Iterator[Tuple[int, TypeAliasForwardRef('PEPS_Unit_Cell')]]]][source]
Get a iterator over all columns.
This function calls
iter_one_columnfor all columns and yields the resulting iterator.- Keyword Arguments:
reverse (bool, optional) – Reverse the order of the iteration.
Default:Falseonly_unique (bool, optional) – Return only views where each unique PEPS tensor in the unitcell is only once at index (0, 0).
Default:False- Returns:
Iterator for all columns over the iterator for single column with the current PEPS tensor at moved position (0, 0).
- Return type:
- iter_all_rows(*, reverse: bool = False, only_unique: bool = False) Iterator[Tuple[int, Iterator[Tuple[int, TypeAliasForwardRef('PEPS_Unit_Cell')]]]][source]
Get a iterator over all rows.
This function calls
iter_one_rowfor all rows and yields the resulting iterator.- Keyword Arguments:
reverse (bool, optional) – Reverse the order of the iteration.
Default:Falseonly_unique (bool, optional) – Return only views where each unique PEPS tensor in the unitcell is only once at index (0, 0).
Default:False- Returns:
Iterator for all rows over the iterator for single row with the current PEPS tensor at moved position (0, 0).
- Return type:
- iter_one_column(fixed_y: int, *, only_unique: bool = False) Iterator[Tuple[int, TypeAliasForwardRef('PEPS_Unit_Cell')]][source]
Get a iterator over a single column with a fixed y value.
- Parameters:
fixed_y (int) – Fixed y value.
- Keyword Arguments:
only_unique (bool, optional) – Return only views where each unique PEPS tensor in the unitcell is only once at index (0, 0).
Default:False- Returns:
Iterator over one column of the unit cell with the current PEPS tensor at moved position (0, 0).
- Return type:
- iter_one_row(fixed_x: int, *, only_unique: bool = False) Iterator[Tuple[int, TypeAliasForwardRef('PEPS_Unit_Cell')]][source]
Get a iterator over a single row with a fixed x value.
- Parameters:
fixed_x (int) – Fixed x value.
- Keyword Arguments:
only_unique (bool, optional) – Return only views where each unique PEPS tensor in the unitcell is only once at index (0, 0).
Default:False- Returns:
Iterator over one row of the unit cell with the current PEPS tensor at moved position (0, 0).
- Return type:
- classmethod load_from_file(path: PathLike, return_config: bool = False, return_auxiliary_data: bool = False) TypeAliasForwardRef('PEPS_Unit_Cell') | Tuple[TypeAliasForwardRef('PEPS_Unit_Cell'), VariPEPS_Config][source]
Load unit cell from a HDF5 file.
This function read the group “unitcell” from the file and pass this group to the method
load_from_groupthen.- Parameters:
path (
os.PathLike) – Path of the HDF5 file.return_config (
bool, optional) – Return a config object initialized with the values from the HDF5 files. If no config is stored in the file, just the data is returned. Missing config flags in the file uses the default values from the config object.Default:Falsereturn_auxiliary_data (
bool, optional) – Return dictionary with string indexed auxiliary data which has been should be stored along the other data in the file.Default:False- classmethod load_from_group(grp: Group, return_config: bool = False) TypeAliasForwardRef('PEPS_Unit_Cell') | Tuple[TypeAliasForwardRef('PEPS_Unit_Cell'), VariPEPS_Config][source]
Load the unit cell from a HDF5 group which is be passed to the method.
- Parameters:
grp (
h5py.Group) – HDF5 group object to load the data from.return_config (
bool, optional) – Return a config object initialized with the values from the HDF5 files. If no config is stored in the file, just the data is returned. Missing config flags in the file uses the default values from the config object.Default:False- move(new_xi: int, new_yi: int) PEPS_Unit_Cell[source]
Move origin of the unit cell coordination system.
This function just creates a new view but do not copy the structure object or the PEPS tensors.
- Parameters:
- Returns:
PEPS unit cell with shifted origin.
- Return type:
- classmethod random(structure: Sequence[Sequence[int]] | ndarray | Array, d: int | Sequence[int], D: int | Sequence[Sequence[int]], chi: int | Sequence[int], dtype: Type[number], max_chi: int | None = None, *, seed: int | None = None, destroy_random_state: bool = True) PEPS_Unit_Cell[source]
Randomly initialize the unit cell and its PEPS tensors according to the structure given.
- Parameters:
structure (sequence of sequence of
intor 2d array) – Two dimensional array modeling the structure of the unit cell. For details see the description of the parent unit cell class.d (
intor sequence ofint) – Physical dimension. If sequence, physical of each unique PEPS tensor separately.D (
intor sequence of sequence ofint) – Bond dimension of PEPS tensor. If sequence, dimension of each unique PEPS tensor separately.chi (
intor sequence ofint) – Bond dimension of environment tensors. If sequence, dimension of each unique PEPS tensor separately.dtype (type of
jax.numpy.number) – Data type of the PEPS tensors.max_chi (
int, optional) – Maximal allowed bond dimension for the environment tensorsDefault:None- Keyword Arguments:
seed (
int, optional) – Seed for random number generatorDefault:Nonedestroy_random_state (
bool, optional) – Destroy state of random number generator and reinitialize it. Defaults to True.Default:True- Returns:
New instance of PEPS unit cell with the initialized tensors.
- Return type:
- replace_unique_tensors(new_unique_tensors: List[PEPS_Tensor]) PEPS_Unit_Cell[source]
Replace the list of unique tensors the unit cell consists of.
- Parameters:
new_unique_tensors (
listofPEPS_Tensor) – New list of unique tensors the unit cell should consists of.- Returns:
New instance of PEPS unit cell with the new unique tensor list.
- Return type:
- save_to_file(path: PathLike, store_config: bool = True, auxiliary_data: Dict[str, Any] | None = None) None[source]
Save unit cell to a HDF5 file.
This function creates a single group “unitcell” in the file and pass this group to the method
save_to_groupthen.- Parameters:
path (
os.PathLike) – Path of the new file. Caution: The file will overwritten if existing.store_config (
bool, optional) – Store the current values of the global config object into the HDF5 file as attrs of an extra group.Default:Trueauxiliary_data (
dictwithstrto storable objects, optional) – Dictionary with string indexed auxiliary HDF5-storable entries which should be stored along the other data in the file.Default:None- save_to_group(grp: Group, store_config: bool = True) None[source]
Save unit cell to a HDF5 group which is be passed to the method.
- Parameters:
grp (
h5py.Group) – HDF5 group object to store the data into.store_config (
bool, optional) – Store the current values of the global config object into the HDF5 file as attrs of an extra group.