Skip to content

andywiecko/pystrel

Repository files navigation

pystrel

Library for exact calculations of strongly correlated systems.

Warning
This package is currently in a preview state. The API is subject to change without advance notice. It is not recommended for production usage.

test codecov gh-pages

The main goal of this package is to provide an easy-to-use interface for performing precise calculations on strongly correlated systems. The package offers the following features:

  • CPU/GPU agnostic code,
  • Customizable system topologies, particle types, ensembles, and more,
  • Support for different data types, including real/complex numbers and dense/sparse matrices.

If you encounter any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request.

We hope this library enhances your research on strongly correlated systems. Happy computing!

Installation

Install with wheel file
  1. Download wheel file from the releases page.
  2. Install wheel with pip
pip install pystrel-0.1.0-py3-none-any.whl
Install with git
  1. Clone repository
git clone https://github.com/andywiecko/pystrel
  1. Install flit (if necessary)
pip install flit
  1. Install package (including dev tools)
flit install
Install with pip (TBA with v1.0)

Supported models

Spinless fermions

tag Operator
t $\sum_{i,j} \left(t_{ij} , a_i^\dagger a_j + \text{h.c.}\right)$
V $\sum_{i,j} V_{ij} , n_i n_j$
Delta $\sum_{i,j} \left(\Delta_{ij} , a_i^\dagger a_j^\dagger + \text{h.c.}\right)$
mu $\mu N = \mu \sum_{i} , n_i$
epsilon $\sum_i \epsilon_i , n_i$

Spins 1/2

tag Operator
Jz $\sum_{i,j} J_{ij}^z , \sigma_i^z \sigma_j^z$
hz $\sum_{i} h_{i}^z , \sigma_i^z$
gamma $\sum_{i,j} \left(\gamma_{ij} , \sigma_i^+\sigma_j^- + \text{h.c.}\right)$
hx $\sum_{i} h_{i}^x , \sigma_i^x$

Accelerate computation with GPU

This package is designed to easily switch between CPU and GPU target devices. To enable GPU computation, you need to install CUDA/ROCm (depending on the GPU manufacturer) and then cupy.

Examples

Below, you can find an example usage of the package for solving the eigenproblem of the given Hamiltonian (with periodic boundary condition):

$$ H = -J\sum_{i=1}^L \sigma^z_i\sigma^z_{i+1} + \sum_{i=1}^L (-1)^i \sigma^z_i. $$

import pystrel as ps

L = 10
J = 1.0
params = {
    "sites": L,
    "terms": {
        'Jz': {(i, (i+1) % L): -J for i in range(L)},
        'hz': {i: (-1.0)**i for i in range(L)},
    },
}
model = ps.Model(params)
h = model.build_hamiltonian(device='cpu', sparsity='dense')
e, v = ps.spectrum.get_full_spectrum(h)

Visit the documentation page for more details. To learn about advanced usage, please refer to the following tutorials:

Tutorial notebooks can be found and downloaded from the project repository: examples/.

Benchmark

For performance benchmarking using CPU/GPU, please refer to the results available here. Keep in mind that performance may vary based on your machine's specifications and the specific problem being solved.

It's worth noting that GPUs tend to perform better with dense matrices, whereas CPUs show better performance with sparse matrices. However, in dynamic contexts, there might not be a noticeable speedup from parallelization.

Note
Please be aware that performance characteristics may change in future versions.

Roadmap for v1.0.0

List of the tasks to consider before the v1.0.0 release:

  • perf: state class
  • perf: gpu kernels
  • perf: numba acceleration
  • feat: topology utils
  • feat: additional terms: 3dim (tJ like), 4 dim (Hubbard like)
  • feat: lioms
  • feat: additional operators
  • feat: parameters json/yaml load

About

Exact calculations related to strongly correlated systems

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Languages