betaFeedback

WorksPhysics and Astronomy

Accelerating fourth-generation machine learning potentials by quasi-linear scaling particle mesh charge equilibration

Abstract

Machine learning potentials (MLP) have revolutionized the field of atomistic simulations by describing the atomic interactions with the accuracy of electronic structure methods at a small fraction of the costs. Most current MLPs construct the energy of a system as a sum of atomic energies, which depend on information about the atomic environments provided in form of predefined or learnable feature vectors. If, in addition, non-local phenomena like long-range charge transfer are important, fourth-generation MLPs need to be used, which include a charge equilibration (Qeq) step to take the global structure of the system into account. This Qeq can significantly increase the computational cost and thus can become the computational bottleneck for large systems. In this paper we present a highly efficient formulation of Qeq that does not require the explicit computation of the Coulomb matrix elements resulting in a quasi-linearly scaling method. Moreover, our approach also allows for the efficient calculation of energy derivatives, which explicitly consider the global structure-dependence of the atomic charges as obtained from Qeq. Due to its generality, the method is not restricted to MLPs but can also be applied within a variety of other force fields.

Introduction

Obtaining accurate potential energy surfaces (PES) at a reasonable computational expense is one of the greatest challenges in computational chemistry, physics and materials science. Since even most efficient electronic structure methods like density functional theory (DFT) are usually too demanding for large-scale simulations, the conventional approach taken in computer simulations of complex systems involves the use of heuristically derived force fields and empirical potentials. These are often able to capture the main features of the atomic interactions but are quantitatively less accurate than first principles methods based on the direct solution of the quantum mechanical equations.

In recent years, the rapid development of data-driven machine learning potentials (MLP), which offer accurate PESs with only a fraction of the computational costs of the underlying electronic structure calculations used in the training process, has paved the way to solve this dilemma [1, 2, 3, 4, 5, 6, 7, 8]. A key step in the development of MLPs for large condensed systems has been the construction of the total energy as a sum of atomic energies, which only depend on the atomic environments up to a cutoff radius [9]. Many flavors of such local, second-generation MLPs [10] have been proposed and successfully applied to a variety of systems to date [9, 11, 12, 13, 14, 15, 16]. By construction they show a favorable, essentially linear scaling with system size. In addition, third-generation MLPs include long-range electrostatic interactions based on environment-dependent charges represented by machine learning [17, 18, 19, 20, 21]. In spite of including these long-range electrostatic interactions without truncation, such third-generation MLPs are still “local” in the sense that they are unable to take non-local phenomena like long-range charge transfer beyond the local atomic environments into account [22].

The necessity to consider long-range charge transfer, which is present in a variety of systems, in atomistic potentials has attracted a lot of attention since several years. For instance, charge equilibration, which was initially developed by Rappe and Goddard III [23] and later refined by Nakano [24], is a well-established method to approximate complicated electrostatics and charge transfer effects. As shown by Grimme et al. [25], charge equilibration techniques can also be used in the context of dispersion corrections. Warren et al. [26] demonstrated that the polarizability of long molecules is severely overestimated in the original Qeq approach [23] and proposed the addition of charge constraints for subsystems to overcome this problem. An overview and comparison of popular charge equilibration methods has been provided by Ongari et al. [27], and nowadays modern variants of Qeq are routinely used in advanced force fields such as ReaxFF [28] or COMB [29] and are available in widely distributed simulation software packages like LAMMPS [30].

The first use of charge equilibration in the framework of MLPs has been the charge equilibration neural network technique (CENT) introduced in 2015 by Ghasemi et al. [31], and this first fourth-generation MLP has been further improved in the following years [32, 33]. In CENT, the atomic electronegativities of the charge-equilibration approach are expressed as environment-dependent atomic properties learned by atomic neural networks with the goal to reproduce the correct total energy of the system. Due to the underlying total energy expression the CENT approach is best suited for a description of systems with primarily ionic bonding. A fourth-generation high-dimensional neural network potential (4G-HDNNP) that is more generally applicable to all types of systems has been proposed by Ko et al. [34] by combining the advantages of CENT and second-generation HDNNPs. Here, the neural networks providing the atomic electronegativities are trained to reproduce reference atomic partial charges, and the resulting electrostatic energy is combined with modified atomic neural networks contributing atomic energies representing local bonding that explicit takes charge transfer into account.

Incorporating long-range charge transfer and the resulting electrostatics into machine learning models has become increasingly popular over the last years and many other approaches have been proposed [35, 36, 37, 38, 39, 40, 41]. Still, so far, the application of fourth-generation MLPs has been restricted to small and medium-sized systems, primarily due to high computational cost of solving a set of linear equations which is needed in the original charge equilibration method. In order to improve the scaling of charge equilibration, Nakano [24] proposed a multilevel conjugate gradient approach that solves the set of equations iteratively. Because this approach requires the calculation of the Coulomb matrix, which is dense, the scaling is at least quadratically with respect to the number of atoms. The performance of iterative charge equilibration schemes can be enhanced by algorithms that do not require explicit knowledge of the matrix elements, as shown by Rostami et al. [42]. The efficiency of such an iterative scheme can be further improved if it is combined with the conjugate gradient method that allows to reduce the number of iterations compared to a steepest descent approach.

Apart from the determination of the atomic charges, another important aspect that has to be considered in the development of more efficient methods is that fourth-generation MLPs often make use of the charges obtained from the charge equilibration step as input for calculating energy terms beyond simple electrostatics, which consequently also need to be taken into account in the determination of atomic forces and the stress tensor [34]. This requires additional steps that also need to be implemented in a computationally efficient way.

In this work, we propose a formulation of the charge equilibration method, which combines a rapidly converging conjugate gradient with matrix times vector multiplications, that does not require explicit knowledge of the Coulomb matrix elements. This results in quasi-linear scaling with respect to the number of atoms in the system. Moreover, with our ansatz it is possible to calculate derivatives of energy terms that use charges obtained from charge equilibration as input in quasi-linear time. Our method is therefore ideally suited for a combination with 4G-HDNNPs[34] and numerous other types of MLPs that depend on the atomic charges.

After a concise summary of the theoretical background in Section II, we derive the equations for the efficient calculation of the electrostatic energy, forces and stress for periodic systems using our particle mesh charge equilibration method in Section III. This approach is also expected to be very useful in other contexts requiring the solution of Poisson’s equation, in case the charge density has the same form of a smooth superposition of generic atom-centered spherically symmetric charge densities. After a discussion of our results for a reference implementation in Section IV we conclude our main findings in § 1.4.

Theoretical background

Charge Equilibration

In the charge equilibration formalism the energy of the system EQeqE_{\mathrm{Qeq}} is defined as the sum of the electrostatic energy EelecE_{\mathrm{elec}} and a Taylor expansion of atomic energies that depend on atomic charges Q={qi}\mathbf{Q} = \{q_i\},

EQeq(R,Q)=Eelec(R,Q)+∑i=1Nat(Ei+χiqi+12Jiqi2)(1)E_{\mathrm{Qeq}}(\mathbf{R},\mathbf{Q}) = E_{\mathrm{elec}}(\mathbf{R},\mathbf{Q}) + \sum_{i=1}^{N_{\mathrm{at}}} \left(E_i + \chi_i q_i + \frac{1}{2}J_i q_i^2\right) \tag*{(1)}

with R={ri}\mathbf{R} = \{\mathbf{r}_i\} being the atomic coordinates and the {Ei}\{E_i\} the element dependent atomic reference energy offsets. These energy offsets EiE_i cause a shift in EQeqE_{\mathrm{Qeq}} but do not change the charges that are obtained using the charge equilibration method. In Eq. (1) the Taylor expansion is truncated after the second order terms and the expansion coefficients {χi}\{\chi_i\} and {Ji}\{J_i\} are called electronegativity and hardness, respectively. Moreover, the electrostatic energy is computed as Eelec=12∫ρ(r)V(r)drE_{\mathrm{elec}} = \frac{1}{2}\int\rho(\mathbf{r})V(\mathbf{r})\mathrm{d}\mathbf{r} and the charge density

ρ(r)=∑i=1Natqiρi(∥r−ri∥)(2)\rho(\mathbf{r}) = \sum_{i=1}^{N_{\mathrm{at}}} q_i \rho_i(\lVert\mathbf{r} - \mathbf{r}_i \rVert) \tag*{(2)}

