Source-linked AI summary
TRIQS: A Toolbox for Research on Interacting Quantum Systems
Olivier Parcollet, Michel Ferrero, Thomas Ayral, Hartmut Hafermann, Igor Krivenko, Laura Messio, Priyanka Seth
TL;DR
Many-body algorithms require implementations that balance complexity, adaptability, performance, and reproducibility. TRIQS provides reusable C++/Python abstractions and tools for quantum many-body applications, illustrated through DMFT and Green’s-function workflows. Applications have been built on the library, while the described release has C++11, Python 2.7, and experimental wrapping constraints.
Problem
Many-body implementations face increasing complexity, rapid algorithmic change, demanding performance requirements, and reproducibility needs.
Method
TRIQS provides a GPLv3 C++/Python library with reusable building blocks, Green’s-function tools, determinant manipulations, and C++/Python wrapping.
Results
Several applications have been built on TRIQS, including applications distributed with the project.
Takeaways & Limitations
TRIQS supports rapid development of quantum many-body applications across Python, C++, and mixed-language workflows.
Abstract
from arXiv · showhide
We present the TRIQS library, a Toolbox for Research on Interacting Quantum Systems. It is an open-source, computational physics library providing a framework for the quick development of applications in the field of many-body quantum physics, and in particular, strongly-correlated electronic systems. It supplies components to develop codes in a modern, concise and efficient way: e.g. Green's function containers, a generic Monte Carlo class, and simple interfaces to HDF5. TRIQS is a C++/Python library that can be used from either language. It is distributed under the GNU General Public License (GPLv3). State-of-the-art applications based on the library, such as modern quantum many-body solvers and interfaces between density-functional-theory codes and dynamical mean-field theory (DMFT) codes are distributed along with it.
PROGRAM SUMMARY
TRIQS is an open-source C++/Python framework for rapidly developing readable, efficient applications in many-body quantum physics, especially strongly correlated systems. It addresses implementation complexity, changing algorithms, performance demands, and reproducibility through reusable high-level components.
- TRIQS 1.2 is a GPLv3 free-software library written in C++ and Python for quantum many-body algorithms.
- The project provides reusable C++ and Python building blocks for applications spanning interactive analysis, quantum impurity solvers, and DMFT-related computations.
- Applications including the cthyb impurity solver and DFT tools interface have been built on TRIQS and distributed separately under the GPL license.
- Motivations: Modern many-body implementations face increasing complexity, rapid algorithmic change, demanding resource requirements, and reproducibility needs.
- Motivations: TRIQS addresses these challenges with readable, simple implementations and reusable high-level abstractions while retaining high performance through modern programming techniques.
- Structure: The core library supports applications written in pure Python, C++ with Python interfaces, or pure C++, with C++ providing performance and Python supporting analysis and reproducibility.
4. Citation policy
The paper requests citation of TRIQS for direct or indirect use and describes usage ranging from interactive Python analysis to high-performance C++ development. Its interfaces support concise manipulation and storage of Green’s functions.
- Users are asked to cite TRIQS when using the library directly or through TRIQS-based applications.
- TRIQS supports users from basic Python interaction through mixed Python/C++ high-performance and massively parallel code development.
- Green’s functions expose one-line operations for assignment, inversion, and HDF5 input and output through Python.
- Modern C++ features and functional-style constructions reduce syntax and minimize the knowledge required for efficient library use.
6. Portability
TRIQS uses modern C++ and HDF5 to support portable scientific computation, but the described release requires C++11 and uses Python 2.7.
- TRIQS is written in C++11, requiring a C++11-compliant compiler; C++14 is recommended for development when available.
- The described release uses Python 2.7, with Python 3 support planned for later releases.
- HDF5 is used to provide portability for user-generated binary data.
7. TRIQS in two examples
TRIQS illustrates its framework through a Python DMFT computation and C++ Green’s-function manipulation. These examples show flexible workflows, concise equation implementation, automatic numerical handling, and portable HDF5 storage.
- 7. TRIQS in two examples: The examples cover a complete DMFT computation in Python and Green’s-function manipulation in C++.
- 7.1. A DMFT computation in one page of IPython: A DMFT notebook loads a solver, sets parameters and an initial Green’s-function guess, and iterates the self-consistency loop from Python.
- 7.1. A DMFT computation in one page of IPython: The Python workflow supports changing random-number generators, adding measurements, interactive plotting, saved parameters, and parallel execution with notebook-based analysis.
- 7.1. A DMFT computation in one page of IPython: The DMFT example can switch from the CT-INT solver to a CT-HYB solver by loading the appropriate solver module.
- 7.2. Easy manipulation of Green’s functions in C++: For a square lattice, the C++ example computes the local Green’s function by a Brillouin-zone sum and obtains the hybridisation function from it.
- 7.2. Easy manipulation of Green’s functions in C++: CLEF assignment syntax evaluates expressions over Green’s-function meshes concisely, with compiler inlining, no copy, and no measured performance penalty.
- 7.2. Easy manipulation of Green’s functions in C++: Green’s-function containers track high-frequency moments for consistent Fourier transformations and frequency summations, while results can be stored portably through HDF5.
8. Library components
TRIQS combines flexible multidimensional arrays, Green’s-function containers, Monte Carlo infrastructure, determinant manipulation, CLEF expressions, and C++/Python wrapping tools. These components emphasize efficient numerical operations, convenient interfaces, and rapid development, while the notebook C++ feature remains experimental in release 1.2.
- Multidimensional arrays: TRIQS arrays provide flexible, performant multidimensional containers with Python, HDF5, BLAS/LAPACK, iterator, view, and CLEF support.The library includes arrays, matrices, and vectors with regular-type semantics and NumPy conversion.
- Green’s functions: Green’s-function containers represent mesh-defined scalar-, matrix-, tensor-, or block-diagonal-valued functions across several frequency, time, polynomial, and momentum domains.They can store high-frequency moments so Fourier transforms and frequency summations treat asymptotics consistently.
- Monte Carlo tools: TRIQS’s mc_generic class implements generic Metropolis moves and measurements, leaving users to provide the corresponding move and measurement concepts.The move interface uses attempt, accept, and reject operations without requiring inheritance or virtual functions.
- Determinant manipulations: The det_manip class efficiently updates matrices and inverses after insertions or removals, exposing a simple API and using BLAS Level 2 internally.Monte Carlo workflows can first compute a determinant ratio and update the matrix only after move acceptance.
- CLEF: CLEF supplies compile-time lazy expressions and quick assignments, with compiler inlining and automatic memory-traversal optimization for efficient concise code.Its assignment mechanism can be extended to library objects through container-defined triqs_auto_assign functions.
- C++/Python wrapping: The C++/Python wrapping tool generates C wrapping code and build utilities from Python descriptions, enabling direct C++ use inside IPython notebooks.Notebook use is suitable for debugging, quick testing, and short code; in release 1.2 it is experimental and limited to one C++ function per cell.
9. Getting started
TRIQS can be obtained from GitHub and built with CMake after installing its dependencies. Users can run interactive notebooks, command-line scripts, parallel jobs, and tutorial applications.
- TRIQS source code is publicly available on GitHub, where users are also directed to obtain evolving versions and fixes.
- After dependencies are installed, CMake configures, builds, tests, and installs the library through a short command sequence.The documented sequence clones the source, creates a build directory, runs cmake, make, make test, and make install.
- Interactive IPython notebook examples can be opened in a browser, including notebooks launched directly by name.
- External applications such as the CT-INT tutorial are installed separately with CMake and linked to the TRIQS installation directory.The application is installed under the TRIQS installation directory’s applications subdirectory.
- TRIQS also supports command-line execution of the same DMFT loop, including parallel execution with mpirun.The example uses pytriqs dmft_bethe.py and shows a four-process mpirun command.
- Tutorial repositories provide C++ examples, IPython notebooks, and a minimal hello_world skeleton for developing external applications.
10. Contributing
TRIQS is developed as an open-source project that invites community feedback, issue reports, contributions, and coordination with its developers.
- Users should report issues through GitHub and submit contributions using pull requests, coordinating major changes with the main TRIQS developers.
11. Summary
TRIQS provides an open-source computational-physics framework for rapidly developing many-body quantum-physics applications. Multiple applications have already been built on the library and are publicly available.
- TRIQS is an open-source computational-physics library designed to support rapid development of many-body quantum-physics applications.
- Several applications have already been built on TRIQS and are available through GitHub, with descriptions planned in separate publications.
Appendix A. A sample application: Interaction expansion continuous-time quantum Monte Carlo algorithm
The appendix presents a sample interaction-expansion continuous-time quantum Monte Carlo implementation and uses it in the paper’s DMFT IPython example.
- The sample application implements a continuous-time interaction-expansion quantum Monte Carlo algorithm called CT-INT.
- The appendix first recalls the CT-INT formalism and then discusses the code implementation.
- The CT-INT solver is used in the DMFT IPython example shown in Fig. 2.
Appendix A.1. Formalism
The CT-INT formalism expands the partition function in powers of a shifted interaction and represents configuration weights and observables through determinants. Monte Carlo sampling then updates these configurations by vertex insertion and removal while measuring the Green’s function.
- Partition-function expansion: The shifted interaction uses auxiliary-spin indices and parameters αsiσ, with a choice that can eliminate the sign problem in the half-filled single-band Anderson model.Summing over auxiliary-spin indices also makes the formulation more symmetric and removes explicit α dependence from the non-interacting Green’s function.
- Partition-function expansion: The CT-INT algorithm expands the partition function Z in powers of the interaction term Hint.The expansion introduces time-ordered products of shifted density operators.
- Determinant representation: Wick’s theorem converts the averages generated by the expansion into determinants built from Green’s-function matrix elements.The determinants explicitly define the contributions associated with each Monte Carlo configuration.
- Monte Carlo sampling: A Monte Carlo configuration is a set of imaginary times and auxiliary spins, and its weight is defined from the determinant product for the two spin sectors.The configuration weight includes the perturbation-order factor and determinant contribution.
- Monte Carlo sampling: Metropolis updates sample the partition function through vertex insertions and removals, with separate acceptance rates for the two moves.The configuration changes are evaluated using determinant ratios.
- Observables: The Green’s function is obtained from configuration-dependent determinant quantities after functional differentiation and Fourier transformation.The measurement procedure separates the Monte Carlo weight from the quantity accumulated during sampling.
Appendix A.2. Implementation
The implementation organizes a complete parallelized CT-INT solver from reusable TRIQS components. C++ classes define Green’s functions, determinant-based configurations, Monte Carlo moves, and measurements, while generated wrappers expose the solver to Python.
- Solver organization: The complete weak-coupling CTQMC implementation uses TRIQS components and is presented as a parallelized code of about 200 lines with a Python interface.The implementation uses gf, mc_tools, det_manip, and CLEF, and is demonstrated in a DMFT example.
- Solver organization: The solver header defines block Green’s functions, observables, simulation parameters, accessors, and the solve method controlling the quantum Monte Carlo run.The public interface includes β, frequency and time-grid sizes, interaction parameters, cycle counts, warmup cycles, and runtime limits.
- Configurations and moves: Configurations are represented by determinant objects containing imaginary-time and auxiliary-spin vertices, with matrix elements generated from a non-interacting Green’s-function object.The configuration is therefore determined by the vertex set and the associated determinant matrices.
- Configurations and moves: Monte Carlo moves model insertion and removal operations through attempt, accept, and reject methods used by the generic Monte Carlo class.The insertion move samples a random imaginary time and auxiliary spin and evaluates determinant ratios for its acceptance probability.
- Measurements: Measurements accumulate the M-matrix and sign during the Monte Carlo chain, then combine results across processes through MPI reduction.The measurement implementation is described as a transcription of the formal Green’s-function expression.
- Measurements: The main solver constructs the Fourier-transformed non-interacting Green’s function, registers moves and measurements, and runs the Monte Carlo simulation.The solver class stores frequency- and imaginary-time Green’s-function objects used throughout the calculation.
- Python interface: A Python descriptor automatically generates wrapping code so the C++ ctint_solver can be controlled from Python.The descriptor imports TRIQS modules, adds required includes, and declares the Python-facing solver class.