Skip to content

Latest commit

 

History

History
81 lines (64 loc) · 4.18 KB

README.md

File metadata and controls

81 lines (64 loc) · 4.18 KB

Unit tests

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
  • Tree tensor network topologies (work in progress)
  • Non-abelian symmetries (work in progress)

Building

The code requires the BLAS, LAPACKE, 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 openblas lapack hdf5 python3 numpy (on MacOS)

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, 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 every if and else (to avoid pitfalls).
  • Left-align pointers throughout: int* p instead of int *p.
  • Keep the struct and enum keywords in variable types: struct foo f; instead of typedef struct foo { ... } foo_t; foo_t f;.
  • Use const for function arguments which are not modified by the function.

References