Skip to main content
https://github.com/cmendl/pytenet/actions/workflows/ci.yml/badge.svg http://joss.theoj.org/papers/10.21105/joss.00948/status.svg

PyTeNet

PyTeNet is a Python implementation of quantum tensor network operations and simulations within the matrix product state framework, using NumPy to handle tensors.

Example usage for TDVP time evolution:

import pytenet as ptn

# number of lattice sites (1D with open boundary conditions)
nsites = 10

# construct matrix product operator representation of the
# Heisenberg XXZ Hamiltonian (arguments are nsites, J, \Delta, h)
h_mpo = ptn.heisenberg_xxz_1d_mpo(nsites, 1.0, 0.8, -0.1)
h_mpo.zero_qnumbers()

# initial wavefunction as MPS with random entries
# maximally allowed virtual bond dimensions
b = [1, 2, 4, 8, 16, 28, 16, 8, 4, 2, 1]
psi = ptn.MPS(h_mpo.qsite, [bi*[0] for bi in b], fill="random")
# effectively clamp virtual bond dimension of initial state
b_init = 8
for i in range(nsites):
    psi.a[i][:, b_init:, :] = 0
    psi.a[i][:, :, b_init:] = 0
psi.orthonormalize(mode="left")

# time step can have both real and imaginary parts;
# for real time evolution use purely imaginary dt!
dt = 0.01 - 0.05j
numsteps = 100

# run TDVP time evolution
ptn.tdvp_singlesite(h_mpo, psi, dt, numsteps, numiter_lanczos=5)
# psi now stores the (approximated) time-evolved state exp(-dt*numsteps H) psi

Features

  • matrix product state and operator classes

  • construct common Hamiltonians as MPOs, straightforward to adapt to custom Hamiltonians

  • convert arbitrary operator chains to MPOs

  • TDVP time evolution (single- and two-site, both real and imaginary time)

  • generate vector / matrix representations of matrix product states / operators

  • Krylov subspace methods for local operations, like local energy minimization

  • single- and two-site DMRG algorithm

  • built-in support for additive quantum numbers

Installation

To install PyTeNet from PyPI, call

python3 -m pip install pytenet

Alternatively, you can clone the repository and install it in development mode via

python3 -m pip install -e <path/to/repo>

Documentation

The full documentation is available at pytenet.readthedocs.io.

Directory structure

  • pytenet: source code of the actual PyTeNet package

  • doc: documentation and tutorials

  • test: unit tests (might serve as detailed documentation, too)

  • experiments: numerical experiments on more advanced, in-depth topics

  • paper: JOSS manuscript

Contributing

Feature requests, discussions and code contributions to PyTeNet in the form of pull requests are of course welcome. Creating an issue might be a good starting point. New code should be well documented (Google style docstrings) and unit-tested (see the test/ subfolder). For questions and additional support, fell free to contact christian.b.mendl@gmail.com

Citing

PyTeNet is published in the Journal of Open Source Software - if it’s ever useful for a research project please consider citing it:

@Article{pytenet,
  author  = {Mendl, Christian B.},
  title   = {{PyTeNet}: A concise {P}ython implementation of quantum tensor network algorithms},
  journal = {Journal of Open Source Software},
  year    = {2018},
  volume  = {3},
  number  = {30},
  pages   = {948},
  doi     = {10.21105/joss.00948},
}

License

PyTeNet is licensed under the BSD 2-Clause license.

References

  1. U. Schollwöck
    The density-matrix renormalization group in the age of matrix product states
  2. J. Haegeman, C. Lubich, I. Oseledets, B. Vandereycken, F. Verstraete
    Unifying time evolution and optimization with matrix product states
  3. I. P. McCulloch
    From density-matrix renormalization group to matrix product states
  4. T. Barthel
    Precise evaluation of thermal response functions by optimized density matrix renormalization group schemes

Metadata

Release files for pytenet 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytenet 1.3.0
File Size Uploaded Provenance Actions
pytenet-1.3.0.tar.gz 68.1 kB Without provenance Details for pytenet-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pytenet 1.3.0
File Interpreter ABI Platform Actions
pytenet-1.3.0-py3-none-any.whl Python 3 none any Details for pytenet-1.3.0-py3-none-any.whl

Total release size: 126.1 kB

Release files / pytenet-1.3.0.tar.gz

Download URL pytenet-1.3.0.tar.gz
Size 68.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b871393d72b85fb5407f85600205d56819be2ed0677eddfed6cea5b26385fb0c
BLAKE2b-256 checksum
How to use checksums
9da4cd17f84cf02d6f30537ea55bd96d0071ef681dd96cf1598702df9d916908
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Release files / pytenet-1.3.0-py3-none-any.whl

Download URL pytenet-1.3.0-py3-none-any.whl
Size 58.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cba7732ecb4ba15a661c2701887a259a26026217362090f1a1e8823926c038e9
BLAKE2b-256 checksum
How to use checksums
ca0e2af82d1887f09417cdb49f64e6920de86ad98831decb5b6afcbeb82b9aff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for pytenet 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page