This article summarizes recent updates to the p † q package, which is a C++ accelerated Python library for generating equations and computer code corresponding to singly referenced many-body quantum chemistry methods such as coupled-cluster (CC) and equation-of-motion (EOM) CC theory. Since 2021, the functionality in p † q has expanded to include boson operators, coupled fermion-boson operators, unitary cluster operators, non-particle-conserving EOM operators, spin tracing, multiple single-particle subspaces, and more. Additional developments allow for the generation of C++ and Python code that minimizes floating-point operations via contraction order optimization, subexpression elimination, and the fusion of similar terms.
This article summarizes recent updates to the p † q package, which is a C++ accelerated Python library for generating equations and computer code corresponding to singly referenced many-body quantum chemistry methods such as coupled-cluster (CC) and equation-of-motion (EOM) CC theory. Since 2021, the functionality in p † q has expanded to include boson operators, coupled fermion-boson operators, unitary cluster operators, non-particle-conserving EOM operators, spin tracing, multiple single-particle subspaces, and more. Additional developments allow for the generation of C++ and Python code that minimizes floating-point operations via contraction order optimization, subexpression elimination, and the fusion of similar terms.
Automated Quantum Chemistry Code Generation with the p†q Package
This article summarizes recent updates to the p†q package, which is a C++ accelerated Python library for generating equations and computer code corresponding to singly-reference many-body quantum chemistry methods such as coupled-cluster (CC) and equation-of-motion (EOM) CC theory. Since 2021, the functionality in \pq has expanded to include boson operators, coupled fermion-boson operators, unitary cluster operators, non-particle-conserving EOM operators, spin tracing, multiple single-particle subspaces, and more. Additional developments allow for the generation of C++ and Python code that minimizes floating-point operations via contraction order optimization, sub-expression elimination, and the fusion of similar terms.
PyCC is a Python-based quantum chemistry package that emphasizes coupled cluster and related methods. Developed over the last five years, PyCC's purpose is to provide a clear reference implementation that will serve as a validation suite for production code, a platform for rapid prototyping and testing of new methods, and an educational resource for newcomers to the field. The package covers both closed- and open-shell single-determinant references in spatial- and spin-orbital formulations for the coupled cluster hierarchy through triples-including methods such as CC3, as well as for MP2 and CI methods. PyCC provides a broad range of molecular properties such as analytic first and second energy derivatives including gradients, Hessians, polarizabilities and atomic polar tensors, as well as non-energy-derivative properties, such as velocity-gauge atomic polar tensors and diagonal Born-Oppenheimer corrections, plus dynamic linear response functions, and excitation energies. The package includes a number of unique capabilities, such as real-time CC propagation (up through CC3), atomic axial tensors for simulating vibrational circular dichroism spectra at the MP2 and CI levels, and local correlation methods including perturbation-aware correlation domains. The code is designed around a shared Wavefunction base and a method-agnostic derivative layer that enables a new method to inherit the full property set once it supplies its reduced densities and their first-order responses. PyCC is fully open source and available on GitHub under the BSD 3-clause license.
p†q is a C++ accelerated Python library designed to generate equations for many-body quantum chemistry methods and to realise proof-of-concept implementations of these equations for rapid prototyping. Central to this library is a simple interface to define strings of second-quantised creation and annihilation operators and to bring these strings to normal order with respect to either the true vacuum state or the Fermi vacuum. Tensor contractions over fully-contracted strings can then be evaluated using standard Python functions (e.g. NumPy's einsum). Given one- and two-electron integrals, these features allow for the rapid implementation and assessment of a wide array of many-body quantum chemistry methods.
Psi4NumPy demonstrates the use of efficient computational kernels from the open-source Psi4 program through the popular NumPy library for linear algebra in Python to facilitate the rapid development of clear, understandable Python computer code for new quantum chemical methods, while maintaining a relatively low execution time. Using these tools, reference implementations have been created for a number of methods, including self-consistent field (SCF), SCF response, many-body perturbation theory, coupled-cluster theory, configuration interaction, and symmetry-adapted perturbation theory. Furthermore, several reference codes have been integrated into Jupyter notebooks, allowing background, underlying theory, and formula information to be associated with the implementation. Psi4NumPy tools and associated reference implementations can lower the barrier for future development of quantum chemistry methods. These implementations also demonstrate the power of the hybrid C++/Python programming approach employed by the Psi4 program.
While the many-body expansion (MBE) and counterpoise treatments are commonly used to mitigate the high scaling of accurate ab initio methods, researchers may need to piece together tools and scripts if their primary chosen software does not support targeted features. To further modular software in quantum chemistry, the arbitrary-order, multiple-model-chemistry, counterpoise-enabled MBE implementation from Psi4 has been extracted into an independent, lightweight, and open-source Python module, QCManyBody, with new schema underpinning, application programming interface, and software integrations. The package caters to direct users by facilitating single-point and geometry optimization MBE calculations backed by popular quantum chemistry codes through the QCEngine runner and by defining a schema for requesting and reporting many-body computations. It also serves developers and integrators by providing minimal, composable, and extensible interfaces. The design and flexibility of QCManyBody are demonstrated via integrations with geomeTRIC, OptKing, Psi4, QCEngine, and the QCArchive project.
This thesis deals with selected aspects of a new implementation of many-body methods which can be formulated in the framework of second quantization, in particular the coupled-cluster (CC) method with arbitrary excitation level. Coupled-cluster is one of the most successful and widely used quantum chemical methods for accurate calculations on small to medium-sized molecules. Since it employs a nonlinear parametrization of the wave function, its implementation is rather difficult, in particular if higher (i.e. more than double) excitations are to be included. The latter is necessary to obtain highly accurate results and also as a prerequisite for the generalization to multi-reference cases. The implementation described here has a twofold focus. One is on generality and flexibility regarding the method to be implemented, the other is on efficiency. To achieve flexibility, it is useful to have a machinery which automatically derives working equations for a given method. We realize this by applying techniques of second quantization. This work treats in particular the last step of this procedure, namely the simplification of the resulting equations by the identification of equivalent terms. The algorithm used here is based on the interpretation of algebraic terms as graphs. The derived CC equations then have to be solved iteratively. The efficiency of the program is mainly determined by the evaluation of the occurring expressions, which has to be done in each iteration step. The evaluation is split up in a sequence of tensor contractions. Their generic implementation is complicated by the particular structure of the involved tensors. We reduce each contraction to a sequence of matrix multiplications, which requires a previous data rearranging. But since matrix multiplication is the most efficient operation on modern computers, this additional effort pays off. Preliminary tests show that our program is at least as fast as the most efficient general coupled-cluster implementation so far, and the relation is expected to improve for calculations with larger basis sets where the matrix multiplication becomes the time-determining step. Finally, we give an outlook to possible further developments. In particular, the preparation of the equations before the actual evaluation (factorization) offers much potential for optimizations which we do not exploit at the moment, in contrast to the program with which we compare, which employs at least a partial optimization at this point.