Skip to content


Repository files navigation

TeNeS logo

Branch Build status Documentation
master (latest stable) master doc_en doc_ja
develop (latest) develop doc_en doc_ja


TeNeS (Tensor Network Solver) is a solver for 2D quantum lattice system based on a PEPS wave function and the CTM method. TeNeS can make use of many CPU/nodes through an OpenMP/MPI hybirid parallel tensor operation library, mptensor.

Online manual

Getting started

Prerequisites and dependencies

The following tools are required for building TeNeS.

  • C++11 compiler
  • CMake (>=3.6.0)

TeNeS depends on the following libraries, but these are downloaded automatically through the build process.

TeNeS can be parallerized by using MPI and ScaLAPACK.

TeNeS tools (tenes_simple, tenes_std) are written in Python3. The following external packages are required:

  • numpy
  • scipy
  • toml
  • typing (mandatory for python < 3.5)


Simplest way to build

mkdir build
cd build
cmake ../

(NOTE: Some system (e.g. CentOS) provides CMake 3 as cmake3)

The above commands makes an exectutable file tenes in the build/src directory.

Install binaries and samples

cmake -DCMAKE_INSTALL_PREFIX=<path to install to> ../
make install

Noted that the parallel building make -j <num_parallel> can reduce the time to build.

The make install command installs tenes, tenes_std, and tenes_simple into the <path to install to>/bin . Samples will be also installed into the <path to install to>/share/tenes/<VERSION>/sample . The default value of the <path to install to> is /usr/local .

Specify compiler

CMake detects your compiler automatically but sometimes this is not what you want. In this case, you can specify the compiler by the following way,

cmake -DCMAKE_CXX_COMPILER=<path to your compiler> ../

Disable MPI/ScaLAPACK parallelization

To disable parallelization, pass the -DENABLE_MPI=OFF option to cmake commands.

If you use macos, MPI/ScaLAPACK parallelization is disabled by default because the combination of Apple Accelerate BLAS/LAPACK library with ScaLAPACK seems to have some troubles.

Specify ScaLAPACK

TeNeS finds ScaLAPACK automatically, but may fail. In such a case, -DSCALAPACK_ROOT=<path> option specifies the path to the ScaLAPACK library file, <path>/lib/

Use the pre-built mptensor

TeNeS is based on the parallerized tensor library, mptensor (>= v0.3). The build system of TeNeS installs this automatically, but you can use the extra pre-built mptensor by the following way.

cmake -DMPTENSOR_ROOT=<path to mptensor> ../

Specify Python interpreter

TeNeS tools tenes_simple and tenes_std use python3 which can be found in PATH via /usr/bin/env python3. Please make sure that python3 command invokes Python3 interpreter, for example, by using type python3 .

If you want to fix the interpreter to be used (or /usr/bin/env does not exist), you can specify it by the following way,

cmake -DTENES_PYTHON_EXECUTABLE=<path to your interpreter> ../


Use pre-defined model and lattice

For example, the following file simple.toml represents the transverse field Ising model on the square lattice.

is_real = true

num_step = 1000
tau = 0.01

num_step = 0
tau = 0.01

iteration_max = 10
dimension = 10

type = "square lattice"
L = 2
W = 2
virtual_dim = 2
initial = "ferro"

type = "spin"
Jz = -1.0 # negative for FM interaction
Jx = 0.0
Jy = 0.0
hx = 1.0   # transverse field

tenes_simple is a utility tool for converting this file to another file, std.toml, denoting the operator tensors including bond hamiltonian.

tenes_simple simple.toml

Calculate imaginary time evolution operators

tenes_std is another utility tool for calculating imaginary time evolution operators and converting std.toml to the input file of tenes, input.toml.

tenes_std std.toml

By editing std.toml, users can perform other models and lattices as ones like.


To perform simulation, pass input.toml to tenes as the following

tenes input.toml

Results can be found in output directory. For example, expectation values of operators per site are stored in output/densities.dat as the following,

Sz          =  2.97866964051826333e-01  0.00000000000000000e+00
Sx          =  3.86024172907023511e-01  0.00000000000000000e+00
hamiltonian = -7.57303058659582140e-01  0.00000000000000000e+00
SzSz        =  2.16869216589772901e-01  0.00000000000000000e+00
SxSx        =  3.19350111777505108e-01  0.00000000000000000e+00
SySy        = -4.77650003168152704e-02  0.00000000000000000e+00

The file format of input/output files is described in the manual page.

Question or comment

Feel free to ask any question through an issue (public) or an e-mail (private) (, __at__ -> @).


Pull request is welcome (even for a small typo, of course!). Before send a PR, please make sure the following:

  • Rebase (or merge) develop branch into your feature branch
  • Check make and ctest processes pass
  • Format Codes by using clang-format (C++) and black (Python)

(Incomplete) developer's document written in doxygen is available.

  1. Move to docs/doxygen
  2. Invoke doxygen
  3. Open doxygen_out/html/index.html in your browser


TeNeS is available under the GNU GPL v3.


When you publish the results by using TeNeS, we would appreciate if you cite the following paper:

Y. Motoyama, Tsuyoshi Okubo, Kazuyoshi Yoshimi, Satoshi Morita, Takeo Kato, and Naoki Kawashima, "TeNeS: Tensor Network Solver for Quantum Lattice Systems", Comput. Phys. Commun. 279, 108437 (2022)


TeNeS was supported by MEXT as "Exploratory Challenge on Post-K computer" (Frontiers of Basic Science: Challenging the Limits) and "Priority Issue on Post-K computer" (Creation of New Functional Devices and High-Performance Materials to Support Next-Generation Industries). We also would also like to express our thanks for the support of the "Project for advancement of software usability in materials science" of The Institute for Solid State Physics, The University of Tokyo, for the development of TeNeS.