is a superposition of atomic charge densities qiρiq_i\rho_i that are spherically symmetric around the position of atom ii. The charge distributions ρi\rho_i are normalized to one, i.e., ∫ρidr=1\int\rho_i\mathrm{d}\mathbf{r} = 1, and scaled by the respective atomic charge qiq_i. V(r)V(\mathbf{r}) is the electrostatic potential of the charge density ρ\rho. The atomic charge densities are usually chosen to be either point charges or Gaussian charge distributions with an element specific width σi\sigma_i.

Charge equilibration is defined as the minimization of EQeqE_{\mathrm{Qeq}} with respect to the atomic charges Q\mathbf{Q} under the constraint of keeping the total charge QtotQ_{\mathrm{tot}} of the system constant. Using the method of Lagrange multipliers, the function

L=Eelec+∑i=1Nat(Ei+χiqi+12Jiqi2)+λ(∑i=1Natqi−Qtot)(3)L = E_{\mathrm{elec}} + \sum_{i=1}^{N_{\mathrm{at}}} \left(E_i + \chi_i q_i + \frac{1}{2}J_i q_i^2\right) + \lambda\left(\sum_{i=1}^{N_{\mathrm{at}}} q_i - Q_{\mathrm{tot}}\right) \tag*{(3)}

has to be stationary. Differentiating Eq. (3) with respect to qiq_i and λ\lambda yields the set of equations

∂L∂qi=∂Eelec∂qi+χi+Jiqi+λ=0(4)\frac{\partial L}{\partial q_i} = \frac{\partial E_{\mathrm{elec}}}{\partial q_i} + \chi_i + J_i q_i + \lambda= 0 \tag*{(4)}
∂EQeq∂λ=∑i=1Natqi−Qtot=0.(5)\frac{\partial E_{\mathrm{Qeq}}}{\partial\lambda} = \sum_{i=1}^{N_{\mathrm{at}}} q_i - Q_{\mathrm{tot}} = 0. \tag*{(5)}

Inserting the definition of the charge density into the electrostatic energy yields

