Litcius/Paper detail

PyBEST: Improved functionality and enhanced performance

Katharina Bogusławski, Filip Brzęk, Rahul Chakraborty, Kacper Cieślak, Seyedehdelaram Jahani, Aleksandra Leszczyk, Artur Nowak, Emil Sujkowski, Julian Świerczyński, Somayeh Ahmadkhani, Dariusz Kędziera, Maximilian H. Kriebel, Piotr S. Żuchowski, Paweł Tecmer

2023Computer Physics Communications26 citationsDOIOpen Access PDF

Abstract

We present a methodological update to the Pythonic Black-box Electronic Structure Tool (PyBEST), a fully-fledged modern electronic structure software package. Among other things, these include the extensions to pair Coupled Cluster Doubles (pCCD) open-shell electronic structures via the ionization potential and double ionization potential equation of motion formalism (IP-EOM-pCCD and DIP-EOM-pCCD), tailored Coupled Cluster methods, EOM extensions on top of the linearized Coupled Cluster correction on top of pCCD, the configuration interaction correction on top of pCCD, and the static pCCD-in-DFT embedding. Furthermore, we have increased the performance of PyBEST by optimizing its underlying tensor contraction engine and providing GPU support via the CuPy library. Program Title: PyBEST: Pythonic Black-box Electronic Structure Tool CPC Library link to program files: https://doi.org/10.17632/xf9kb7yfwr.2 Developer's repository link: https://pypi.org/project/pybest/ and https://zenodo.org/records/10069179 Licensing provisions: GPLv3 Programming language: Python3.9–Python3.12, C++ Journal reference of previous version: Computer Physics Communication 264 (2021) 107933. Does the new version supersede the previous version?: Yes Reasons for the new version: The new version includes significant speedup and memory optimizations. We provide an interface to CUDA GPU via the Python CuPy library. New methodological features are the ionization potential/double ionization potential equation of motion pair coupled cluster doubles (IP/DIP-EOM-pCCD), configuration interaction on top of pCCD (pCCD-CI), tailored CC methods including DMRG-tCC, density matrices from LCC(S)D and pCCD-LCC(S)D, a static WFT-in-DFT embedding and an external charge module. We also introduced support for frozen core orbitals in correlated methods, dumping orbitals in the cube format, printing of Hartree–Fock (HF) orbital energies, the one-dimensional contact potential model Hamiltonian, and wrappers to calculate properties such as dipole and quadrupole moments. To do that, we redesigned and optimized the class structure of several PyBEST's core sub-packages, such as the linear algebra, geminals, and occupation model classes. Summary of revisions: GPU support (via the CuPy library [1]) for selected contractions in PyBEST's [2] tensor contraction engine [3]. It allows us to obtain a significant speedup (up to a factor of 15) for bottleneck contractions in standard coupled cluster and post-pCCD [4] implementations in PyBEST using the Cholesky linear algebra factory. Overall, a speedup of approximately a factor 4 is achieved [3]. We provide a batch-wise algorithm, which alleviates the limitations of a single Video Memory (VRAM) and enables large-scale quantum chemical calculation even on one GPU card [3]. Several new quantum chemistry methods have been implemented in PyBEST. These include: EOM-LCCD and EOM-LCCSD methods with an RHF/pCCD [5–9] reference function for the calculation of electronic excitation energies [10–12]. The implementation allows for targeting singlet-singlet excitation energies, including doubly excited states. IP-EOM-pCCD and DIP-EOM-pCCD methods [13] that allow us to compute open-shell electronic structures on top of a pCCD reference function. Our implementation supports singlet, doublet, triplet, quartet, and quintet spin states. The user can choose between a low-spin and different high-spin versions of these methods. A CI-based dynamic energy correction on top of RHF and pCCD: pCCD-CID and pCCD-CISD only support a spin-free implementation, while for CIS, CID, and CISD, the user can choose between the Slater Determinant (SD) and Configuration State Function (CSF) implementations. We feature various Davidson-type corrections on top of a CI wave function [14]. tailored CC-based methods [15] that use a pCCD wave function as the fixed reference function (so-called frozen-pair coupled cluster methods [16,15]) or the external amplitudes are provided from different wave function ansätze, e.g., from an MPS representation or any external file. Density matrices from LCC(S)D and pCCD-LCC(S)D methods [17]. These are used to determine orbital entanglement and correlation measures [18–21, 17] and other method-dependent properties. Wrappers for calculating nuclear and total dipole and quadrupole moments using integrals provided in the Libint library. A static embedding module, where all wave-function-based methods provided in PyBEST can be embedded in the potential generated from external software [22]. Introduction of a universal and more general way to define core orbitals in post-HF calculations. New Hamiltonians: Support for 1-D contact interactions (Hˆii′=Tˆii′+Vˆii′) in an arbitrary external potential (Vˆii′=δii′V(xi)) [23]. Tˆii′ represents the 1-D kinetic energy, and xi=iΔx is a grid point, where i can take values of 0,±1,±2,…. Thus, this choice of the Hamiltonian leads to a uniform grid in the coordinates. It corresponds to using a Fourier basis set. Augmentation of the quantum chemical Hamiltonian with external point charges [22]. The following one-electron integrals have been added: integrals for the interaction of point charges and electrons integrals for the interaction between point charges and nucleiHˆ=Hˆel+∑i∫ρel(r)qidr+∑i∫ρnuc(r)qidr, where Hˆel is the electronic Hamiltonian of the molecular system, qi is the i-th external point charge, ρel and ρnuc denote electronic and nuclear densities of the molecular structure under consideration. the point charge counterpart of pVp integrals. For the relativistic Douglas–Kroll–Hess Hamiltonian in PyBEST, the picture-change error correction is also provided [24]. Code optimization: Replacement of slicing and C++-based routines with numpy.tensordot, numpy.einsum, and opt_einsum, which leads, for instance, to a speedup of about a factor of 50 when constructing the Fock matrix. Reduced memory requirements in post-pCCD calculations. We allow for dumping effective Hamiltonian objects in all CC sub-packages to disk if the intermediates are larger than o2v2 to reduce RAM consumption in large-scale calculations [25], where o is the number of occupied orbitals and v the number of virtual orbitals with respect to some reference determinant. New flavors of the 4-index transformation based on opt_einsum and a naive einsum implementation [26] and replacement of former slicing operations. Memory-optimized Cholesky routines throughout the codebase, which reduce the memory peak even by a factor of 2. New select features for PyBEST's contract function in its tensor contraction engine. It defaults to CuPy for specific bottleneck operations. Code restructuring: A more optimal structure for the linear algebra sub-package that avoids circular imports. All .h5 format interactions are now done purely with h5py. Support for dumping the occupation model instance to a .h5 file. Rewrite of occupation model class to support future updates and extensions (automatic definition of frozen core orbitals and the possibility to introduce an active orbital space). A new structure of the geminal module to allow for future support of other geminal models. Change of the contraction order for tensor contractions (cupy → tensordot → einsum/opt_einsum: Download : Download high-res image (100KB)Download : Download full-size image Nature of problem: The idea behind the PyBEST software package is the efficient and reliable modeling of electronic structures and properties of small and large-scale quantum systems at the interface between chemistry and physics using geminal-based, and specifically pCCD-based, methods. Such models represent an efficient and compact representation of the wave function. The aim of PyBEST is focused on reliable predictions of organic electronic materials [27,25] and actinide-containing complexes and their properties [28–30]. Solution method: The modular design and general tensor contraction engine implementation in PyBEST allows for a convenient and prompt code acceleration by drop-in-replacements of modern Python-based packages. Combined with a series of unconventional (and conventional) electronic structure models based on the pCCD ansatz to solve the electronic Schrödinger equation, PyBEST represents a modern alternative to the existing quantum chemistry and physics software packages. With PyBEST, we cannot only model ground- and exited-state properties but also provide a better understanding of orbital interaction through orbital-based quantum-information measures. Additional comments including restrictions and unusual features: PyBEST features unique electronic structure methods based on orbital-optimized pCCD and their interpretation in terms of orbital entanglement and correlation that are not available in any other software package. While pCCD-based methods are limited to closed-shell systems, open-shell configurations can be accessed via the IP/DIP-EOM extensions. R. Okuta, Y. Unno, D. Nishino, S. Hido, C. Loomis, Cupy: A numpy-compatible library for nvidia gpu calculations, in: 31st Conference on Neural Information Processing Systems (NIPS 2017), Long Beach, CA, 2017, pp. 55–62. K. Boguslawski, A. Leszczyk, A. Nowak, F. Brzęk, P.S. Żuchowski, D. Kędziera, P. Tecmer, Pythonic black-box electronic structure tool (PyBEST), an open-source python platform for electronic structure calculations at the interface between chemistry and physics, Comput. Phys. Commun. 264 (2021) 107933. M.H. Kriebel, P. Tecmer, M. Gałyńska, A. Leszczyk, B. Katharina, Accelerating Pythonic coupled cluster implementations: a comparison between CPUs and GPUs, J. Chem. Theory Comput. (2023), submitted for publication, arXiv:2310.04559. K. Boguslawski, P.W. Ayers, Linearized coupled cluster correction on the antisymmetric product of 1-reference orbital geminals, J. Chem. Theory Comput. 11 (2015) 5252–5261. P.A. Limacher, P.W. Ayers, P.A. Johnson, S. De Baerdemacker, D. Van Neck, P. Bultinck, A new mean-field method suitable for strongly correlated electrons: computationally facile antisymmetric products of nonorthogonal geminals, J. Chem. Theory Comput. 9 (2013) 1394–1401. K. Boguslawski, P. Tecmer, P.W. Ayers, P. Bultinck, S. De Baerdemacker, D. Van Neck, Efficient description of strongly correlated electrons, Phys. Rev. B 89 (2014) 201106(R). K. Boguslawski, P. Tecmer, P.W. Ayers, P. Bultinck, S. De Baerdemacker, D. Van Neck, Non-variational orbital optimization techniques for the AP1roG wave function, J. Chem. Theory Comput. 10 (2014) 4873–4882. P.A. Limacher, T.D. Kim, P.W. Ayers, P.A. Johnson, S. De Baerdemacker, D. Van Neck, P. Bultinck, The influence of orbital rotation on the energy of closed-shell wavefunctions, Mol. Phys. 112 (2014) 853–862. T. Stein, T.M. Henderson, G.E. Scuseria, Seniority zero pair coupled cluster doubles theory, J. Chem. Phys. 140 (21) (2014) 214113. K. Boguslawski, Targeting excited states in all-trans polyenes with electron-pair states, J. Chem. Phys. 145 (2016) 234105. K. Boguslawski, Erratum: “Targeting excited states in all-trans polyenes with electron-pair states”, J. Chem. Phys. 147 (13) (2017) 139901. K. Boguslawski, Targeting doubly excited states with equation of motion coupled cluster theory restricted to double excitations, J. Chem. Theory Comput. 15 (1) (2019) 18–24. K. Boguslawski, Open-shell extensions to closed-shell pccd, Chem. Commun. 57 (2021) 12277–12280. A. Nowak, K. Boguslawski, A configuration interaction correction on top of pair coupled cluster doubles, Phys. Chem. Chem. Phys. 25 (10) (2023) 7289–7301. A. Leszczyk, M. Máté, Ö. Legeza, K. Boguslawski, Assessing the accuracy of tailored coupled cluster methods corrected by electronic wave functions of polynomial cost, J. Chem. Theory Comput. 18 (1) (2022) 96–117. T.M. Henderson, I.W. Bulik, T. Stein, G.E. Scuseria, Seniority-based coupled cluster theory, J. Chem. Phys. 141 (24) (2014) 244104. A. Nowak, O. Legeza, K. Boguslawski, Orbital entanglement and correlation from pccd-tailored coupled cluster wave functions, J. Chem. Phys. 154 (8) (2021) 084111. J. Rissler, R.M. Noack, S.R. White, Measuring orbital interaction using quantum information theory, Chem. Phys. 323 (2006) 519–531. K. Boguslawski, P. Tecmer, Orbital entanglement in quantum chemistry, Int. J. Quant. Chem. 115 (19) (2015) 1289–1295. K. Boguslawski, P. Tecmer, Erratum: “Orbital entanglement in quantum chemistry”, Int. J. Quant. Chem. 117 (24) (2017) e25455. K. Boguslawski, P. Tecmer, Ö. Legeza, Analysis of two-orbital correlations in wavefunctions restricted to electron-pair states, Phys. Rev. B 94 (2016) 155126. R. Chakraborty, K. Boguslawski, P. Tecmer, Static embedding with pair coupled cluster doubles based methods, Phys. Chem. Chem. Phys. 25 (2023) 25377–25388. D.T. Colbert, W.H. Miller, A novel discrete variable representation for quantum mechanical reactive scattering via the s-matrix Kohn method, J. Chem. Phys. 96 (3) (1992) 1982–1991. V. Kellö, A.J. Sadlej, Picture change and calculations of expectation values in approximate relativistic theories, Int. J. Quant. Chem. 68 (1998) 159–174. S. Jahani, K. Boguslawski, P. Tecmer, The relationship between structure and excited-state properties in polyanilines from geminal-based methods, RSC Adv. 13 (40) (2023) 27898–27911. D.G.A. Smith, J. Gray, opt_einsum - a python package for optimizing contraction order for einsum-like expressions, J. Open Sour. Softw. 3 (26) (2018) 753. P. Tecmer, M. Gałyńska, L. Szczuczko, K. Boguslawski, Geminal-based strategies for modeling large building blocks of organic electronic materials, J. Phys. Chem. Lett. 14 (2023) 9909–9917. P. Tecmer, K. Boguslawski, P.W. Ayers, Singlet ground state actinide chemistry with geminals, Phys. Chem. Chem. Phys. 17 (2015) 14427–14436. A. Nowak, P. Tecmer, K. Boguslawski, Assessing the accuracy of simplified coupled cluster methods for electronic excited states in f0 actinide compounds, Phys. Chem. Chem. Phys. 21 (35) (2019) 19039–19053. A. Leszczyk, T. Dome, P. Tecmer, D. Kedziera, K. Boguslawski, Resolving the π-assisted u–n σ f-bond formation using quantum information theory, Phys. Chem. Chem. Phys. 24 (35) (2022) 21296–21307.

Topics & Concepts

Coupled clusterComputer scienceSpeedupElectronic structureIonizationPhysicsComputational scienceParallel computingQuantum mechanicsIonMoleculeMachine Learning in Materials ScienceInorganic Fluorides and Related CompoundsPhysics of Superconductivity and Magnetism