Abstract
Machine learning potentials (MLP) allow to perform large-scale molecular dynamics simulations with about the same accuracy as electronic structure calculations provided that the selected model is able to capture the relevant physics of the system. For systems exhibiting long-range charge transfer, fourth-generation MLPs need to be used, which take global information about the system and electrostatic interactions into account. This can be achieved in a charge equilibration (QEq) step, but the direct solution (dQEq) of the set of linear equations results in an unfavorable cubic scaling with system size making this step computationally demanding for large systems. In this work, we propose an alternative approach that is based on the iterative solution of the charge equilibration problem (iQEq) to determine the atomic partial charges. We have implemented the iQEq method, which scales quadratically with system size, in the parallel molecular dynamics software LAMMPS for the example of a fourth-generation high-dimensional neural network potential (4G-HDNNP) intended to be used in combination with the n2p2 library. The method itself is general and applicable to many different types of fourth-generation MLPs. An assessment of the accuracy and the efficiency is presented for a benchmark system of FeCl$_3$ in water.
Introduction
Machine Learning Potentials (MLPs) have revolutionized molecular simulations by providing the accuracy of quantum mechanics at a fraction of the computational cost. However, standard "local" MLPs determine an atom's energy based solely on its immediate environment. This locality assumption fails for systems characterized by long-range charge transfer, such as redox reactions in batteries or biological proteins.
"Fourth-generation" high-dimensional neural network potentials (4G-HDNNPs) address this limitation by incorporating global charge equilibration (QEq). These models calculate atomic charges based on the entire system's configuration, enabling the description of non-local electronic effects. However, the standard direct solution (dQEq) for these charges involves inverting a large matrix, which scales cubically ($O(N^3)$) with the number of atoms $N$. This cubic bottleneck severely limits the size of systems that can be simulated over meaningful timescales.
Methodology
To overcome the cubic scaling of direct solvers, this work introduces Iterative Charge Equilibration (iQEq). Instead of a direct matrix inversion, charge equilibration is reformulated as a multidimensional function minimization problem.
The iQEq approach utilizes gradient-based optimization algorithms—specifically the BFGS-2 algorithm—to find the set of atomic charges that minimizes the total electrostatic energy. A significant challenge in 4G models is force calculation, as changing one atom's position affects the charges of all other atoms globally. The authors employ an efficient Lagrange formalism, reducing the force calculation to solving only one additional system of equations iteratively, rather than $3N$ systems.
The method is implemented within the LAMMPS molecular dynamics package as a new "fix" and "pair style," interfacing with the n2p2 library. This implementation supports parallel execution via MPI, distributing the calculation of local energy and gradient contributions across multiple CPU cores.
Benchmark System: Aqueous FeCl$_3$
The performance and accuracy of iQEq were evaluated using a benchmark system of aqueous Iron(III) chloride ($FeCl_3$). This system is particularly demanding because iron ions can exist in multiple oxidation states ($Fe^{2+}$ and $Fe^{3+}$), requiring global context to distinguish between them. Simulations were performed on systems ranging from 103 to 4,512 atoms to rigorously test scaling behavior.
Key Results and Discussion
The primary finding is the significant improvement in computational scaling. The iQEq method demonstrates clear $O(N^2)$ scaling, contrasting with the $O(N^3)$ scaling of the direct dQEq method.
As shown in the scaling analysis, while direct solvers may be faster for small systems (below ~400 atoms), the iterative approach becomes increasingly superior as system size grows. For a system of approximately 4,500 atoms, iQEq is nearly an order of magnitude faster than dQEq on a single core.
Furthermore, the iterative approach maintains high accuracy. Converging the gradient to $10^{-5}$ eV/e (typically 10–15 iterations) yields charges and forces that match the direct solution to five decimal places, ensuring physical stability. A 500-picosecond MD simulation of the $FeCl_3$ system remained stable and conserved energy, validating the method for long-term production runs.
Conclusion and Future Work
The transition from $O(N^3)$ to $O(N^2)$ scaling via iQEq enables the application of 4G-HDNNPs to significantly larger systems than previously possible. While $O(N^2)$ is a major step forward, it remains a bottleneck for million-atom simulations. Future work will focus on integrating this iterative approach with particle mesh solvers (e.g., P3M) to achieve $O(N \log N)$ scaling, potentially unlocking the full potential of fourth-generation MLPs for massive-scale molecular dynamics.
Summary updated