acetn.ipeps package

Submodules

acetn.ipeps.ipeps module

class acetn.ipeps.ipeps.Ipeps(config, ipeps=None)

Bases: TensorNetwork

Infinite Projected Entangled Pair States (iPEPS) tensor network class.

Handles initialization, evolution, renormalization, and measurement procedures for iPEPS simulations, including distributed setup.

Attributes:

config (IpepsConfig): Configuration for iPEPS simulation. dtype (torch.dtype): Data type for tensors. device (torch.device): Device (CPU/GPU) for computation. is_distributed (bool): Flag for distributed computation. rank (int): Process rank in distributed setting. world_size (int): Total number of processes in distributed setting.

evolve(dtau, steps, model=None)

Apply imaginary time evolution to the iPEPS state.

Args:

dtau (float): Time step for evolution. steps (int): Number of evolution steps. model (optional): Custom model instance to use.

measure(model=None)

Perform measurements on the current iPEPS state.

Args:

model (optional): Custom model instance to use.

Returns:

dict: Measurement results.

renormalize()

Perform CTMRG renormalization on the current iPEPS state.

set_chi(chi)

Set the boundary bond dimension chi.

Args:

chi (int): Boundary bond dimension.

set_model(model_cls, params, name=None)

Register and set a model for simulation.

Args:

model_cls (type): Model class to register. params (dict): Parameters for the model. name (str, optional): Name for the custom model.

set_model_params(**kwargs)

Update model parameters.

Args:

**kwargs: Key-value pairs of model parameters to update.

setup_distributed()

Set up distributed environment if available.

acetn.ipeps.ipeps_config module

class acetn.ipeps.ipeps_config.CTMRGConfig(steps: int = 40, projectors: Literal['half-system', 'full-system'] = 'half-system', svd_type: Literal['rsvd', 'full-rank'] = 'rsvd', svd_cutoff: float = 1e-12, rsvd_niter: int = 2, rsvd_oversampling: int = 2, disable_progressbar: bool = False)

Bases: object

disable_progressbar: bool = False
projectors: Literal['half-system', 'full-system'] = 'half-system'
rsvd_niter: int = 2
rsvd_oversampling: int = 2
steps: int = 40
svd_cutoff: float = 1e-12
svd_type: Literal['rsvd', 'full-rank'] = 'rsvd'
class acetn.ipeps.ipeps_config.EvolutionConfig(update_type: str = 'full', use_gauge_fix: bool = True, gauge_fix_atol: float = 1e-12, positive_approx_cutoff: float = 1e-12, als_niter: int = 100, als_tol: int = 1e-12, als_method: Literal['cholesky', 'pinv'] = 'cholesky', als_epsilon: float = 1e-12, disable_progressbar: bool = False)

Bases: object

als_epsilon: float = 1e-12
als_method: Literal['cholesky', 'pinv'] = 'cholesky'
als_niter: int = 100
als_tol: int = 1e-12
disable_progressbar: bool = False
gauge_fix_atol: float = 1e-12
positive_approx_cutoff: float = 1e-12
update_type: str = 'full'
use_gauge_fix: bool = True
class acetn.ipeps.ipeps_config.IpepsConfig(TN: ~typing.Dict, dtype: str | ~torch.dtype = 'float64', device: str | ~torch.device = 'cpu', ctmrg: ~typing.Dict = <factory>, evolution: ~typing.Dict = <factory>, model: ~typing.Dict = <factory>)

Bases: object

Configuration class for iPEPS setup.

TN: Dict
ctmrg: Dict
device: str | device = 'cpu'
disable_pbar_if_slurm()
dtype: str | dtype = 'float64'
evolution: Dict
model: Dict
set_device(device)

Set the device to either the provided value or a default.

set_dtype(dtype)

Set the dtype to either the provided value or a default.

class acetn.ipeps.ipeps_config.ModelConfig(dtype: torch.dtype, device: torch.device, dim: int, name: str = None, params: Dict[str, int] = None)

Bases: object

device: device
dim: int
dtype: dtype
name: str = None
params: Dict[str, int] = None
class acetn.ipeps.ipeps_config.TNConfig(nx: int = 2, ny: int = 2, dims: Dict[str, int] = <factory>)

Bases: object

dims: Dict[str, int]
nx: int = 2
ny: int = 2

acetn.ipeps.site_tensor module

