ChemTensor
Tensor network algorithms for chemical systems.
This library is written in C, offering a Python 3 interface for more straightforward accessibility.
Documentation is available at chemtensor.readthedocs.io.
Examples
The examples folder contains several demonstrations of the functionalities. Most examples use Jupyter notebooks and the Python interface.
Features
- Matrix product state and operator structures
- Represent common Hamiltonians as MPOs, including molecular Hamiltonians
- General MPO construction with optimized bond dimensions from a list of operator chains
- Block-sparse tensors based on additive quantum number conservation to implement abelian symmetries
- Single- and two-site DMRG algorithm
- Gradient computation with respect to MPO parameters
- Tensor hypercontraction form of molecular Hamiltonians
- Tree tensor network topologies (work in progress)
- Non-abelian symmetries (work in progress)
Installation
ChemTensor can be conveniently installed as a Python package (in a virtual environment) via
(venv) $ pip install chemtensor
This downloads and installs a pre-built Python "wheel" from PyPI; see pypi.org/project/chemtensor/.
Alternatively, you can build the project locally; see the instructions below.
Note that ChemTensor can also run as standalone C code.
Building
The code requires the BLAS, LAPACK, HDF5, and Python 3 development libraries with NumPy. These can be installed via
sudo apt install libblas-dev liblapacke-dev libhdf5-dev python3-dev python3-numpy(on Ubuntu Linux)brew install hdf5 python3 numpy(on arm64 macOS together with the Accelerate framework)
From the project directory, use cmake to build the project:
mkdir build_ct && cd build_ct
cmake ../
cmake --build .
Currently, this will compile the unit tests, which you can run via ./chemtensor_test, as well as the demo examples and Python module library.
To build the corresponding Python package directly, ensure that the Python build tool is installed, and run
python3 -m build . --wheel
pip3 install dist/chemtensor-...whl
The first line should run cmake in the background and create a Python "wheel" (.whl file) in the dist/ subfolder. This package file can then be installed locally via the second line.
Coding style conventions
- Generally, follow the current coding style of the project.
- Naming: lower_case_with_underscores in general (variable, function, and struct names); exceptionally CAPITALIZATION for preprocessor and enum constants.
- Tabs for indentation at the beginning of a line, otherwise whitespace. This ensures that vertical alignment (of, e.g., comments for struct members) is independent of tab size. Avoid trailing whitespace.
- Comments: // for normal comments, /// for Doxygen documentation.
- Put curly braces
{ }after everyifandelse(to avoid pitfalls). - Left-align pointers throughout:
int* pinstead ofint *p. - Keep the
structandenumkeywords in variable types:struct foo f;instead oftypedef struct foo { ... } foo_t; foo_t f;. - Use
constfor function arguments which are not modified by the function.
References
- U. Schollwöck
The density-matrix renormalization group in the age of matrix product states
Ann. Phys. 326, 96-192 (2011) (arXiv:1008.3477) - J. Haegeman, C. Lubich, I. Oseledets, B. Vandereycken, F. Verstraete
Unifying time evolution and optimization with matrix product states
Phys. Rev. B 94, 165116 (2016) (arXiv:1408.5056) - C. Krumnow, L. Veis, Ö. Legeza, J. Eisert
Fermionic orbital optimization in tensor network states
Phys. Rev. Lett. 117, 210402 (2016) (arXiv:1504.00042) - G. K.-L. Chan, A. Keselman, N. Nakatani, Z. Li, S. R. White
Matrix product operators, matrix product states, and ab initio density matrix renormalization group algorithms
J. Chem. Phys. 145, 014102 (2016) (arXiv:1605.02611) - J. Ren, W. Li, T. Jiang, Z. Shuai
A general automatic method for optimal construction of matrix product operators using bipartite graph theory
J. Chem. Phys. 153, 084118 (2020) (arXiv:2006.02056) - Yu Wang, Maxine Luo, Matthias Reumann, Christian B. Mendl
Enhanced Krylov methods for molecular Hamiltonians via tensor hypercontraction
(arXiv:2409.12708)
Release files for chemtensor 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| chemtensor-0.1.3-cp312-cp312-manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64 | Details |
| chemtensor-0.1.3-cp312-cp312-macosx_14_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 14.0+ ARM64 | Details |
| chemtensor-0.1.3-cp311-cp311-manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.28+ x86-64 | Details |
| chemtensor-0.1.3-cp311-cp311-macosx_14_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 14.0+ ARM64 | Details |
| chemtensor-0.1.3-cp310-cp310-manylinux_2_28_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.28+ x86-64 | Details |
| chemtensor-0.1.3-cp310-cp310-macosx_14_0_arm64.whl | CPython 3.10 | CPython 3.10 | macOS 14.0+ ARM64 | Details |
| chemtensor-0.1.3-cp39-cp39-manylinux_2_28_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.28+ x86-64 | Details |
| chemtensor-0.1.3-cp38-cp38-manylinux_2_28_x86_64.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.28+ x86-64 | Details |
Total release size:35.7 MB
Release files / chemtensor-0.1.3-cp312-cp312-manylinux_2_28_x86_64.whl
| Download URL | chemtensor-0.1.3-cp312-cp312-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9bc94410f49cbd5dde7876a29f1314aa6cc9e0a86a7d3e521f09fa8912052241
|
|
BLAKE2b-256 checksum How to use checksums |
4c50c229c3ba1e986a9355879d963d66044ac10f9808bf871202c14e724cd579
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / chemtensor-0.1.3-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | chemtensor-0.1.3-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
d6297be916b381abc1e1bbf8759aa5eb75b4896f8e8817c8da311b6280748c99
|
|
BLAKE2b-256 checksum How to use checksums |
4d5c3918fd68cba16600191681d8f993cc5d20fb7ddb361d40e3fb9d2a6ead23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / chemtensor-0.1.3-cp311-cp311-manylinux_2_28_x86_64.whl
| Download URL | chemtensor-0.1.3-cp311-cp311-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
78bc9af5e7aa366f0aba91e247ac54c65ef71a1d01940d99c925bae98cdda92a
|
|
BLAKE2b-256 checksum How to use checksums |
0b1eab629b0990faf31750dc70a88b743071b1e0048a607ba44ac5d503720379
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / chemtensor-0.1.3-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | chemtensor-0.1.3-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ce628c798dc4a37ad140b84956f86fc641f8e17f5db61e6dd9eac63a169fb397
|
|
BLAKE2b-256 checksum How to use checksums |
707020649f6913725399bc36ceddb4d7b84c9e66798c0dc890f45c524795ee6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / chemtensor-0.1.3-cp310-cp310-manylinux_2_28_x86_64.whl
| Download URL | chemtensor-0.1.3-cp310-cp310-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
96495ac38af49cfd7bab9021e5012397c57708141b8398aa8ff745261f02b4c0
|
|
BLAKE2b-256 checksum How to use checksums |
d84ba8d81c6ea46fbbd0d03eeb816ed0bcd4b20f7cfc67e9ae0dce5f33e82422
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / chemtensor-0.1.3-cp310-cp310-macosx_14_0_arm64.whl
| Download URL | chemtensor-0.1.3-cp310-cp310-macosx_14_0_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
17e876ab74c0e2d80ceae3f135626eb894a5f7bb1a0f9c269b10d6f94632c3b9
|
|
BLAKE2b-256 checksum How to use checksums |
56c96f62acba80fa1943549cb907e96480cf287b5b7e7561dfafc109cb8a1298
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / chemtensor-0.1.3-cp39-cp39-manylinux_2_28_x86_64.whl
| Download URL | chemtensor-0.1.3-cp39-cp39-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.9 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2816012e8bb0739f423e92323df49aadad326f89f3cedab373cb3f2c606d5735
|
|
BLAKE2b-256 checksum How to use checksums |
7408c1e2e15aeb1209c8485465d5dea3aa118e29b430545bb4217ff856628878
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|
Release files / chemtensor-0.1.3-cp38-cp38-manylinux_2_28_x86_64.whl
| Download URL | chemtensor-0.1.3-cp38-cp38-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.8 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
db01717bc647a670a6182eae42eda825c37dc28ccee9c89864083e285194c4a3
|
|
BLAKE2b-256 checksum How to use checksums |
6a84ae66d2302c9f294873f07569739c37aebc4a53cd7239a62c6b9358a35a0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.7
|