This project is a python implementation of Tensor Network, a numerical approach to quantum many-body systems.
tnpy is built on top of quimb, along with TensorNetwork for tensor contractions, with optimized support for various backend engines (TensorFlow, JAX, PyTorch, and Numpy). For eigen-solver we adopt primme, an iterative multi-method solver with preconditioning.
Currently, we support Matrix Product State (MPS) algorithms, with more are coming...
- Exact Diagonalization (ED)
- Finite-sized Density Matrix Renormalization Group (fDMRG)
- Tree tensor Strong Disorder Renormalization Group (tSDRG)
fDMRG & tSDRG are on alpha-release. For others, please expect edge cases.
Dependencies are listed in pyproject.toml, and they are supposed to be installed together with tnpy. Here we just list the essential building blocks.
Also, it's required to have lapack and blas installed in prior to Primme. They can also be installed through pip with mkl-devel.
-
Using Docker
docker run --rm -it tanlin2013/tnpy
-
Using pip
- Latest release:
pip install tnpy
- Development version:
pip install git+https://github.com/tanlin2013/tnpy@main
- Latest release:
-
Optional dependencies
- If lapack and
blas are missing
pip install tnpy[mkl]
- For quimb drawing functionality.
This will install matplotlib
and networkx
pip install tnpy[drawing]
- If lapack and
blas are missing
-
We provide built-in models. Though it's also possible to register your own one.
import numpy as np from tnpy.finite_dmrg import FiniteDMRG from tnpy.model import XXZ model = XXZ(n=100, delta=0.5) fdmrg = FiniteDMRG( mpo=model.mpo, chi=60 # virtual bond dimensions ) fdmrg.update(tol=1e-8)
-
Compute any physical quantities whatever you want from the obtained state. The resulting MPS is of the type
quimb.tensor.MatrixProductState
, see here for more details.my_mps = fdmrg.mps
© Tan Tao-Lin, 2023. Licensed under a MIT license.