Abstract
We present INQ, a new implementation of density functional theory (DFT) and time-dependent DFT (TDDFT) written from scratch to work on graphical processing units (GPUs). Besides GPU support, INQ makes use of modern code design features and takes advantage of newly available hardware. By designing the code around algorithms, rather than against specific implementations and numerical libraries, we aim to provide a concise and modular code. The result is a fairly complete DFT/TDDFT implementation in roughly 12,000 lines of open-source C++ code representing a modular platform for community-driven application development on emerging high-performance computing architectures for the simulation of materials.
Introduction
Density Functional Theory (DFT) is a cornerstone of modern materials science, yet much of the software used to perform these calculations dates back decades. These legacy codes were designed for superscalar CPU architectures and often feature monolithic structures exceeding hundreds of thousands of lines. This complexity makes porting to modern Graphics Processing Units (GPUs)—which offer superior numerical throughput but require explicit memory management—a significant challenge.
Furthermore, the integration of simulation tools into automated machine learning and data science pipelines is often hindered by brittle "input file" interfaces. INQ addresses these challenges by reimagining DFT software as a GPU-native, modular C++ library designed for the exascale era.
The INQ Paradigm: Input as Code
A fundamental shift in INQ is the "Input is Code" paradigm. Unlike traditional software that parses arbitrary text files, INQ is a library. A simulation "input" is a small C++ program that links against the INQ framework. This allows users to leverage the full power of C++ for complex logic, direct integration with external data sources, and high-throughput automation.
To handle the complexities of GPU programming, INQ introduces a gpu::run abstraction using C++ lambdas. This allows developers to write parallel kernels that maintain the readability of standard CPU loops while executing efficiently on the device. The framework adopts a "GPU-first" philosophy, utilizing CUDA managed memory but ensuring data remains on the device to minimize costly CPU-GPU transfers.
Software Engineering and Modularity
By delegating specialized tasks to high-quality external components, INQ maintains a remarkably concise codebase of approximately 12,000 lines. Key modules include MULTI (a multidimensional array library), B-MPI3 (a C++ wrapper for MPI), and PSEUDOPOD (a pseudopotential parser).
This modularity not only improves maintainability but also facilitates high reliability. The project maintains 95% test coverage through continuous integration, ensuring numerical consistency across different hardware architectures. A notable example of this efficiency was the adoption of the libxc library, which allowed the developers to offload complex functional calculations and significantly reduce the core code volume.
Validation and Performance
The framework has been rigorously validated against established codes such as Quantum Espresso, Octopus, and SIESTA.
- Ground State Accuracy: Total energy calculations for the $N_2$ molecule and bulk Silicon were within 0.3 mHartree/atom of reference values.
- Dynamic Response: Time-Dependent DFT (TDDFT) simulations of the optical response of water ($H_2O$) showed excellent agreement with the Octopus code in both dipole evolution and absorption spectra.
- Scientific Application: INQ successfully reproduced electronic stopping power curves for protons in Aluminum, demonstrating its capability for production-grade research on high-performance computing systems.
Conclusion and Future Directions
While INQ provides a robust foundation for GPU-accelerated DFT, development continues in several key areas. Current priorities include integrating the SLATE library for parallel linear algebra, adding symmetry handling via spglib, and implementing exact exchange functionals. While currently optimized for NVIDIA hardware, the framework's modular design ensures a clear path toward supporting AMD and Intel GPU architectures, positioning INQ as a versatile tool for the future of computational materials science.
Summary updated