Skip to main content

Documentation Status Build Status License: GPL v3 PyPI version

block2

The block2 code provides an efficient and highly scalable implementation of the Density Matrix Renormalization Group (DMRG) for quantum chemistry, based on the Matrix Product Operator (MPO) formalism.

The block2 code is developed as an improved version of StackBlock, where the low-level structure of the code has been completely rewritten. The block2 code is developed and maintained in Garnet Chan group at Caltech and Initiative for Computational Catalysis at Flatiron Institute.

Main contributors:

  • Huanchen Zhai @hczhai: DMRG and parallelization
  • Henrik R. Larsson @h-larsson: DMRG-MRCI/MRPT, large site, Green's function in frequency and time for finite temp.
  • Seunghoon Lee @seunghoonlee89: Stochastic perturbative DMRG
  • Zhi-Hao Cui @zhcui: User interface

If you find this package useful for your scientific research, please cite the work as:

  • H. Zhai, H. R. Larsson, S. Lee, Z.-H. Cui, T. Zhu, C. Sun, L. Peng, R. Peng, K. Liao, J. Tölle, J. Yang, S. Li, and G. K.-L. Chan. Block2: A comprehensive open source framework to develop and apply state-of-the-art DMRG algorithms in electronic structure and beyond. The Journal of Chemical Physics 159, 234801 (2023). doi: 10.1063/5.0180424

For parallel ab initio DMRG, please cite

  • H. Zhai, and G. K.-L. Chan. Low communication high performance ab initio density matrix renormalization group algorithms. The Journal of Chemical Physics 154, 224116 (2021). doi: 10.1063/5.0050902.

For large site DMRG-MRCI/MRPT, please cite

  • H. R. Larsson, H. Zhai, K. Gunst, and G. K.-L. Chan. Matrix product states with large sites. Journal of Chemical Theory and Computation 18, 749-762 (2022). doi: 10.1021/acs.jctc.1c00957.

For DMRG with spin-orbit-coupling, please cite

  • H. Zhai, and G. K.-L. Chan. A comparison between the one- and two-step spin-orbit coupling approaches based on the ab initio Density Matrix Renormalization Group. The Journal of Chemical Physics 157, 164108 (2022). doi: 10.1063/5.0107805.

You can find a bibtex file in CITATIONS.bib.

For a list of DMRG references for methods implemented in block2, see: https://block2.readthedocs.io/en/latest/user/references.html.

One can install block2 using pip (note: for very new Python versions, the --extra-index-url option of pip is required, see below for installing the development version of block2):

  • OpenMP-only version (no MPI dependence)

    pip install block2
    
  • Hybrid openMP/MPI version (requiring openMPI 5.0.x for block2-mpi >= 0.5.3 or 4.1.x for block2-mpi <= 0.5.2 and block2-mpi <= 0.5.3rc19)

    pip install block2-mpi
    
  • Binary format is prepared via pip for python 3.8, 3.9, 3.10, 3.11, 3.12, and 3.13 with macOS (x86 and arm64, no-MPI), Linux (no-MPI/openMPI), or Windows (x86, no-MPI). If these binaries have some problems, you can use the --no-binary option of pip to force building from source (for example, pip install block2 --no-binary block2).

  • One should only install one of block2 and block2-mpi. block2-mpi covers all features in block2, but its dependence on mpi library can sometimes be difficult to deal with. Some guidance for resolving environment problems can be found in issue #7 and here.

  • To install the most recent development version, use:

    pip install block2==<version> --extra-index-url=https://block-hczhai.github.io/block2-preview/pypi/
    pip install block2-mpi==<version> --extra-index-url=https://block-hczhai.github.io/block2-preview/pypi/
    

    where <version> can be some development version number like 0.5.4rc17 (see https://github.com/block-hczhai/block2-preview/tags for a complete list of version numbers. The letter p is not needed). To force reinstalling an updated version, you may consider pip options --upgrade --force-reinstall --no-deps --no-cache-dir. For the most recent development version, binary format is prepared for python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.13t, 3.14, and 3.14t with macOS (arm64), Linux (x86_64 and aarch64), or Windows (x86_64) with no MPI dependence, and Linux (x86_64) with openMPI.

The detailed instructions on manual installation can be found here.

To run a DMRG calculation using the command line interface, please use the following command:

block2main dmrg.conf > dmrg.out

where dmrg.conf is the StackBlock style input file and dmrg.out contains the outputs. Example input files can be found here.

For DMRGSCF calculation, please have a look at here.

Documentation: https://block2.readthedocs.io/en/latest/

Tutorial (Python interface): https://block2.readthedocs.io/en/latest/tutorial/qc-hamiltonians.html

Custom model Hamiltonians can be supported via a Python interface: Fermi-Hubbard, Bose-Hubbard, Hubbard-Holstein, SU(2) Heisenberg, SU(3) Heisenberg, t-J, and correlation functions.

Other examples: Vibrational Problems, and Partial Differential Equations.

Source code: https://github.com/block-hczhai/block2-preview

Example DMRG scripts for realistic quantum chemistry systems: https://github.com/hczhai/block2-example-data/tree/master/00-HC

For a simplified implementation of ab initio DMRG, see pyblock3. Data can be imported and exported between block2 and pyblock3, see https://github.com/block-hczhai/block2-preview/discussions/35.

Features

  • State symmetry
    • U(1) particle number symmetry
    • SU(2) or U(1) spin symmetry (spatial orbital)
    • No spin symmetry (general spin orbital)
    • Abelian point group symmetry
    • Translational (K point) / Lz symmetry
  • Sweep algorithms (1-site / 2-site / 2-site to 1-site transition)
    • Ground-State DMRG
      • Decomposition types: density matrix / SVD
      • Noise types: wavefunction / density matrix / perturbative
    • Multi-Target Excited-State DMRG
      • State-averaged / state-specific
    • MPS compression / addition
    • Expectation
    • Imaginary / real time evolution
      • Hermitian / non-Hermitian Hamiltonian
      • Time-step targeting method
      • Time dependent variational principle method
    • Green's function
  • Finite-Temperature DMRG (ancilla approach)
    • Green's function
    • Time evolution
  • Low-Temperature DMRG (partition function approach)
  • Particle Density Matrix (0-site / 1-site / 2-site)
    • 1PDM / 2PDM / 3PDM / 4PDM / ...
    • Transition 1PDM / 2PDM / 3PDM / 4PDM / ...
    • Spin / charge correlation
  • Quantum Chemistry MPO
    • Normal-Complementary (NC) partition
    • Complementary-Normal (CN) partition
    • Conventional scheme (switch between NC and CN near the middle site)
  • Symbolic MPO simplification
  • MPS initialization using occupation number
  • Supported matrix representation of site operators
    • Block-sparse (outer) / dense (inner)
    • Block-sparse (outer) / elementwise-sparse (CSR, inner)
  • Fermionic MPS algebra (non-spin-adapted only)
  • Determinant/CSF coefficients of MPS
    • Extracting Determinant/CSF coefficients from MPS
    • Constructing MPS from Determinant/CSF coefficients
  • Multi-level parallel DMRG
    • Parallelism over sites (2-site only)
    • Parallelism over sum of MPOs (distributed)
    • Parallelism over operators (distributed/shared memory)
    • Parallelism over symmetry sectors (shared memory)
    • Parallelism within dense matrix multiplications (MKL)
  • DMRG-CASSCF and contracted dynamic correlation
    • DMRG-CASSCF (pyscf / openMOLCAS / forte interface)
    • DMRG-CASSCF nuclear gradients and geometry optimization (pyscf interface, RHF reference only)
    • DMRG-sc-NEVPT2 (pyscf interface, classical approach)
    • DMRG-sc-MPS-NEVPT2 (pyscf interface, MPS compression approximation)
    • DMRG-CASPT2 (openMOLCAS interface)
    • DMRG-cu-CASPT2 (openMOLCAS interface)
    • DMRG-MRDSRG (forte interface)
  • Stochastic perturbative DMRG
  • DMRG with Spin-Orbit Coupling (SOC)
    • 1-step approach (full complex one-MPO and hybrid real/complex two-MPO schemes)
    • 2-step approach
  • Uncontracted dynamic correlation
    • DMRG Multi-Reference Configuration Interaction (MRCI) of arbitrary order
    • DMRG Multi-Reference Averaged Quadratic Coupled Cluster (AQCC)/ Coupled Pair Functional (ACPF)
    • DMRG NEVPT2/3/..., REPT2/3/..., MR-LCC, ...
  • Orbital Reordering
    • Fiedler
    • Genetic algorithm
  • MPS Transformation
    • SU2 to SZ mapping
    • Point group mapping
    • Orbital basis rotation
  • MPO Construction Methods
    • Symbolic (optimized for quantum chemistry)
    • Bipartite
    • SVD
    • Rank-Revealing QR
  • Interface for Partial Differential Equations / Quantized Tensor Train

StackBlock Compatibility

A StackBlock 1.5 compatible user interface can be found at pyblock2/driver/block2main. This script can work as a replacement of the StackBlock binary, with a few limitations and some extensions. The format of the input file dmrg.conf is identical to that of StackBlock 1.5. See docs/driver.md and docs/source/user/basic.rst for detailed documentation for this interface. Examples using this interface can be found at tests/driver.

Instructions for installing the StackBlock code can be found in here. A list of precompiled binaries of StackBlock can be found in here.

Metadata

Release files for block2-mpi 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for block2-mpi 0.5.4
File Size Uploaded
block2_mpi-0.5.4.tar.gz 1.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for block2-mpi 0.5.4
File
block2_mpi-0.5.4-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.15 CPython 3.15 free-threading Linux glibc 2.17+ x86-64 Details
block2_mpi-0.5.4-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.17+ x86-64 Details
block2_mpi-0.5.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Details
block2_mpi-0.5.4-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details
block2_mpi-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
block2_mpi-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
block2_mpi-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
block2_mpi-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
block2_mpi-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details

Total release size: 1.1 GB

Release files / block2_mpi-0.5.4.tar.gz

Download URL block2_mpi-0.5.4.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
2e4983c356110115f56f0f225e1ff70061044aec14f2fa3db06a05043dd8ef94
BLAKE2b-256 checksum
How to use checksums
bf9b019a48619877fae26ac06fa83a35db9cc86bab054bb09c8eed65a05b8d09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 127.0 MB
Tags CPython 3.15 CPython 3.15 free-threading Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
723fd0777e4f024e71eb2759331ffc9ffad81b514b1e097af50693056dc472c7
BLAKE2b-256 checksum
How to use checksums
7137fc68eb845bc3fd3b67bfb2d6b0ac2de690233a8e19d634c941da41e1e53e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 127.0 MB
Tags CPython 3.15 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c923d6a2d3b60e516b11aad2b403214a6e6923f62baf474ceb8aad101458e413
BLAKE2b-256 checksum
How to use checksums
2285d84834eb0a4d39d769276356577f446c2dce71cb9eb0aaeb163bce381ad1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 127.0 MB
Tags CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
07d52db253a9390d49955e9d0367f8aa84539b11439161e9687a86bb12922761
BLAKE2b-256 checksum
How to use checksums
18a553d5ec8d375d937d8d9c7762d763f456b48959e4b33431380b0a8cca1b68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 127.0 MB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
15b2e8173aff4d1c07183aab23d416ad5ee651eef6299e079119e43690bcac02
BLAKE2b-256 checksum
How to use checksums
39c0170d218dabb54809bd3236074f362b0d117d51d402e9364e769b57c636c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 127.0 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
874f7cb66839074c242f2c3e2f09e2160d5defb50318c6b0929af194128eaf09
BLAKE2b-256 checksum
How to use checksums
5a59ed69f98618e6c8f6e058dd34f6ec98513643acb1ee4efc74b3c3af2b52f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 127.0 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
74d66b9a7247474ef8a08eb8935364436b5d80d0c4ed132cbda67d41bc4e8f62
BLAKE2b-256 checksum
How to use checksums
b93e6f76bfdf4bce05aa790b232e6219ee98785744a87fecaeea624b3171dc69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 126.9 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
fe3e32677a024f7f12605ec1e345a478aabe9fc551b5c727119d7fc810a25909
BLAKE2b-256 checksum
How to use checksums
a162d2407a8b405fa778f08c02e3a3f968c96a2c2667faaedfaf543b0f2daa56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 126.9 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e9a055dcca9ee3f6769fc25ca9b8c3d3f512bd65d4aa4cad8540fc8a0be8c168
BLAKE2b-256 checksum
How to use checksums
db4aeb6e667844883c793ea5b9fffab0a47e530b8d809b066634583277f9a50b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / block2_mpi-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL block2_mpi-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 126.9 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
6e464a455c4c71b19192274c763e07b0419bb2e015c60bb0fff02e158aaba10b
BLAKE2b-256 checksum
How to use checksums
d109f129f204f8bd060d67980dc3fb45b280bbf2152c4903882945339213851d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.5.4 This release

10 release files

0.5.3

8 release files

0.5.2

6 release files

0.5.1

5 release files

0.5.0

4 release files

0.4.13

4 release files

0.4.9

4 release files

0.4.8

4 release files

0.4.6

4 release files

0.4.5

4 release files

0.4.2

4 release files

0.4.1

4 release files

0.4.0

4 release files

0.3.0

4 release files

0.2.0

4 release files

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page