class acetn.ipeps.site_tensor.SiteTensor(dims, site_tensor=None, site_state=[1.0, 0.0], dtype=torch.float64, device=device(type='cpu'))

Bases: object

A class that represents a site tensor with corner and edge tensors in a tensor network.

The SiteTensor class provides methods to initialize, copy, and manipulate the site tensor, corner tensors, and edge tensors. These tensors are used to form the iPEPS tensor network.

bond_permute(k)

Permutes the bond indices of the site tensor.

This method returns a version of the site tensor with its bond dimensions permuted by an offset k.

Args:

k (int): The offset used to permute the bond dimensions.

Returns:

torch.Tensor: The permuted site tensor.

copy()

Returns a deep copy of the current SiteTensor instance.

Returns:

SiteTensor: A new SiteTensor with identical contents and metadata.

copy_from(site_tensor)

Copies from the tensors from another SiteTensor.

Args:

site_tensor (SiteTensor): The SiteTensor to copy from.

initialize_corner_tensors()

Initializes the corner tensors for the site tensor.

The corner tensors are computed from the bond-permuted site tensor using an einsum contraction. They are normalized, and stored in self._corner_tensors.

If initial_condition is set to “random”, the corner tensors are initialized randomly.

Returns:

None

initialize_edge_tensors()

Initializes the edge tensors for the site tensor.

The edge tensors are computed from the bond-permuted site tensor using an einsum contraction. They are normalized, and stored in self._edge_tensors.

If initial_condition is set to “random”, the edge tensors are initialized randomly.

Returns:

None

initialize_site_tensor(site_state=[1.0], noise=0.0)

Initializes the site tensor with a given state and optional noise.

The site tensor is initialized with random values, and the provided site_state is added to the first entry of the tensor. The tensor is then normalized.

Args:

site_state (list, optional): A list specifying the initial state for the site tensor (default is [1.]). noise (float, optional): The amount of noise to add to the site tensor (default is 0.0).

to(dtype=None, device=None)

Sends the tensors to a device and/or changes the data type.

Args:

dtype (torch.dtype, optional): The data type of the tensors. device (torch.device, optional): The device where the tensors are placed.

Returns:

SiteTensor: The site tensor with updated device and/or dtype.

acetn.ipeps.tensor_network module

class acetn.ipeps.tensor_network.TensorNetwork(tensor_network, config, dtype, device)

Bases: object

A class representing a tensor network, specifically for the iPEPS (infinite projected entangled pair states) method.

This class handles the construction, initialization, and manipulation of a tensor network. It supports operations such as saving, loading, and setting up tensor networks, as well as managing the tensors.

build_bond_list()

Builds the list of bonds connecting sites in the tensor network.

This method creates horizontal and vertical bonds between adjacent sites in the lattice.

Returns:

list: A list of bonds, where each bond is represented as a list of two sites and the bond direction.

build_site_list()

Builds the list of all sites in the tensor network.

This method creates a list of all (xi, yi) coordinates for the lattice sites.

Returns:

list: A list of all site coordinates in the tensor network.

copy()

Returns a deep copy of the current TensorNetwork instance.

Returns:

TensorNetwork: A new TensorNetwork with identical contents and metadata.

copy_from(tensor_network)

Copies the tensor network from another instance.

Args:

tensor_network (TensorNetwork): Another instance of TensorNetwork to copy tensors from.

initialize_site_tensors(site_state_map)

Initializes the tensors for the entire tensor network.

This method creates tensors for all sites in the network and stores them in the _tensor_network dictionary.

load(filename)

Loads the tensor network from a file.

Args:

filename (str): The name of the file to load the tensor network from.

save(filename='ipeps.pt')

Saves the current tensor network to a file.

Args:

filename (str): The file name for the saved file.

Saves the tensor network and its tensors to a PyTorch binary file.

setup_tensor_network(tensor_network)

Initializes or copies the tensor network based on the input.

If no tensor network is provided, it initializes a new one in a uniform polarized product state. Otherwise, it copies from the provided network.

Args:

tensor_network (TensorNetwork, optional): Another tensor network to copy from. If None, a new network is created.

to(dtype=None, device=None)

Sends the tensor network to a device and/or changes the data type.

Args:

dtype (torch.dtype, optional): The data type of the tensors. device (torch.device, optional): The device where the tensors are placed.

Returns:

TensorNetwork: The tensor network with updated device and/or dtype.

Module contents