LibRPA is a library for efficient and accurate first-principles calculations based on many-body perturbation theory with numerical atomic orbitals (NAOs). It currently supports random-phase approximation (RPA) correlation-energy calculations and one-shot GW quasiparticle calculations for periodic systems.
By leveraging the localized resolution-of-identity (LRI) technique, LibRPA achieves low-scaling algorithms suitable for large-scale systems. It is implemented in C++ with MPI/OpenMP parallelism, provides C and Fortran interfaces, and can be integrated with density functional theory (DFT) codes through both file-based and API-based workflows.
Note
LibRPA is under active development, and its input/output interfaces are prone to change.
- RPA correlation-energy calculations and one-shot GW quasiparticle calculations
- Low-scaling algorithms based on the localized resolution-of-identity (LRI) technique
- Hybrid MPI/OpenMP parallelism
- Driver-based and API-based interfaces for integration with external DFT codes
LibRPA requires:
- a C++17 compiler with
std::filesystemsupport and a Fortran compiler - compatible MPI and OpenMP development libraries
- BLAS, LAPACK and ScaLAPACK libraries
- CMake 3.18 or newer, and a supported build tool
- Git or
patchfor source preparation when patches are needed
CMake prepares pinned source dependencies from the manifest. The default build uses GreenX for minimax grids and LibRI, LibComm and cereal for RI tensor contractions. GW and EXX require LibRI. CUDA and HIP builds also use LibDDLA. ELPA is optional. Compatible external dependencies can be supplied.
Dependency source trees are downloaded during configuration and are not included in the repository. A first build needs network access or a prepared cache. See Installation for external dependencies, offline builds and dependency configuration.
Clone the repository:
git clone https://github.com/AESM-Group/LibRPA
cd LibRPAAfter initializing your compiler, MPI and math-library environment, configure, build and install with:
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DLIBRPA_ENABLE_TEST=OFF \
-DCMAKE_INSTALL_PREFIX="$HOME/opt/librpa"
cmake --build build --parallel 2
cmake --build build --target installThis example selects a shared library and disables test targets. The standalone
default is a static library with tests enabled. Add compiler and library paths
as shown in Installation, or adapt a script under
examples/build. See Compile Options
for defaults and dependency selection.
To download and verify dependency archives on a connected machine:
cmake -DLIBRPA_THIRDPARTY_ARCHIVE_DIR="$HOME/Downloads" \
-P cmake/LibRPADownloadThirdparty.cmakeUpload the downloaded archives to LibRPA/thirdparty/downloads/ on the build
machine, then configure with -DLIBRPA_THIRDPARTY_DOWNLOAD=OFF. For a different
archive location on that machine, also set LIBRPA_THIRDPARTY_ARCHIVE_DIR.
CMake prepares the sources in each checkout's thirdparty/src/. See the
installation guide for examples and component selection.
LibRPA supports two main workflows:
- Driver-based workflow: LibRPA reads data generated by an external DFT code and performs post-processing calculations such as RPA or GW
- API-based workflow: LibRPA is called directly from within the host code through its C, C++, or Fortran interfaces
For the driver workflow, runtime parameters are read from librpa.in, for example:
task = g0w0_band
input_dir = dataset/
nfreq = 16
parallel_routing = libri
More details can be found in the documentation for driver usage and API usage
See the documentation for installation instructions, user guides, theory, examples, and tutorials.
If you use LibRPA in your work, please consider citing the relevant papers that enable the relevant feature. Please consult the How to Cite page for more details.
LibRPA is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0).
LibRPA uses the following third-party components as selected by the build configuration. It can reuse supplied dependencies or cached sources, and download or build components when necessary. These components retain their own licenses:
- greenX (
c90d131): Apache-2.0 - cereal (
d81e2f7): BSD-3-Clause - LibRI (
ab81ac9): LGPL-3.0 - LibComm (
12457e7): LGPL-3.0 - LibDDLA (
0d576d4): LGPL-3.0 - ELPA (2026.02.001): LGPL-3.0