Skip to content

Chan-Sing-Hong/code_XY_clock

Repository files navigation

code_XY_clock

A research project implementing HOTRG (Higher-Order Tensor Renormalization Group) simulations using the Cytnx library.

1. Environment Requirements

2. Anaconda Installation

You can download the installer from the Anaconda Archive.

Or use the following command line:

curl -O https://repo.anaconda.com/archive/Anaconda3-2025.12-2-Linux-x86_64.sh

Install Anaconda:

bash ~/Anaconda3-2025.12-2-Linux-x86_64.sh

3. Cytnx Installation

Create a dedicated Conda environment build Cytnx from source.

3.1 Create Conda Environment

conda config --add channels conda-forge
conda create --name cytnx python=3.9 _openmp_mutex=*=*_llvm
conda activate cytnx
conda upgrade --all

3.2 Install Build Dependencies

conda install cmake make boost libboost git compilers numpy openblas pybind11 beartype boost-cpp arpack

3.3 Clone and Build

git clone https://github.com/cytnx-dev/cytnx.git
cd cytnx
mkdir build
cd build

Configure (Replace /home/chansh/cytnx_install with your desired path):

cmake .. -DCMAKE_INSTALL_PREFIX=/home/chansh/cytnx_install

Compile and install:

make -j$(nproc)
make install

4. Usage Configuration

Path Setup
To use the compiled library in Python, add the installation path manually.

Quick Start (In-script)
Add the following snippet at the beginning of your Python files (make sure this path is correctly modified in all_fn.py):

import sys

# Update this path to where you installed Cytnx
sys.path.insert(0, "/home/chansh/cytnx_install")

import cytnx as cy
print(cy.__version__)

5. Code implement

Parameters

model_name
Defines the physical model

  • 2D XY model,
model_name = "2D_M={}_XY"

Replace {} with the Fourier cutoff value $M$.

  • 2D clock model:
model_name = "2D_q={}_clock"

Replace {} with the q-value.


symm
Boolean. Whether to preserve the symmetric block structure of tensors.


dcut
The bond-dimension cutoff used in HOTRG.


Lmax
Upper limit of system size $L$.


unit_size
Controls the initial size of the system before applying HOTRG.
The elementary tensor $T^{(1,1)}$ is first exactly contracted into system size unit_size * unit_size.
For example, when unit_size=3, we produces an effective tensor $T^{(3,3)}$ representing a $3\times 3$ lattice.

     ┏━┷━┓ ┏━┷━┓ ┏━┷━┓
    ─┨ T ┠─┨ T ┠─┨ T ┠─
     ┗━┯━┛ ┗━┯━┛ ┗━┯━┛
     ┏━┷━┓ ┏━┷━┓ ┏━┷━┓          ┏━━━┷━━━┓    
    ─┨ T ┠─┨ T ┠─┨ T ┠─   =    ─┨ T_3x3 ┠─
     ┗━┯━┛ ┗━┯━┛ ┗━┯━┛          ┗━━━┯━━━┛
     ┏━┷━┓ ┏━┷━┓ ┏━┷━┓
    ─┨ T ┠─┨ T ┠─┨ T ┠─
     ┗━┯━┛ ┗━┯━┛ ┗━┯━┛

After N steps HOTRG, the system size becomes $L = 3 \times 2^N $.


iteration
The label of temperature list Ts_tot.


iT
Index of temperature T within temperature list Ts_tot.


iL
Index of size L within size list Ls_tot.


n
Stacking number used to constructed transfer matrix TM $^{(L, nL)}$.
The transfer matrix is built by tracing all vertical bonds using n copies of $T$ tensor.

Example: Transfer matrix (PBC) with n=3

          ┌───┐
        ┏━┷━┓ │
    1───┨ T ┠─│──101
        ┗━┯━┛ │                ┏━━╳━┓
        ┏━┷━┓ │              1─┨    ┠─101    
    2───┨ T ┠─│──102    =    2─┨ TM ┠─102
        ┗━┯━┛ │              3─┨    ┠─103
        ┏━┷━┓ │                ┗━━━━┛
    3───┨ T ┠─│──103
        ┗━┯━┛ │
          └───┘

num_collect
Maximum number of eigenvalues to compute.


hermitian
Boolean. Whether to perform Hermitian diagonalization.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors