/try_tenpy_toycodes

Tutorials to Tensor Network Toycodes and TeNPy with toycodes

Primary LanguageJupyter NotebookGNU General Public License v3.0GPL-3.0

Tutorials on Tensor Networks and Matrix product states

This is a set of tutorials used in various (Winter-/Summer-)Schools on Tensor Networks, e.g. from the European Tensor Network. Each school has it's on branch with the final notebooks used.

This "main" branch keeps a general set of notebooks that can be used as an introduction and that forms the basis for the tutorials in the various schools, and is also included into the main TeNPy documentation.

The tutorials are split into two parts as follows.

In the first part, the exercise_1_*.ipynb notebooks use a set of small "toy codes", small python scripts that require only Python with numpy + scipy + matplotlib. They should give you a good idea how the algorithms work without the need to understand a full library like TeNPy. These python files for this are in the folder tenpy_toycodes, and you need to look into them during the tutorials to see how they work. It should not be necessary to modify the python files, however; you can define all functions etc in the notebooks itself. This will ensure that the other notebooks using them keep working. The exercises itself are in interactive jupyter notebooks, where you can have code, output and plots together.

The exercise_tenpy.ipynb notebook is for the second part, and uses the TeNPy library to demonstrate first examples of calling TeNPy rather than the toycodes.

DISCLAIMER: The toycodes and examples used are not optimized, and we only use very small bond dimensions here to make sure everything runs quickly on a normal laptop. For state-of-the-art MPS calculations (especially for cylinders towards 2D), chi should be significantly larger, often on the order of several 1000s (and significantly more CPU time).

Some References

Setup

Running locally: If you have a working Python installation, feel free to solve all the exercises locally on your own computer. For the most part, you only need the *.ipynb notebooks and the tenpy_toycodes/ folder. For the second part, you need to install TeNPy, which is often just a conda install physics-tenpy or pip install physics-tenpy, depending on your setup.

Jupyter notebooks: We recommend solving the exercises interactively with jupyter notebooks. You can get it with conda install jupyterlab or pip install jupyterlab and then run jupyter-lab, which opens an interactive coding session in your web browser.

Running notebooks on Google colab: You can also use Google's colab cloud service to run the jupyter notebooks without any local installation. Use this option if you have any trouble with your local installation. However, you have to perform addiontal installs:

  • For the first part, exercise_1_*.ipynb, you need to make sure that you not only copy the notebooks itself onto google colab, but also the tenpy_toycodes/ folder (including the __init__.py file). Alternatively, install them by adding and executing a notebook cell !pip install git+https://github.com/tenpy/tenpy_toycodes.git at the top of the notebooks.
  • For the second part, exercise_tenpy.ipynb, you need to install TeNPy. On google colab, this can be done by adding and executing a notebook cell !pip install physics-tenpy at the top of the notebook.

License

All codes are released under GPL (v3) given in the file LICENSE, which means you can freely copy, share and distribute the code. They toycodes in the folder tenpy_toycodes have formerly been distributed directly from the TeNPy repository (also under the GPL).