Skip to main content

Tensor network library for quantum simulations

Project description

https://github.com/cmendl/pytenet/actions/workflows/ci.yml/badge.svg?branch=master 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)
L = 10

# construct matrix product operator representation of
# Heisenberg XXZ Hamiltonian (arguments are L, J, \Delta, h)
mpoH = ptn.heisenberg_xxz_mpo(L, 1.0, 0.8, -0.1)
mpoH.zero_qnumbers()

# initial wavefunction as MPS with random entries
# maximally allowed virtual bond dimensions
D = [1, 2, 4, 8, 16, 28, 16, 8, 4, 2, 1]
psi = ptn.MPS(mpoH.qd, [Di*[0] for Di in D], fill='random')
# effectively clamp virtual bond dimension of initial state
Dinit = 8
for i in range(L):
    psi.A[i][:, Dinit:, :] = 0
    psi.A[i][:, :, Dinit:] = 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.integrate_local_singlesite(mpoH, 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, C. B.},
  title = {PyTeNet: A concise Python 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytenet-1.2.tar.gz (44.0 kB view details)

Uploaded Source

Built Distribution

pytenet-1.2.0-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file pytenet-1.2.tar.gz.

File metadata

  • Download URL: pytenet-1.2.tar.gz
  • Upload date:
  • Size: 44.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for pytenet-1.2.tar.gz
Algorithm Hash digest
SHA256 bde9b6c861c828da48a4a96d85407d30f9d71156233bf3df8f09dc42c9151c97
MD5 eca781567f983167089c78851787c01a
BLAKE2b-256 a793df5a91d7fcacce70810779e736886463ba22dfcdfad04e7246f569826c42

See more details on using hashes here.

File details

Details for the file pytenet-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: pytenet-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 36.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.7

File hashes

Hashes for pytenet-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b24ed40b82ad2b553e4c4bdfcca5e3f5cdfbc0004c8eea6a35d0fdcd0dfafbd
MD5 07351176510c2ae79904c4afd0f407a2
BLAKE2b-256 2d952b29ceefa42357d2347ca824b0f423b66c585970b06cea15d566d13733b6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page