Eelec=12∑i,j=1Natqiqj∬ρi(∥r−ri∥)ρj(∥r′−rj∥)∥r−r′∥ drdr′⏟=Aij(6)E_{\mathrm{elec}}=\frac{1}{2}\sum_{i,j=1}^{N_{\mathrm{at}}}q_iq_j\iint\frac{\rho_i(\lVert\mathbf{r}-\mathbf{r}_i\rVert)\rho_j(\lVert\mathbf{r}'-\mathbf{r}_j\rVert)}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\,\mathrm{d}\mathbf{r}\mathrm{d}\mathbf{r}'\underbrace{}_{=A_{ij}} \tag*{(6)}

The matrix A\mathbf{A} is symmetric and positive definite because Eelec=12QTAQ≥0E_{\mathrm{elec}}=\frac{1}{2}\mathbf{Q}^{\mathsf{T}}\mathbf{A}\mathbf{Q}\geq0 and Eelec=0⟺Q=0E_{\mathrm{elec}}=0\Longleftrightarrow\mathbf{Q}=0. The first inequality holds because the electrostatic interaction energy of a smooth charge density is always positive. Because of the spherical symmetry of the Gaussian density ρi\rho_i around atom ii, AijA_{ij} is a function of the distance between ri\mathbf{r}_i and rj\mathbf{r}_j. Using the definition from Eqs. (4) and (6) and ∂Eelec∂qi=∑j=1NatAijqj\frac{\partial E_{\mathrm{elec}}}{\partial q_i}=\sum_{j=1}^{N_{\mathrm{at}}}A_{ij}q_j, the derivative of the energy with respect to the atomic charges can be simplified to

∂EQeq∂qi=∑j=1NatAijqj+χi+Jiqi+λ=0(7)\frac{\partial E_{\mathrm{Qeq}}}{\partial q_i}=\sum_{j=1}^{N_{\mathrm{at}}}A_{ij}q_j+\chi_i+J_iq_i+\lambda=0 \tag*{(7)}

Eqs. (4) and (5) can be written in matrix notation

(M11T0)(q1⋮qNatλ)=(−χ1⋮−χNatQtot)(8)\begin{pmatrix} \mathbf{M} & \mathbf{1}\\ \mathbf{1}^{\mathsf{T}} & 0 \end{pmatrix} \begin{pmatrix} q_1\\ \vdots\\ q_{N_{\mathrm{at}}}\\ \lambda \end{pmatrix} = \begin{pmatrix} -\chi_1\\ \vdots\\ -\chi_{N_{\mathrm{at}}}\\ Q_{\mathrm{tot}} \tag*{(8)} \end{pmatrix}

where

Mij={Aijif i≠jAii+Jiif i=j.(9)M_{ij}= \begin{cases} A_{ij} & \text{if } i\ne j\\ A_{ii}+J_i & \text{if } i=j. \end{cases} \tag*{(9)}

This set of linear equations can be solved either directly with cubic scaling or using the iterative multilevel conjugate gradient approach[24, 42]. Since the matrix A\mathbf{A} has to be calculated, the best scaling using the latter approach is O(Nat2)\mathcal{O}(N_{\mathrm{at}}^2) because the Coulomb matrix is dense and has Nat2N_{\mathrm{at}}^2 elements.

Calculation of total derivatives

Since the charge equilibration energy depends on the atomic positions, both explicitly and implicitly, via the dependence of the charges on the atomic positions, the gradient is given by the expression

dEelec(R,Q(R))dR=∂Eelec(R,Q)∂R+∂Eelec∂Q∂Q∂R(10)\frac{\mathrm{d}E_{\mathrm{elec}}(\mathbf{R},\mathbf{Q}(\mathbf{R}))}{\mathrm{d}\mathbf{R}}=\frac{\partial E_{\mathrm{elec}}(\mathbf{R},\mathbf{Q})}{\partial\mathbf{R}}+\frac{\partial E_{\mathrm{elec}}}{\partial\mathbf{Q}}\frac{\partial\mathbf{Q}}{\partial\mathbf{R}} \tag*{(10)}

Since in charge equilibration the energy EQeqE_{\mathrm{Qeq}} is minimized with respect to the qiq_i, we have ∂EQeq∂Q=0\frac{\partial E_{\mathrm{Qeq}}}{\partial\mathbf{Q}}=0, and hence the total derivative simplifies to

dEQeq(R,Q(R))dR=∂EQeq(R,Q)∂R(11)\frac{\mathrm{d}E_{\mathrm{Qeq}}(\mathbf{R},\mathbf{Q}(\mathbf{R}))}{\mathrm{d}\mathbf{R}}=\frac{\partial E_{\mathrm{Qeq}}(\mathbf{R},\mathbf{Q})}{\partial\mathbf{R}} \tag*{(11)}

The situation is more complicated if the charges are not determined by a minimization of the total energy. For example in 4G-HDNNPs [34] the charges obtained by the charge equilibration are used as parameters to calculate the short range and electrostatic energies. In that case, the gradient of the total energy of the system is given by

dE(R,Q(R))dri=∂E∂ri+∑j=1Nat∂E∂qj∂qj∂ri(12)\frac{\mathrm{d}E(\mathbf{R},\mathbf{Q}(\mathbf{R}))}{\mathrm{d}\mathbf{r}_i}=\frac{\partial E}{\partial\mathbf{r}_i}+\sum_{j=1}^{N_{\mathrm{at}}}\frac{\partial E}{\partial q_j}\frac{\partial q_j}{\partial\mathbf{r}_i} \tag*{(12)}

and the derivatives ∂qj∂ri\frac{\partial q_j}{\partial\mathbf{r}_i} are required. In total, there are 3Nat23N_{\mathrm{at}}^2 derivatives of atomic charges with respect to atomic positions, which would result in an at least quadratic scaling when the derivatives are calculated. However, the total derivative dEdri\frac{\mathrm{d}E}{\mathrm{d}\mathbf{r}_i} can be evaluated without calculating ∂qj∂ri\frac{\partial q_j}{\partial\mathbf{r}_i} explicitly. A similar approach has been used by Poier et al. [43] in the context of polarizable force fields. Ko et al. [34] derived an efficient way to calculate the forces in the 4G-HDNNP method. The resulting formulas for the forces and the strain derivatives dEdϵμν\frac{\mathrm{d}E}{\mathrm{d}\epsilon_{\mu\nu}} needed for calculating the stress are

dEdrk=∂E∂rk+∑i=1Natλi(∑j=1Nat∂Aij∂rkqj+∂χi∂rk)(13)\frac{\mathrm{d}E}{\mathrm{d}\mathbf{r}_k}=\frac{\partial E}{\partial\mathbf{r}_k}+\sum_{i=1}^{N_{\mathrm{at}}}\lambda_i\left(\sum_{j=1}^{N_{\mathrm{at}}}\frac{\partial A_{ij}}{\partial\mathbf{r}_k}q_j+\frac{\partial\chi_i}{\partial\mathbf{r}_k}\right) \tag*{(13)}
dEdϵμν=∂E∂ϵμν+∑i=1Natλi(∑j=1Nat∂Aij∂ϵμνqj+∂χi∂ϵμν)(14)\frac{\mathrm{d}E}{\mathrm{d}\epsilon_{\mu\nu}}=\frac{\partial E}{\partial\epsilon_{\mu\nu}}+\sum_{i=1}^{N_{\mathrm{at}}}\lambda_i\left(\sum_{j=1}^{N_{\mathrm{at}}}\frac{\partial A_{ij}}{\partial\epsilon_{\mu\nu}}q_j+\frac{\partial\chi_i}{\partial\epsilon_{\mu\nu}}\right) \tag*{(14)}

where λ\boldsymbol{\lambda} can be obtained by solving

Mλ=−∂E∂Q(15)\mathbf{M}\boldsymbol{\lambda}=-\frac{\partial E}{\partial\mathbf{Q}} \tag*{(15)}

under the constraint that the sum of the components of λ\boldsymbol{\lambda} is 0.

In the derivation of the total derivatives it is assumed that the electronegativities χi\chi_i depend on the atomic positions whereas the hardnesses JiJ_i are only element-specific quantities. While the derivation could also be extended to consider position-dependent hardnesses, we assume that the hardness is an element-specific parameter throughout this paper.

The cost of evaluating Eqs. (13) and (14) directly still scales at least quadratically. In Section IIID it will be discussed how these sums can be evaluated more efficiently.

Particle Mesh Charge Equilibration

Solving the system of equations

We start by noting that, as shown in Appendix A, ∂Eelec∂qi\frac{\partial E_{\mathrm{elec}}}{\partial q_i} can be written as

∂Eelec∂qi=∫ρi(∥r−ri∥)V(r) dr=(A⋅Q)i.(16)\frac{\partial E_{\mathrm{elec}}}{\partial q_i}=\int\rho_i(\lVert\mathbf{r}-\mathbf{r}_i\rVert)V(\mathbf{r})\,\mathrm{d}\mathbf{r}=(\mathbf{A}\cdot\mathbf{Q})_i. \tag*{(16)}

With this relation, the matrix-vector product A⋅Q\mathbf{A}\cdot\mathbf{Q} can be calculated for an arbitrary Q\mathbf{Q} without any explicit knowledge about the elements of matrix A\mathbf{A}. Being able to calculate matrix-vector products for arbitrary vectors is sufficient to solve a system of equations iteratively.

As discussed in Section II A, the Coulomb matrix is positive definite. The manifold of the charge equilibration constraint ∑iqi=Qtot\sum_i q_i=Q_{\mathrm{tot}} is a hyperplane meaning that an arbitrary large step along a constrained gradient will still fulfil the charge conservation constraint. Therefore, the standard conjugate gradient method can be used to solve the set of linear equations

(A⋅Q)i+Jiqi=(M⋅Q)i=−χi(17)(\mathbf{A}\cdot\mathbf{Q})_i+J_iq_i=(\mathbf{M}\cdot\mathbf{Q})_i=-\chi_i \tag*{(17)}

where

(M⋅Q)i=∂E∂qi+Jiqi.(18)(\mathbf{M}\cdot\mathbf{Q})_i=\frac{\partial E}{\partial q_i}+J_iq_i. \tag*{(18)}

The constrained gradient ∂E^elec∂qi\frac{\partial\widehat{E}_{\mathrm{elec}}}{\partial q_i} of Eq. (16) can be obtained by projecting the gradient onto the constraint

∂E^elec∂qi=∂Eelec∂qi−1Nat∑j=1Nat∂Eelec∂qj.(19)\frac{\partial\widehat{E}_{\mathrm{elec}}}{\partial q_i}=\frac{\partial E_{\mathrm{elec}}}{\partial q_i}-\frac{1}{N_{\mathrm{at}}}\sum_{j=1}^{N_{\mathrm{at}}}\frac{\partial E_{\mathrm{elec}}}{\partial q_j}. \tag*{(19)}

Plane wave methods

In order to minimize EQeqE_{\mathrm{Qeq}} fast, it is necessary to evaluate Eq. (16) efficiently. In the case of periodic boundary conditions this can be done by solving Poisson’s equation in Fourier space using plane waves. Let ρ~(G)\widetilde{\rho}(\mathbf{G}) and V~(G)\widetilde{V}(\mathbf{G}) be the Fourier transforms of ρ\rho and VV, respectively and G\mathbf{G} is a Fourier space vector. Because of the Plancherel theorem, EelecE_{\mathrm{elec}} can be calculated in Fourier space as

Eelec=12∫ρ(r)V(r) dr=12∫ρ~∗(G)V~(G) dG(20)E_{\mathrm{elec}}=\frac{1}{2}\int\rho(\mathbf{r})V(\mathbf{r})\,\mathrm{d}\mathbf{r}=\frac{1}{2}\int\widetilde{\rho}^{*}(\mathbf{G})\widetilde{V}(\mathbf{G})\,\mathrm{d}\mathbf{G} \tag*{(20)}

where the superscript * of ρ\rho represents complex conjugation. This is particularly useful, because Poisson’s equation can be solved analytically in Fourier space with the solution V~(G)=−4πρ~(G)G2\widetilde{V}(\mathbf{G})=-4\pi\frac{\widetilde{\rho}(\mathbf{G})}{G^2}. The electrostatic energy can be calculated by Fourier transforming ρ\rho and then solving the Fourier space integral in Eq. (20). Then, the electrostatic potential V(r)V(\mathbf{r}) in real space can be obtained efficiently by back transforming the Fourier coefficients −4πρ~(G)G2-4\pi\frac{\widetilde{\rho}(\mathbf{G})}{G^2}.

In case of periodic boundary conditions, the integral in Eq. (20) transforms into the following series

Eelec=2πΩ∑Gρ~∗(G)ρ~(G)G2(21)E_{\mathrm{elec}}=2\pi\Omega\sum_{\mathbf{G}}\widetilde{\rho}^{*}(\mathbf{G})\frac{\widetilde{\rho}(\mathbf{G})}{G^2} \tag*{(21)}

where Ω\Omega is the unit cell volume. Also, Fourier transforms of any periodic function can be obtained numerically using the Fast Fourier transform (FFT), which can be calculated with a O(Nln⁡N)O(N\ln N) scaling where NN the number of gridpoints.

The electrostatic potential V(r)V(\mathbf{r}) can be obtained using a forward and backward Fourier transform. The atomic charge densities ρi\rho_i which are present in Eq. (16) typically decay exponentially, which makes it possible to obtain ∂Eelec∂qi\frac{\partial E_{\mathrm{elec}}}{\partial q_i} for all atoms in quasi linear time because it is sufficient to integrate only over a small volume around each atom ii to obtain ∂Eelec∂qi\frac{\partial E_{\mathrm{elec}}}{\partial q_i}. Therefore, the matrix vector product (M⋅Q)i=∂E∂qi+Jiqi(\mathbf{M}\cdot\mathbf{Q})_i=\frac{\partial E}{\partial q_i}+J_iq_i can be evaluated for any Q\mathbf{Q} in quasi linear time.

Derivatives with plane wave methods

Most materials science simulations require the calculation of the forces acting on the nuclei and the stress tensor acting on the periodic lattice. Using the definition of ρ\rho from Eq. (2), the electrostatic force can be obtained by evaluating the real space integral

∂Eelec(r1,…,rNat)∂ri=qi∫V(r)∂ρi(∥r−ri∥)∂ri dr(22)\frac{\partial E_{\mathrm{elec}}(\mathbf{r}_1,\ldots,\mathbf{r}_{N_{\mathrm{at}}})}{\partial\mathbf{r}_i}=q_i\int V(\mathbf{r})\frac{\partial\rho_i(\lVert\mathbf{r}-\mathbf{r}_i\rVert)}{\partial\mathbf{r}_i}\,\mathrm{d}\mathbf{r} \tag*{(22)}

which is derived in Appendix B.

Regarding the electrostatic stress, two different definitions of stress are commonly in use, the microscopic stress and the macroscopic stress. The microscopic stress tensor is a tensor field, and an example is the Maxwell stress σij=14π(EiEj−12δijE2)\sigma_{ij}=\frac{1}{4\pi}(E_iE_j-\frac{1}{2}\delta_{ij}E^2) for systems without periodic boundary conditions. For periodic systems, the microscopic stress tensor is rarely used since in bulk materials it is often sufficient to consider the macroscopic stress tensor, which corresponds to the average microscopic stress per unit volume. The symmetric strain tensor ϵμν\epsilon_{\mu\nu} describes an infinitesimal deformation of a crystal rμ′=(δμν+ϵμν)rν\mathbf{r}'_{\mu}=(\delta_{\mu\nu}+\epsilon_{\mu\nu})\mathbf{r}_{\nu}, where δ\delta stands for the Kronecker delta and the Einstein summation convention is used. The macroscopic stress σ\sigma is the strain derivative of the total energy per unit volume [45] [44] with

σμν=1Ω∂E(R′)∂ϵμν∣ϵ=0.(23)\sigma_{\mu\nu}=\left.\frac{1}{\Omega}\frac{\partial E(\mathbf{R}')}{\partial\epsilon_{\mu\nu}}\right|_{\epsilon=0}. \tag*{(23)}

R′\mathbf{R}' contains the atomic positions R\mathbf{R} that are deformed with the strain tensor ϵμν\epsilon_{\mu\nu}. Because of the variational character of electronic structure calculations, the strain derivative of the charge density is zero, which reduces Eq. (23) to the average Maxwell stress that can easily be calculated when the total potential V(r)V(\mathbf{r}) is known. The strain derivative of the charge density is not zero in our case and the total stress has to be evaluated in Fourier space where ∂ρ∂ϵμν\frac{\partial\rho}{\partial\epsilon_{\mu\nu}} is given by

σμν=1Ω∂Eelec(R′)∂εμν∣ε=0=δμνEΩ+2π∑G≠0(1G2(ρ~∗(G)∂ρ~(G)∂εμν+ρ~(G)∂ρ~∗(G)∂εμν)+2∣ρ~(G)∣2G4GμGν).(24)\sigma_{\mu\nu}=\left.\frac{1}{\Omega}\frac{\partial E_{\mathrm{elec}}(\mathbf{R}')}{\partial\varepsilon_{\mu\nu}}\right|_{\varepsilon=0}=\delta_{\mu\nu}\frac{E}{\Omega}+2\pi\sum_{\mathbf{G}\ne0}\left(\frac{1}{G^2}\left(\widetilde{\rho}^{*}(\mathbf{G})\frac{\partial\widetilde{\rho}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}+\widetilde{\rho}(\mathbf{G})\frac{\partial\widetilde{\rho}^{*}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}\right)+\frac{2|\widetilde{\rho}(\mathbf{G})|^2}{G^4}G_\mu G_\nu\right). \tag*{(24)}

A derivation of Eq. (24) can be found in Appendix § 1.2.3. The Fourier transform of the strain derivative ∂ρ~(G)∂εμν\frac{\partial\widetilde{\rho}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}} can be obtained by transforming the strain derivatives ∂ρ∂εμν\frac{\partial\rho}{\partial\varepsilon_{\mu\nu}} of the charge density into Fourier space, which requires six additional Fourier transforms as ∂ρ∂εμν\frac{\partial\rho}{\partial\varepsilon_{\mu\nu}} is symmetric. The periodic generalization of Eq. (2) for the lattice matrix h\mathbf{h} containing the three lattice vectors h1\mathbf{h}_1, h2\mathbf{h}_2 and h3\mathbf{h}_3 is given by

ρ(r,r1,…,rNat,h)=∑i,j,k=−∞∞∑l=1Natqlρl(∥r−rl−ih1−jh2−kh3∥2).(25)\rho(\mathbf{r},\mathbf{r}_1,\ldots,\mathbf{r}_{N_{\mathrm{at}}},\mathbf{h})=\sum_{i,j,k=-\infty}^{\infty}\sum_{l=1}^{N_{\mathrm{at}}}q_l\rho_l\left(\left\lVert\mathbf{r}-\mathbf{r}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3\right\rVert^2\right). \tag*{(25)}

The calculation of the strain derivative of Eq. (25) is discussed in Appendix § 1.2.4. It has the form

∂ρ(r,r1,…,rNat,h)∂εμν=∑i,j,k=−∞∞∑l=1Nat2ql(r−rl−ih1−jh2−kh3)μ(r−rl−ih1−jh2−kh3)νρl′(∥r−rl−ih1−jh2−kh3∥2).(26)\frac{\partial\rho(\mathbf{r},\mathbf{r}_1,\ldots,\mathbf{r}_{N_{\mathrm{at}}},\mathbf{h})}{\partial\varepsilon_{\mu\nu}}=\sum_{i,j,k=-\infty}^{\infty}\sum_{l=1}^{N_{\mathrm{at}}}2q_l(\mathbf{r}-\mathbf{r}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3)_\mu(\mathbf{r}-\mathbf{r}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3)_\nu\rho_l'\left(\left\lVert\mathbf{r}-\mathbf{r}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3\right\rVert^2\right). \tag*{(26)}

The sums over ii, jj and kk in Eqs. (25) and (26) are over all periodic images of the simulation cell.

Particle mesh total derivatives

Using the definitions

ρλ=∑i=1NatλiρiandρQ=∑i=1Natqiρi,(27)\rho^\lambda=\sum_{i=1}^{N_{\mathrm{at}}}\lambda_i\rho_i\quad\text{and}\quad\rho^{\mathrm{Q}}=\sum_{i=1}^{N_{\mathrm{at}}}q_i\rho_i, \tag*{(27)}

the corresponding potentials VQV^{\mathrm{Q}} and VλV^\lambda as well as the electrostatic energies

Eλ=12∫ρλVλ drandEQ=12∫ρQVQ dr(28)E^\lambda=\frac{1}{2}\int\rho^\lambda V^\lambda\,\mathrm{d}r\quad\text{and}\quad E^{\mathrm{Q}}=\frac{1}{2}\int\rho^{\mathrm{Q}}V^{\mathrm{Q}}\,\mathrm{d}r \tag*{(28)}

the double sums in Eqs. (13) and (14) can be expressed in terms of the newly introduced variables as

∑i,j=1Natλi∂Aij∂rkqj=∫[VQ(r)∂ρλ(r)∂rk+Vλ(r)∂ρQ(r)∂rk]dr(29)\sum_{i,j=1}^{N_{\mathrm{at}}}\lambda_i\frac{\partial A_{ij}}{\partial r_k}q_j=\int\left[V^{\mathrm{Q}}(\mathbf{r})\frac{\partial\rho^\lambda(\mathbf{r})}{\partial r_k}+V^\lambda(\mathbf{r})\frac{\partial\rho^{\mathrm{Q}}(\mathbf{r})}{\partial r_k}\right]\mathrm{d}r \tag*{(29)}

and

∑i,j=1Natλi∂Aij∂εμνqj=∑i,j=1Nat∫qiλj∂∂εμνρi(r)ρj(r′)∥r−r′∥drdr′(30)\sum_{i,j=1}^{N_{\mathrm{at}}}\lambda_i\frac{\partial A_{ij}}{\partial\varepsilon_{\mu\nu}}q_j=\sum_{i,j=1}^{N_{\mathrm{at}}}\int q_i\lambda_j\frac{\partial}{\partial\varepsilon_{\mu\nu}}\frac{\rho_i(\mathbf{r})\rho_j(\mathbf{r}')}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\mathrm{d}r\mathrm{d}r' \tag*{(30)}

Eq. (29) can be solved in real space and Eq. (30) can be solved in Fourier space, in which the integral has the form

∑i,j=1Natλi∂Aij∂εμνqj=2πΩ∑G≠01G2[δμνρ~λ∗(G)ρ~Q(G)+∂ρ~λ∗(G)∂εμνρ~Q(G)+ρ~λ∗(G)(∂ρ~Q(G)∂εμν+2G2GμGνρ~Q(G))](31)\sum_{i,j=1}^{N_{\mathrm{at}}}\lambda_i\frac{\partial A_{ij}}{\partial\varepsilon_{\mu\nu}}q_j=2\pi\Omega\sum_{\mathbf{G}\ne0}\frac{1}{G^2}\left[\delta_{\mu\nu}\widetilde{\rho}^{\lambda*}(\mathbf{G})\widetilde{\rho}^{\mathrm{Q}}(\mathbf{G})+\frac{\partial\widetilde{\rho}^{\lambda*}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}\widetilde{\rho}^{\mathrm{Q}}(\mathbf{G})+\widetilde{\rho}^{\lambda*}(\mathbf{G})\left(\frac{\partial\widetilde{\rho}^{\mathrm{Q}}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}+\frac{2}{G^2}G_\mu G_\nu\widetilde{\rho}^{\mathrm{Q}}(\mathbf{G})\right)\right] \tag*{(31)}

which can all be evaluated with quasi-linear scaling. A derivation of Eqs. (29) and (31) is presented in Eqs. (46) and (E2) in Appendix E.

The coefficients λi\lambda_i can be obtained by solving M⋅λ=−∂E∂Q\mathbf{M}\cdot\boldsymbol{\lambda}=-\frac{\partial E}{\partial\mathbf{Q}}, where EE is an arbitrary energy that depends on charges obtained by minimizing EQeqE_{\mathrm{Qeq}}. Once again, the matrix-vector product (A⋅λ)i=∂EE∂qi=∫ρi(∥r−ri∥)Vλ dr(\mathbf{A} \cdot\boldsymbol{\lambda})_i = \frac{\partial E^{\mathrm{E}}}{\partial q_i} = \int\rho_i(\lVert\mathbf{r} - \mathbf{r}_i\rVert)V^{\lambda} \, \mathrm{d}r can be evaluated without knowledge of the elements of A\mathbf{A}. Therefore, it can also be solved iteratively using the conjugate gradient method.

Results and Discussion

Overall, our iterative particle mesh charge equilibration method can be summarized as follows:

  1. Charge equilibration: Solve M⋅Q=−χ\mathbf{M} \cdot\mathbf{Q} = -\boldsymbol{\chi} under the constant charge constraint using the conjugate gradient method. (M⋅Q)i=∂Eelec∂qi+Jiqi(\mathbf{M} \cdot\mathbf{Q})_i = \frac{\partial E_{\mathrm{elec}}}{\partial q_i} + J_iq_i.

  1. Calculate λ\boldsymbol{\lambda} charges: Solve M⋅λ=−∂E(r1,…,rNat,Q)∂Q\mathbf{M} \cdot\boldsymbol{\lambda} = -\frac{\partial E(r_1,\ldots,r_{N_{\mathrm{at}}},\mathbf{Q})}{\partial\mathbf{Q}} under the constraint that ∑iλi=0\sum_i \lambda_i = 0 using the conjugate gradient method.

  1. Calculate forces and stress: Use Eqs. (13), (14), (29) and (31) to calculate the forces and the stress tensor.

In a first step we have compared the computational efficiency of the particle mesh charge equilibration method with the conventional charge equilibration approach, i.e.,

the direct solution of a set of linear equations. For this purpose, the presented iterative particle mesh electrostatic method has been incorporated into our MLP software RuNNer [46, 47] yielding a significant enhancement for molecular simulations employing 4G-HDNNPs. Results, comprehensively presented in Figure 1, show large performance gains of the new iterative electrostatic approach compared to the conventional direct method. Examination of the computation time distribution reveals the significant contribution of the electrostatic component, highlighting its dominance in the overall computational costs.

Benchmark comparison of iterative and direct solvers

Figure 1. Benchmark results illustrating the performance of the iterative particle mesh electrostatic method and the conventional direct method. The figure displays the average single core CPU times required for predicting the energies of 50 randomly selected periodic structures from a dataset containing Au2_2 clusters on undoped and doped MgO(001) surfaces described by Ko et al. [34]. Each structure comprises 110 atoms, along with their respective supercells containing 220, 440, and 880 atoms. The benchmark includes both the direct method employed in their study on the right and the newly introduced iterative particle mesh method on the left. The simulations were conducted using the RuNNer code [46, 47] on a single core CPU on a Intel Xeon 6430 processors with 32 cores, operating at 2.10 GHz and a 270W TDP. The system is equipped with 512 GB DDR5-4800 ECC REG RAM (16·32 GB).

Having confirmed the high performance of our new method with respect to the conventional approach, we now turn to the scaling behavior of the method. Assuming that the number of iterations needed in the conjugate gradient method does not depend on the system size, the computational costs for the iterative charge equilibration are determined by the cost of solving the electrostatic problem, which scales like O(Natln⁡Nat)O(N_{\mathrm{at}}\ln N_{\mathrm{at}}) in our case. The number of conjugate gradient iterations needed to converge the charge equilibration charges is slightly increasing with the number of particles. Therefore, in reality the asymptotic behaviour to some extent deviates from the ideal O(Natln⁡Nat)O(N_{\mathrm{at}}\ln N_{\mathrm{at}}) scaling. Therefore, the charge equilibration and the computation of the derivatives have a quasi linear scaling which is slightly higher than O(Natln⁡Nat)O(N_{\mathrm{at}}\ln N_{\mathrm{at}}). Figure 2 shows timings of our reference implementation of the iterative charge equilibration method presented in this paper. The asymptotic scaling appears to be approximately O(Nat ln⁡(Nat)2)O(N_{\mathrm{at}\ }\ln(N_{\mathrm{at}})^2). The required calculation of the charge density and the 3-dim FFT’s can be efficiently parallelized with OpenMP resulting in good overall parallel speed-ups.

Figure 2. Timings of our reference implementation of the iterative particle mesh charge equilibration. Shown is the time calculate the Qeq charges for a periodic system as a function of the number of atoms in the system for different numbers of OPENMP threads. The calculations were performed on an AMD EPYC 7742 64-Core Processor with one TB of RAM. Less than 30 GB of RAM were used in total for all threads for all benchmark calculations. The fitted yellow line shows the asymptotic scaling of the computational cost of the newly developed iterative method.

In Figure 3 the particle mesh iterative solver is compared with the standard direct approach to identify at which system size the new approach becomes more efficient. We find that the iterative method developed in this paper is faster than the direct solution when the test system exceeds a size of about 100 atoms. The computational cost of obtaining the solution for the conventional direct approach scales cubically because of the system of equations to be solved. Since there are highly efficient solvers available for systems of linear equations, the prefactor of the cubic term is small and the quadratic term is dominant in the relatively small system size range shown in Figure 3, while the cubic scaling is anticipated to become dominant for systems between 1000 and 10000 atoms. The quadratic term in the direct approach results from calculating the matrix elements of A\mathbf{A}. Our newly proposed iterative method therefore outperforms the direct approach even for system sizes where the cost of solving the system of equations is negligible and the most expensive part in the direct method is calculating all the matrix elements AijA_{ij}. Being iterative, our approach can profit from a good input guess to reduce the number of iterations. This effect was not taken into account in our tests but will exist in many real applications. In Molecular Dynamics (MD) for instance, the charges from the previous MD step form a good input guess for the next MD step. This will further increase the efficiency gains of our iterative method compared to the standard direct method.

Figure 3. Logarithmic plot of the iterative particle mesh charge equilibration timings in comparison with the standard direct approach employing a solution of the set of linear equations. The Coulomb matrix elements were calculated using standard Ewald techniques for the direct approach, which is governing the scaling for the shown small system sizes resulting in dominantly quadratic scaling here. The calculation was done on a desktop machine with an 11th generation Intel i7 CPU (11700) and 32 GB of RAM. The fitted blue line shows the scaling of the computational cost of the direct method.

Conclusions

In this work we have presented a quasi-linear, i.e. Nlog⁡(N)2N\log(N)^2, scaling method for charge equilibration that allows us to speed up the evaluation of any atomistic potential that contains a charge equilibration part. The atomistic potential can either be a machine learning potential or a classical force field. The performance of our method has been investigated for the example of a fourth-generation high-dimensional neural network potential. We have shown that due to the high efficiency of the method it is now possible to perform simulations of systems containing thousands of atoms, which to date has been very demanding if long-range charge transfer has to be taken into account. Consequently, our method will allow to treat even complex systems with the latest generation of machine learning potentials to enable simulations of unprecedented accuracy.

Acknowledgments

Financial support was obtained from the Swiss National Science Foundation (project 200021_191994) and the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation, project 495842446) in the framework of the DFG priority program SPP 2363. This work has been supported by the DFG under Germany’s Excellence Strategy—EXC 2033–390677874—RESOLV. The calculations were performed on the computational resources of the Swiss National Supercomputer (CSCS) under project s1167 and on the Scicore (http://scicore.unibas.ch/) computing center of the University of Basel.

Derivation of charge derivatives

Using the definition of EelecE_{\mathrm{elec}} given in Eq. (6), ∂Eelec∂qi\frac{\partial E_{\mathrm{elec}}}{\partial q_i} can be derived the following way:

∂Eelec∂qi=12∬∑j,k=1Natρj(r−rj)ρk(r′−rk)∥r−r′∥∂∂qiqjqk drdr′=∫ρi(r−ri)(∫∑j=1Natqjρj(r′−rj)∥r−r′∥ dr′)dr=∫V(r)ρi(r−ri) dr(32)\begin{aligned} \frac{\partial E_{\mathrm{elec}}}{\partial q_i}=\frac{1}{2}\iint\sum_{j,k=1}^{N_{\mathrm{at}}}\frac{\rho_j(\mathbf{r}-\mathbf{r}_j)\rho_k(\mathbf{r}'-\mathbf{r}_k)}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\frac{\partial}{\partial q_i}q_jq_k\,\mathrm{d}r\mathrm{d}r'=\int\rho_i(\mathbf{r}-\mathbf{r}_i)\left(\int\frac{\sum_{j=1}^{N_{\mathrm{at}}}q_j\rho_j(\mathbf{r}'-\mathbf{r}_j)}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\,\mathrm{d}r'\right)\mathrm{d}r \\ &=\int V(\mathbf{r})\rho_i(\mathbf{r}-\mathbf{r}_i)\,\mathrm{d}r \tag*{(32)} \end{aligned}

Derivation of electrostatic forces

∂E(R1,…,RNat)∂Ri=12∫∂∂Ri(ρ(r)V(r)) dr=12∫[V(r)∂ρ(r)∂Ri+ρ(r)∂V(r)∂Ri]dr=∫V(r)∂ρ(r)∂Ri dr.(33)\frac{\partial E(\mathbf{R}_1,\ldots,\mathbf{R}_{N_{\mathrm{at}}})}{\partial\mathbf{R}_i}=\frac{1}{2}\int\frac{\partial}{\partial\mathbf{R}_i}\left(\rho(\mathbf{r})V(\mathbf{r})\right)\,\mathrm{d}r=\frac{1}{2}\int\left[V(\mathbf{r})\frac{\partial\rho(\mathbf{r})}{\partial\mathbf{R}_i}+\rho(\mathbf{r})\frac{\partial V(\mathbf{r})}{\partial\mathbf{R}_i}\right]\mathrm{d}r=\int V(\mathbf{r})\frac{\partial\rho(\mathbf{r})}{\partial\mathbf{R}_i}\,\mathrm{d}r. \tag*{(33)}

The last part of Eq. (33) holds because

∫ρ(r)∂∂Ri∫ρ(r′)∥r−r′∥ dr′ dr=∬ρ(r)∥r−r′∥∂ρ(r′)∂Ri dr′dr=∫∂ρ(r′)∂Ri∫ρ(r)∥r−r′∥ dr dr′=∫V(r)∂ρ(r)∂Ri dr.(34)\int\rho(\mathbf{r})\frac{\partial}{\partial\mathbf{R}_i}\int\frac{\rho(\mathbf{r}')}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\,\mathrm{d}r'\,\mathrm{d}r=\iint\frac{\rho(\mathbf{r})}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\frac{\partial\rho(\mathbf{r}')}{\partial\mathbf{R}_i}\,\mathrm{d}r'\mathrm{d}r=\int\frac{\partial\rho(\mathbf{r}')}{\partial\mathbf{R}_i}\int\frac{\rho(\mathbf{r})}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\,\mathrm{d}r\,\mathrm{d}r'=\int V(\mathbf{r})\frac{\partial\rho(\mathbf{r})}{\partial\mathbf{R}_i}\,\mathrm{d}r. \tag*{(34)}

∂ρ∂Ri=qi∂ρi∂Ri\frac{\partial\rho}{\partial\mathbf{R}_i}=q_i\frac{\partial\rho_i}{\partial\mathbf{R}_i} when the definition of ρ\rho from Eq. (2) is used. Therefore,

∂E(r1,…,rNat)∂ri=qi∫V(r)∂ρi(r−ri)∂ri dr.(35)\frac{\partial E(\mathbf{r}_1,\ldots,\mathbf{r}_{N_{\mathrm{at}}})}{\partial\mathbf{r}_i}=q_i\int V(\mathbf{r})\frac{\partial\rho_i(\mathbf{r}-\mathbf{r}_i)}{\partial\mathbf{r}_i}\,\mathrm{d}r. \tag*{(35)}

Calculation of electrostatic stress

The stress tensor of the electrostatic energy is derived for periodic systems by calculating the strain derivative of the electrostatic energy in Fourier space because it requires the least number of additional Fourier transforms.

∂E∂εμν=∂∂εμν2πΩ∑G≠0∣ρ~(G)∣2G2=2π∂Ω∂εμν∑G≠0∣ρ~(G)∣2G2+2πΩ∑G≠0(1G2∂∣ρ~(G)∣2∂εμν+∣ρ~(G)∣2∂∂εμν1G2)(36)\frac{\partial E}{\partial\varepsilon_{\mu\nu}}=\frac{\partial}{\partial\varepsilon_{\mu\nu}}2\pi\Omega\sum_{\mathbf{G}\ne0}\frac{\lvert\tilde{\rho}(\mathbf{G})\rvert^2}{G^2}=2\pi\frac{\partial\Omega}{\partial\varepsilon_{\mu\nu}}\sum_{\mathbf{G}\ne0}\frac{\lvert\tilde{\rho}(\mathbf{G})\rvert^2}{G^2}+2\pi\Omega\sum_{\mathbf{G}\ne0}\left(\frac{1}{G^2}\frac{\partial\lvert\tilde{\rho}(\mathbf{G})\rvert^2}{\partial\varepsilon_{\mu\nu}}+\lvert\tilde{\rho}(\mathbf{G})\rvert^2\frac{\partial}{\partial\varepsilon_{\mu\nu}}\frac{1}{G^2}\right) \tag*{(36)}

The following identities are useful for calculating the strain derivatives present in the terms A, B and C:

Strain derivative of a position vector

∂rτ∂εμν=δτμrν(37)\frac{\partial r_\tau}{\partial\varepsilon_{\mu\nu}}=\delta_{\tau\mu}r_\nu \tag*{(37)}

Strain derivative of a Fourier space vector

∂Gτ∂εμν=−δτνGμ(38)\frac{\partial G_\tau}{\partial\varepsilon_{\mu\nu}}=-\delta_{\tau\nu}G_\mu \tag*{(38)}

Strain derivative of 1G2\frac{1}{G^2}

∂∂εμν1G2=2G4GμGν(39)\frac{\partial}{\partial\varepsilon_{\mu\nu}}\frac{1}{G^2}=\frac{2}{G^4}G_\mu G_\nu \tag*{(39)}

Strain derivative of the unit cell volume

∂Ω∂εμν=δμνΩ(40)\frac{\partial\Omega}{\partial\varepsilon_{\mu\nu}}=\delta_{\mu\nu}\Omega \tag*{(40)}

Strain derivative of a product of a real space and a Fourier space vector

∂∂εμνrτGτ=0(41)\frac{\partial}{\partial\varepsilon_{\mu\nu}}r_\tau G_\tau=0 \tag*{(41)}

The Einstein summation convention is used in all of the identities. Eq. (37) can be derived from the definition of the translation rμ′=(δμα+εμα)rαr'_\mu=(\delta_{\mu\alpha}+\varepsilon_{\mu\alpha})r_\alpha. For Eq. (38), the first Taylor expansion coefficient of the inverse transformation (δμν−εμν)(\delta_{\mu\nu}-\varepsilon_{\mu\nu}) can be used. The last non trivial identity is Eq. (40). There, the useful identity ∂det⁡M∂x=det⁡MTr⁡(M−1∂M∂x)\frac{\partial\det M}{\partial x}=\det M\operatorname{Tr}\left(M^{-1}\frac{\partial M}{\partial x}\right) and the transformation law of the unit cell matrix hμν′=(δμα+εμα)hανh'_{\mu\nu}=(\delta_{\mu\alpha}+\varepsilon_{\mu\alpha})h_{\alpha\nu} is used.

The derivatives required form terms A and C are given in Eqs. (39) and (40) respectively. Using the product rule, term B can be written as

∂∣ρ~(G)∣2∂εμν=∂ρ~(G)∂εμν⋅ρ~∗(G)=ρ~∗(G)∂ρ~(G)∂εμν+ρ~(G)∂ρ~∗(G)∂εμν\frac{\partial\lvert\tilde{\rho}(\mathbf{G})\rvert^2}{\partial\varepsilon_{\mu\nu}}=\frac{\partial\tilde{\rho}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}\cdot\tilde{\rho}^{*}(\mathbf{G})=\tilde{\rho}^{*}(\mathbf{G})\frac{\partial\tilde{\rho}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}+\tilde{\rho}(\mathbf{G})\frac{\partial\tilde{\rho}^{*}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}

where ∂ρ~(G)∂εμν\frac{\partial\tilde{\rho}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}} is the Fourier transform of ∂ρ(x)∂εμν\frac{\partial\rho(\mathbf{x})}{\partial\varepsilon_{\mu\nu}}. Because of Eq. (41) ∂eiGr∂εμν=0\frac{\partial e^{i\mathbf{G}\mathbf{r}}}{\partial\varepsilon_{\mu\nu}}=0 and therefore strain derivatives commute with the Fourier transform.

Charge density with periodic boundary conditions and its strain derivative

ρ(r,R1,…,RNat,h)=∑i,j,k=−∞∞∑l=1Natqlρl(∥r−Rl−ih1−jh2−kh3∥2σl2)(42)\rho(\mathbf{r},\mathbf{R}_1,\ldots,\mathbf{R}_{N_{\mathrm{at}}},\mathbf{h})=\sum_{i,j,k=-\infty}^{\infty}\sum_{l=1}^{N_{\mathrm{at}}}q_l\rho_l\left(\frac{\left\lVert\mathbf{r}-\mathbf{R}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3\right\rVert^2}{\sigma_l^2}\right) \tag*{(42)}

Only ∂ρl(x2)∂εμν\frac{\partial\rho_l(x^2)}{\partial\varepsilon_{\mu\nu}} needs to be calculated to get the strain derivative or the charge density.

∂ρl(xτxτ)∂εμν=∂xτxτ∂εμνρl′(x2)=2xτ∂xτ∂εμνρl′(x2)=2xτδτμxνρl′(x2)=2xμxνρl′(x2)(43)\frac{\partial\rho_l(x_\tau x_\tau)}{\partial\varepsilon_{\mu\nu}}=\frac{\partial x_\tau x_\tau}{\partial\varepsilon_{\mu\nu}}\rho_l'(x^2)=2x_\tau\frac{\partial x_\tau}{\partial\varepsilon_{\mu\nu}}\rho_l'(x^2)=2x_\tau\delta_{\tau\mu}x_\nu\rho_l'(x^2)=2x_\mu x_\nu\rho_l'(x^2) \tag*{(43)}

Finally,

∂ρ(r,R1,…,RNat,h)∂εμν=∑i,j,k=−∞∞∑l=1Nat2ql(r−Rl−ih1−jh2−kh3)μ(r−Rl−ih1−jh2−kh3)νρl′((r−Rl−ih1−jh2−kh3)2)(44)\frac{\partial\rho(\mathbf{r},\mathbf{R}_1,\ldots,\mathbf{R}_{N_{\mathrm{at}}},\mathbf{h})}{\partial\varepsilon_{\mu\nu}}=\sum_{i,j,k=-\infty}^{\infty}\sum_{l=1}^{N_{\mathrm{at}}}2q_l(\mathbf{r}-\mathbf{R}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3)_\mu(\mathbf{r}-\mathbf{R}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3)_\nu\rho_l'((\mathbf{r}-\mathbf{R}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3)^2) \tag*{(44)}

or with Gaussian atomic charge densities ρl(∥x∥2)=12πσl2e−∥x∥22σl2\rho_l(\lVert\mathbf{x}\rVert^2)=\frac{1}{\sqrt{2\pi\sigma_l^2}}e^{-\frac{\lVert\mathbf{x}\rVert^2}{2\sigma_l^2}}

∂ρ(r,R1,…,RNat,h)∂εμν=−∑i,j,k=−∞∞∑l=1Natql2πσl21σl2(r−Rl−ih1−jh2−kh3)μ(r−Rl−ih1−jh2−kh3)νe−(r−Rl−ih1−jh2−kh3)22σl2(45)\frac{\partial\rho(\mathbf{r},\mathbf{R}_1,\ldots,\mathbf{R}_{N_{\mathrm{at}}},\mathbf{h})}{\partial\varepsilon_{\mu\nu}}=-\sum_{i,j,k=-\infty}^{\infty}\sum_{l=1}^{N_{\mathrm{at}}}\frac{q_l}{\sqrt{2\pi\sigma_l^2}}\frac{1}{\sigma_l^2}(\mathbf{r}-\mathbf{R}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3)_\mu(\mathbf{r}-\mathbf{R}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3)_\nu e^{-\frac{(\mathbf{r}-\mathbf{R}_l-i\mathbf{h}_1-j\mathbf{h}_2-k\mathbf{h}_3)^2}{2\sigma_l^2}} \tag*{(45)}

Charge equilibration total derivatives

Here, Eqs. (29) and (30) are simplified.

∑i=1Natλi∑j=1Nat∂Aij∂rkQj=∑i,j=1NatλiQj∂∂rk∬ρi(r−ri)ρj(r′−rj)∥r−r′∥ drdr′=∂∂rk∫ρλ(r)VQ(r)dr=∫[VQ(r)∂ρλ(r)∂rk+Vλ(r)∂ρQ(r)∂rk]dr(46)\begin{aligned} \sum_{i=1}^{N_{\mathrm{at}}}\lambda_i\sum_{j=1}^{N_{\mathrm{at}}}\frac{\partial A_{ij}}{\partial r_k}Q_j=\sum_{i,j=1}^{N_{\mathrm{at}}}\lambda_iQ_j\frac{\partial}{\partial r_k}\iint\frac{\rho_i(\mathbf{r}-\mathbf{r}_i)\rho_j(\mathbf{r}'-\mathbf{r}_j)}{\lVert\mathbf{r}-\mathbf{r}'\rVert}\,d\mathbf{r}d\mathbf{r}' \\ &=\frac{\partial}{\partial r_k}\int\rho^\lambda(\mathbf{r})V^Q(\mathbf{r})d\mathbf{r}=\int\left[V^Q(\mathbf{r})\frac{\partial\rho^\lambda(\mathbf{r})}{\partial r_k}+V^\lambda(\mathbf{r})\frac{\partial\rho^Q(\mathbf{r})}{\partial r_k}\right]d\mathbf{r} \tag*{(46)} \end{aligned}
∑iλi∑j∂Aij∂εμνQj=∂∂εμν∫ρλ(r)VQ(r)dr=∂∂εμν2πΩ∑G≠0ρλ∗(G)V~Q(G)=2πΩ∑G≠0[δμνρλ∗(G)V~Q(G)+∂ρ~λ∗(G)∂εμνV~Q(G)+ρ~λ∗(G)∂V~Q(G)∂εμν]=2πΩ∑G≠0[δμνρλ∗(G)V~Q(G)+∂ρ~λ∗(G)∂εμνV~Q(G)+ρ~λ∗(G)(∂ρ~Q(G)∂εμν+2G2GμGνρ~Q(G))]=2πΩ∑G≠01G2[δμνρλ∗(G)ρ~Q(G)+∂ρ~λ∗(G)∂εμνρ~Q(G)+ρ~λ∗(G)(∂ρ~Q(G)∂εμν+2G2GμGνρ~Q(G))](47)\begin{aligned} \sum_i\lambda_i\sum_j\frac{\partial A_{ij}}{\partial\varepsilon_{\mu\nu}}Q_j=\frac{\partial}{\partial\varepsilon_{\mu\nu}}\int\rho^\lambda(\mathbf{r})V^Q(\mathbf{r})d\mathbf{r}=\frac{\partial}{\partial\varepsilon_{\mu\nu}}2\pi\Omega\sum_{\mathbf{G}\ne0}\rho^{\lambda*}(\mathbf{G})\widetilde{V}^Q(\mathbf{G}) \\ &=2\pi\Omega\sum_{\mathbf{G}\ne0}\left[\delta_{\mu\nu}\rho^{\lambda*}(\mathbf{G})\widetilde{V}^Q(\mathbf{G})+\frac{\partial\widetilde{\rho}^{\lambda*}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}\widetilde{V}^Q(\mathbf{G})+\widetilde{\rho}^{\lambda*}(\mathbf{G})\frac{\partial\widetilde{V}^Q(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}\right] \\ &=2\pi\Omega\sum_{\mathbf{G}\ne0}\left[\delta_{\mu\nu}\rho^{\lambda*}(\mathbf{G})\widetilde{V}^Q(\mathbf{G})+\frac{\partial\widetilde{\rho}^{\lambda*}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}\widetilde{V}^Q(\mathbf{G})+\widetilde{\rho}^{\lambda*}(\mathbf{G})\left(\frac{\partial\widetilde{\rho}^Q(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}+\frac{2}{G^2}G_\mu G_\nu\widetilde{\rho}^Q(\mathbf{G})\right)\right] \\ &=2\pi\Omega\sum_{\mathbf{G}\ne0}\frac{1}{G^2}\left[\delta_{\mu\nu}\rho^{\lambda*}(\mathbf{G})\widetilde{\rho}^Q(\mathbf{G})+\frac{\partial\widetilde{\rho}^{\lambda*}(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}\widetilde{\rho}^Q(\mathbf{G})+\widetilde{\rho}^{\lambda*}(\mathbf{G})\left(\frac{\partial\widetilde{\rho}^Q(\mathbf{G})}{\partial\varepsilon_{\mu\nu}}+\frac{2}{G^2}G_\mu G_\nu\widetilde{\rho}^Q(\mathbf{G})\right)\right] \tag*{(47)} \end{aligned}

References

References

  1. [1]J. Behler, J. Chem. Phys. 145, 170901 (2016).
  2. [2]V. L. Deringer, M. A. Caro, and G. Csányi, Adv. Mater. 31, 1902765 (2019).
  3. [3]F. Noé, A. Tkatchenko, K.-R. Müller, and C. Clementi, Ann. Rev. Phys. Chem. 71, 361 (2020).
  4. [4]O. T. Unke, S. Chmiela, H. E. Sauceda, M. Gastegger, I. Poltavsky, K. T. Schütt, A. Tkatchenko, and K.-R. Müller, Chem. Rev. 121, 10142 (2021).
  5. [5]J. Behler and G. Csányi, Eur. Phys. J. B 94, 142 (2021).
  6. [6]E. Kocer, T. W. Ko, and J. Behler, Ann. Rev. Phys. Chem. 73, 163 (2022).
  7. [7]P. Friederich, F. Häse, J. Proppe, and A. Aspuru-Guzik, Nat. Mater 20, 750 (2021).
  8. [8]K. T. Schütt, H. E. Sauceda, P.-J. Kindermans, A. Tkatchenko, and K.-R. Müller, J. Chem. Phys. 148, 241722 (2018).
  9. [9]J. Behler and M. Parrinello, Phys. Rev. Lett. 98, 146401 (2007).
  10. [10]J. Behler, Chem. Rev. 121, 10037 (2021).
  11. [11]A. P. Bartók, M. C. Payne, R. Kondor, and G. Csányi, Phys. Rev. Lett. 104, 136403 (2010).
  12. [12]A. V. Shapeev, Multiscale Model. Simul. 14, 1153 (2016).
  13. [13]J. S. Smith, O. Isayev, and A. E. Roitberg, Chem. Sci. 8, 3192 (2017).
  14. [14]L. Zhang, J. Han, H. Wang, R. Car, and W. E, Phys. Rev. Lett. 120, 143001 (2018).
  15. [15]R. Drautz, Phys. Rev. B 99, 014104 (2019).
  16. [16]A. P. Thompson, L. P. Swiler, C. R. Trott, S. M. Foiles, and G. J. Tucker, J. Comp. Phys. 285, 316 (2015).
  17. [17]M. G. Darley, C. M. Handley, and P. L. A. Popelier, J. Chem. Theor. Comput. 4, 1435 (2008).
  18. [18]N. Artrith, T. Morawietz, and J. Behler, Phys. Rev. B 83, 153101 (2011).
  19. [19]T. Morawietz, V. Sharma, and J. Behler, J. Chem. Phys. 136, 064103 (2012).
  20. [20]K. Yao, J. E. Herr, D. W. Toth, R. Mckintyre, and J. Parkhill, Chem. Sci. 9, 2261 (2018).
  21. [21]O. T. Unke and M. Meuwly, J. Chem. Theory Comput. 15, 3678 (2019).
  22. [22]T. W. Ko, J. A. Finkler, S. Goedecker, and J. Behler, Acc. Chem. Res. 54, 808 (2021).
  23. [23]A. K. Rappe and W. A. Goddard III, The Journal of Physical Chemistry 95, 3358 (1991).
  24. [24]A. Nakano, Computer Physics Communications 104, 59 (1997).
  25. [25]E. Caldeweyher, S. Ehlert, A. Hansen, H. Neugebauer, S. Spicher, C. Bannwarth, and S. Grimme, The Journal of Chemical Physics 150, 154122 (2019), https://pubs.aip.org/aip/jcp/articlepdf/doi/10.1063/1.5090222/15559428/154122_1_online.pdf.DOI
  26. [26]G. L. Warren, J. E. Davis, and S. Patel, The Journal of Chemical Physics 128, 144110 (2008), https://pubs.aip.org/aip/jcp/articlepdf/doi/10.1063/1.2872603/13958756/144110_1_online.pdf.DOI
  27. [27]D. Ongari, P. G. Boyd, O. Kadioglu, A. K. Mace, S. Keskin, and B. Smit, Journal of Chemical Theory and Computation 15, 382 (2019), pMID: 30419163, https://doi.org/10.1021/acs.jctc.8b00669.
  28. [28]A. C. T. van Duin, S. Dasgupta, F. Lorant, and W. A. Goddard, The Journal of Physical Chemistry A 105, 9396 (2001), https://doi.org/10.1021/jp004368u.
  29. [29]J. Yu, S. B. Sinnott, and S. R. Phillpot, Phys. Rev. B 75, 085311 (2007).
  30. [30]A. P. Thompson, H. M. Aktulga, R. Berger, D. S. Bolintineanu, W. M. Brown, P. S. Crozier, P. J. in ’t Veld, A. Kohlmeyer, S. G. Moore, T. D. Nguyen, R. Shan, M. J. Stevens, J. Tranchida, C. Trott, and S. J. Plimpton, Comp. Phys. Comm. 271, 108171 (2022).
  31. [31]S. A. Ghasemi, O. Hofstetter, S. Saha, and S. Goedecker, Phys. Rev. B 92, 045131 (2015).
  32. [32]S. Faraji, S. A. Ghasemi, S. Rostami, R. Rasoulkhani, B. Schaefer, S. Goedecker, and M. Amsler, Phys. Rev. B 95, 104105 (2017).
  33. [33]E. R. Khajehpasha, J. A. Finkler, T. D. Kühne, and S. A. Ghasemi, Phys. Rev. B 105, 144106 (2022).
  34. [34]T. W. Ko, J. A. Finkler, S. Goedecker, and J. Behler, Nature Communications 12, 398 (2021).
  35. [35]T. Zubatyuk and O. Isayev, Accounts of Chemical Research 54, 1575 (2021), pMID: 33715355, https://doi.org/10.1021/acs.accounts.0c00868.
  36. [36]R. Zubatyuk, J. S. Smith, B. T. Nebgen, S. Tretiak, and O. Isayev, Nature Communications 12, 4870 (2021).
  37. [37]X. Xie, K. A. Persson, and D. W. Small, Journal of Chemical Theory and Computation 16, 4256 (2020), pMID: 32502350, https://doi.org/10.1021/acs.jctc.0c00217.
  38. [38]L. D. Jacobson, J. M. Stevenson, F. Ramenzanghorbani, D. Ghoreishi, K. Leswing, E. D. Harder, and R. Abel, Journal of Chemical Theory and Computation 18, 2354 (2022), pMID: 35290063, https://doi.org/10.1021/acs.jctc.1c00821.
  39. [39]C. G. Staacke, S. Wengert, C. Kunkel, G. Csányi, K. Reuter, and J. T. Margraf, Mach. Learn. Sci. Techn. 3, 015032 (2022).
  40. [40]D. Anstine, R. Zubatyuk, and O. Isayev, ChemRxiv (2023).
  41. [41]D. P. Metcalf, A. Jiang, S. A. Spronk, D. L. Cheney, and C. D. Sherrill, J. Chem. Inf. Model. 61, 115– (2021).
  42. [42]S. Rostami, M. Amsler, and S. A. Ghasemi, The Journal of Chemical Physics 149, 124106 (2018), https://pubs.aip.org/aip/jcp/articlepdf/doi/10.1063/1.5040005/15546899/124106_1_online.pdf.DOI
  43. [43]P. P. Poier, L. Lagardère, J.-P. Piquemal, and F. Jensen, Journal of Chemical Theory and Computation 15, 6213 (2019), pMID: 31557014, https://doi.org/10.1021/acs.jctc.9b00721.
  44. [45]O. H. Nielsen and R. M. Martin, Phys. Rev. B 32, 3780 (1985).
  45. [46]J. Behler, Int. J. Quantum Chem. 115, 1032 (2015).
  46. [47]J. Behler, Angew. Chem. Int. Ed. 56, 12828 (2017).

Paper details

vlnc:W_p5nrfget
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents