Package: pytenet
PyTeNetPyTeNetis 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:importpytenetasptn# 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 dimensionsD=[1,2,4,8,16,28,16,8,4,2,1]psi=ptn.MPS(mpoH.qd,[Di*[0]forDiinD],fill='random')# effectively clamp virtual bond dimension of initial stateDinit=8foriinrange(L):psi.A[i][:,Dinit:,:]=0psi.A[i][:,:,Dinit:]=0psi.orthonormalize(mode='left')# time step can have both real and imaginary parts;# for real time evolution use purely imaginary dt!dt=0.01-0.05jnumsteps=100# run TDVP time evolutionptn.integrate_local_singlesite(mpoH,psi,dt,numsteps,numiter_lanczos=5)# psi now stores the (approximated) time-evolved state exp(-dt*numsteps H) psiFeaturesmatrix product state and operator classesconstruct common Hamiltonians as MPOs, straightforward to adapt to custom Hamiltoniansconvert arbitrary operator chains to MPOsTDVP time evolution (real and imaginary)generate vector / matrix representations of matrix product states / operatorsKrylov subspace methods for local operationsone-site local energy minimization using Lanczos iterationbuilt-in support for additive quantum numbersInstallationTo install PyTeNet from PyPI, callpython3-mpipinstallpytenetAlternatively, you can clone therepositoryand install it in development mode viapython3-mpipinstall-e<path/to/repo>DocumentationThe full documentation is available atpytenet.readthedocs.io.Directory structurepytenet: source code of the actual PyTeNet packagedoc: documentation and tutorialstest: unit tests (might serve as detailed documentation, too)experiments: numerical experiments on more advanced, in-depth topicspaper: JOSS manuscriptContributingFeature requests, discussions and code contributions to PyTeNet in the form ofpull requestsare of course welcome.
Creating anissuemight be a good starting point.
New code should be well documented (Google style docstrings)
and unit-tested (see thetest/subfolder).
For questions and additional support, fell free to contactchristian.b.mendl@gmail.comCitingPyTeNet ispublishedin 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},}LicensePyTeNet is licensed under the BSD 2-Clause license.ReferencesU. SchollwöckThe density-matrix renormalization group in the age of matrix product statesAnn. Phys. 326, 96-192 (2011)(arXiv:1008.3477)J. Haegeman, C. Lubich, I. Oseledets, B. Vandereycken, F. VerstraeteUnifying time evolution and optimization with matrix product statesPhys. Rev. B 94, 165116 (2016)(arXiv:1408.5056)I. P. McCullochFrom density-matrix renormalization group to matrix product statesJ. Stat. Mech. (2007) P10014(arXiv:cond-mat/0701428)T. BarthelPrecise evaluation of thermal response functions by optimized density matrix renormalization group schemesNew J. Phys. 15, 073010 (2013)(arXiv:1301.2246)