Skip to main content
The Journal of Chemical Physics logoLink to The Journal of Chemical Physics
. 2012 Mar 20;136(11):114112. doi: 10.1063/1.3694829

Ewald mesh method for quantum mechanical calculations

Chun-Min Chang 1,a), Yihan Shao 1, Jing Kong 1,a)
PMCID: PMC3321048  PMID: 22443753

Abstract

The Fourier transform Coulomb (FTC) method has been shown to be effective for the fast and accurate calculation of long-range Coulomb interactions between diffuse (low-energy cutoff) densities in quantum mechanical (QM) systems. In this work, we split the potential of a compact (high-energy cutoff) density into short-range and long-range components, similarly to how point charges are handled in the Ewald mesh methods in molecular mechanics simulations. With this linear scaling QM Ewald mesh method, the long-range potential of compact densities can be represented on the same grid as the diffuse densities that are treated by the FTC method. The new method is accurate and significantly reduces the amount of computational time on short-range interactions, especially when it is compared to the continuous fast multipole method.

INTRODUCTION

Despite the conceptual difference in electrons between the molecular mechanics1 (MM) and quantum mechanical2 (QM) simulations, there is a common computational task which both need to solve efficiently: the calculation of Coulomb interactions. Because of its long range, this term is often the computational bottleneck in both simulations. To calculate the long-range Coulomb interactions efficiently, several linear scaling methods are available for MM simulations, such as the fast multipole method (FMM),3 the multilevel summation method,4 and the fast Fourier transform (FFT)-based algorithm (which includes the particle mesh Ewald (PME) method,5 the fast Fourier-Poisson method,6 etc). These algorithms can also be adapted to calculate Coulomb interactions in QM simulations.

In the FMM, point charges are partitioned into different regions. The long-range interactions between two regions which are beyond the nearest neighbors are approximated with multipole expansions. The short-range interactions between two charges in the same or the nearest regions, on the other hand, need to be calculated exactly. This method is very efficient and has O(N) scaling. (N is the number of point charges.) In QM simulations, the point charges become probability densities multiplied by the prefactors of their angular momenta. The continuous fast multipole method7, 8 (CFMM) is an adaptation from the FMM for the interactions between Gaussian charge distributions. However, if some electron densities are diffuse (low-energy cutoff) and very extensive in space, the number of short-range interactions are dramatically increased by this method. In fact, for a typical CFMM calculation, the total computational time is usually dominated by the calculation of short-range interactions through the use of, for example, the J engine method.9, 10, 11 This problem is more severe if the atomic basis set contains many diffuse Gaussian basis functions.12

The Fourier transform Coulomb (FTC) method, an FFT-based algorithm for QM simulation is able to calculate the Coulomb interactions between diffuse densities with high accuracy and efficiency.13, 14, 15 However, the FTC method is in general not appropriate for compact (high-energy cutoff) densities, because they cannot be represented faithfully on regular Cartesian grids unless an impractically high grid density is used. A combination of the CFMM (which calculates the interactions with compact densities very efficiently), the FTC method (which calculates the interactions between diffuse densities very efficiently) and the J engine method (which calculates the short-range interactions), is one of the most efficient approaches for Coulomb calculations in QM simulations.12 Our recent method, “multiresolution exchange-correlation (mrXC)”, also separates the electron density into the diffuse and the compact parts, and it speeds up the numerical integration of the DFT exchange-correlation potential by several times without significant error.19, 20, 21, 22

A more efficient way is to employ an FFT-based Ewald method in QM simulations instead of the CFMM for the interactions with compact densities. By following the idea of the Gaussian electrostatic model,16 we use Hermite-Gaussian23 functions as our density basis and replace each compact density with a diffuse screening charge density. The diffuse Hermite-Gaussian density function is chosen to have the same multipole moments as the compact one (see Appendix). In this way, they generate the long-range part of the Coulomb potential identically so that only the short-range interactions are required to be corrected through the J engine method.

In Sec. 2, we provide the details of an Ewald mesh method for Coulomb interactions in QM simulations and a description of its implementation. The results which demonstrate its computational efficiency in Coulomb calculations are shown in Sec. 3. Since the long-range part of the Coulomb potential can be treated by the Ewald mesh algorithm in both QM and MM systems, a possible application of this method to QM/MM simulations is also discussed.

THEORY AND IMPLEMENTATION

Let us first define the basis pair density ρμν as the product of two basis functions ϕμ and ϕν

ρμν(r)=ϕμ(r)ϕν(r). (1)

The total electron density ρ(r) of the QM system is expressed as

ρ(r)=μνPμνρμν(r), (2)

where Pμν is an element of the atomic orbital density matrix. The Coulomb potential V(r) from the electronic charges is

V(r)=ρ(r)rrdr, (3)

or from the Poisson equation

2V(r)=ρ(r). (4)

The contribution from the electron repulsive interactions to the Fock matrix is

Jμν=Ωρμν(r)V(r)dr, (5)

and the energy of electron-electron interactions is

Eee=Ωdrdrρ(r)1rrρ(r)ρ|ρ=μvλσPμvPλσρμv|ρλσ. (6)

For the FTC method, the densities of basis function pair ρμν are classified into compact (ρc) and diffuse (ρd) types, where ρd represents |DD〉 pairs and ρc represents all the other pairs. (See Refs. 12 and 13 for the classification of |DD〉 pairs.) The two-electron Coulomb integrals ρμν|ρλσ in Eq. 6 fall into three different types

ρc|ρc,ρc|ρd,ρd|ρd. (7)

The FTC method spreads the diffuse charge density on regular Cartesian grids. By performing an FFT, the density is transformed to reciprocal space. Solving the Poisson equation in reciprocal space and inverse FFT back to real space, we obtain the Coulomb potential on a real space grid. The last type of the integrals in Eq. 7, which contains the largest amount of Coulomb interactions, is evaluated by the FTC method. Part of the second type, CD|DD, can also be calculated by the FTC method through a special screening procedure.12 In this paper, we use the FTC method for the last type of integrals only.

Since the first two types of integrals involve compact densities, they cannot be represented accurately on grids. We adopt the idea of the Ewald method in MM simulations to calculate these integrals. Namely, a diffuse charge distribution with the same set of multipole moments is used to replace the compact density so that their long-range electrostatic potentials are identical. As a result, we only need to correct the short-range interactions.

In order to retain the same multipole moments, it is convenient to use Hermite-Gaussian functions Glmn(α, r) as our basis functions for the compact density16, 17 since their expanded multiple moments are independent of the Gaussian exponent (see Appendix)

Glmnαi,r=αiπ32l+m+nxilyimzineαi(rri)2, (8)

where ri is the center of the ith compact density and αi is the Gaussian exponent. After the transformation from Cartesian to Hermite polynomials, the compact density ρc becomes a linear combination of the Hermite-Gaussians and we replace it with a screening charge distribution by changing αi to a diffuse exponent αs

Glmnαi,rGlmnαs,r. (9)

The screening density ρs (made from the combination of the diffuse Hermite-Gaussians) can be evaluated on the grids and the corresponding interactions ρs|ρs, ρd|ρs, and ρs|ρd are calculated by the FTC method. The first two types of Coulomb integrals in Eq. 7 become

ρc|ρc=ρs|ρs̲ Long Range +ρc|ρcρs|ρs̲ Short Range ,ρc|ρd=ρs|ρd̲ Long Range +ρc|ρdρs|ρd̲ Short Range . (10)

Since ρc and ρs have the same multipole moments and generate identical long-range potentials, the last two terms of the short-range interactions cancel out each other if the interacting densities in the last integral are sufficiently far away. Both the density distribution in Eq. 8 and the short-range Coulomb potential decay equivalently and exponentially as the distance to the center ri increases (see Appendix). The density range |rri| is defined when the absolute value of the density decreases to a certain threshold. Only when the two densities are close enough to have an overlap in their distributions, the last two interactions in Eq. 10 need to be considered. If they have a significant contribution, we use the J engine method to evaluate the corrections. This is the quantum Ewald mesh (QEM) method.

RESULTS AND DISCUSSIONS

We implemented the above QEM method within a development version of the quantum chemistry program Q-Chem.2 We computed the Coulomb energy of Taxol (C47NO14H51), a cancer drug molecule, and carbon clusters in the diamond structure for one SCF cycle.

Table 1 shows the CPU times to evaluate the Coulomb matrix in one SCF cycle and the Coulomb energy errors for Taxol by four different methods: (1) J engine: Use the J engine method to calculate four-center integrals of electron-electron interactions analytically. It scales as O(N4). (2) CFMM: Use the CFMM and the J engine method for the calculation of the long-range and the short-range interactions, respectively, where the CFMM represents a generalization of Greengard's fast multipole method for continuously charged densities.8 (3) FTC + CFMM: Use the FTC method to calculate the interactions ρd|ρd,12 where the grid density is 3.8 per bohr. The CFMM and the J engine method, respectively, calculate the long-range and the short-range parts of the interactions ρc|ρd and ρc|ρc. (4) FTC + QEM: It is almost the same as FTC + CFMM but we use the QEM method to replace the CFMM for the long-range interactions. The threshold to consider the short-range interactions in Eq. 10 is 10−10 and the threshold of density range is 10−7 (for both Taxol and carbon clusters). The Gaussian basis sets, Pople's 6-311G+(d,p), 6-311G(df,pd) and Dunning's correlation consistent cc-pVDZ, cc-pVTZ are used. It is demonstrated that the Coulomb energies are very accurate, with errors lower than 5 μ Hartree for all of the methods. The variations in the calculation times with the number of the basis shells are shown in Fig. 1.

Table 1.

Accuracy and computational timings on evaluating the Coulomb matrix in one SCF cycle with the different basis sets and methods for the molecule Taxol (113 atoms). (See the text for details.)

Method
CPU Time (seconds)
Error
Short-range Long-range J Engine CFMM FTC Total (μ hartree)
cc-pVDZ 525 shells and 1123 basis functions  
J engine 1353.64     1353.64  
J engine CFMM 537.34 13.96   551.30 0.0491
J engine FTC + CFMM 248.57 23.21 42.99 314.77 0.1583
J engine FTC + QEM 144.99   62.80 207.79 0.1451
6-311+G(d,p) 576 shells and 1670 basis functions  
J engine 1574.94     1574.94  
J engine CFMM 1137.85 10.50   1148.35 −0.1906
J engine FTC + CFMM 444.58 17.20 102.35 564.13 −0.1837
J engine FTC + QEM 235.69   123.83 359.52 −0.2287
6-311G(df,pd) 627 shells and 2111 basis functions  
J engine 2089.82     2089.82  
J engine CFMM 1032.72 10.01   1042.73 0.0360
J engine FTC + CFMM 379.96 15.38 44.73 440.07 0.5976
J engine FTC + QEM 136.92   60.10 197.02 0.7887
cc-pVTZ 926 shells and 2574 basis functions  
J engine 12878.68     12878.68  
J engine CFMM 7582.00 18.87   7600.87 −0.0260
J engine FTC + CFMM 1807.14 25.32 99.04 1931.50 −1.3347
J engine FTC + QEM 597.43   136.84 734.27 −2.6564

Figure 1.

Figure 1

Comparison of computational timings on evaluating the Coulomb matrix in one SCF cycle with the different basis sets and methods for the molecule Taxol (113 atoms). (See the text for details.)

As we can see in Table 1, with all of the basis sets, the new QEM method is the most efficient for electron repulsive interactions. Even though screening charge densities (for compact densities) are added to the FTC treatment by the method, it takes small amount of the time to evaluate them on the grid. The additional times on long-range interaction are about the same as the CFMM times in the FTC + CFMM method. In fact, the computational time of long-range interactions is not the most expensive. The short-range interactions (treated by the J-engine method) dominate the CPU time on Coulomb interactions in all methods. Since the short-range corrections in Eq. 10 do not need to be computed explicitly if they are smaller than the threshold, the QEM method dramatically reduces the number of four-center integrals handled by the J-engine method.

More significant time saving can be seen in Fig. 2. The calculation times of Coulomb interactions with the cc-pVTZ basis set (in one SCF cycle) are shown for the carbon clusters of 50, 92, 141, and 191 atoms arranged in the diamond structure. This basis set which has more diffuse Gaussian functions leads to many diffuse densities in the system. The figure shows that the QEM method achieves the best performance among the methods, and exhibits linear scaling as the number of the atoms increases. In particular, FTC + QEM with the J-engine performs two times faster than FTC + CFMM with J-engine. Although both the CFMM and the QEM method achieve linear scaling while using the expensive J-engine method only on the short-range interactions, the former yields more short-range interactions due to a different definition of the charge density range. The CFMM separates the system with partitioned cubic regions as the FMM (for the short-range and the long-range interactions). The range of a charge density is considered the smallest cubic regions which can enclose the density range defined by the QEM. This results in a larger extent for possible short-range interactions.

Figure 2.

Figure 2

Comparison of computational timings on evaluating the Coulomb matrix in one SCF cycle by four different methods for the carbon clusters in the diamond structure. (See the text for details.)

We expect that the QEM method can be effectively applied to QM/MM simulations if an Ewald mesh method is also used for the Coulomb interaction of the MM subsystem. Since both QM and MM subsystems have the long-range parts of the Coulomb potentials on their own grid systems, we can find an efficient method to transfer the grid information between each other directly. In general, the MM subsystem is a larger system with a lower grid density than the QM subsystem. The screening functions to replace point charges are more diffuse. Therefore, it is rather straightforward to obtain the long-range part of MM potential at each QM grid point by interpolation.

When passing QM Coulomb information to the MM subsystem, we can use the idea of the Gaussian split Ewald method to perform an on-mesh convolution of the QM density with an MM diffuse Gaussian function.18 In this way, the QM total density is diffused and spread onto the MM grid system. Once both subsystems have the long-range Coulomb information of each other, we only need to correct the short-range interactions to derive the total interaction. If the QM grid density is an integer scaling of the MM grid density, the overall computational cost of this scheme can even be much less.

CONCLUSIONS

A QM Ewald method is proposed to compute the Coulomb matrix in a Hartree-Fock or DFT calculation. The pair densities are categorized into compact and diffuse types. In the FTC treatment, we use diffuse screening densities to replace compact ones and build them together with normal diffuse densities on a grid system. The long-range Coulomb interactions are calculated through an FFT-based algorithm and the short-range interactions are computed by the J-engine method. The computational results are compared with other methods and the QEM method shows the best efficiency with very good accuracy. The future extension of the method to QM/MM simulations is also discussed.

ACKNOWLEDGMENT

This work was supported by the National Institutes of Health (Grant No. R43GM086987). The authors wish to thank Dr. Bernard Brooks, Dr. Milan Hodoscek, and Dr. Alex Sodt for helpful discussions.

APPENDIX: MULTIPOLE MOMENTS OF HERMITE-GAUSSIAN FUNCTIONS

The multipole moments of a charge density can be expanded by solid spherical harmonics rlYlm(θ, ϕ), Cartesian polynomials xlymzn, or Hermite polynomials Hl(x)Hm(y)Hn(z). Here, we will prove that the expanded multipole moments of a function Glmn(α, r) in Eq. 8 are independent of the Gaussian exponent α, i.e., that the Hermite-Gaussian charge density has the same multipole moments for any α value.

From Eq. 8, a Hemite-Gaussian function at the origin is expressed as

Glmnα,r=απ32l+m+nxlymzneαr2=απ32αl+m+n2Hl(αx)Hm(αy)Hn(αz)eαr2. (A1)

To calculate the multipole expansions of a Hermite-Gaussian charge density, we project it onto a set of Cartesian polynomials xlymzn. Since the Hermite-Gaussian of order l + m + n can be expanded in a solid spherical harmonic expansion of the same and lower orders,16, 17 we have l′ + m′ + n′l + m + n. The projection onto the component xlymzn is

plmn=xlymznGlmnα,rdr=απ32αl+m+n2xlHl(αx)eαx2dx×ymHm(αy)eαy2dyznHn(αz)eαz2dz=1π32αl+m+n(l+m+n)2xlHl(x)ex2dx×ymHm(y)ey2dyznHn(z)ez2dz. (A2)

Since the integral tiHi(t)et2dt is nonzero only if i′ ≥ i, with the limitation l′ + m′ + n′ ≤ l + m + n, the projection gives

plmn=l!n!m!δllδmmδnn, (A3)

which is independent of the Gaussian exponent α.

An alternative proof is to look into the potential generated by a Hermite-Gaussian charge density. From Eq. 8, we have

V(r)=Glmn(α,r)rrdr=απ32l+m+nxilyimzineα(rri)2rrdr=l+m+nxilyimzin erf (αrri)rri, (A4)

where the potential of a Gaussian charge distribution is widely known from PME methodology. The potential at a position with a relative displacement r to the center of the charge density (for ri = 0) is

V(r)=l+m+nxlymzn1r erfc (αr)r=l+m+nxlymzn1rl+m+nxlymzn×eαr2παr2i=0(1)i(2i1)!!(2αr2)i,αr1, (A5)

where the asymptotic expansion for the complementary error function is applied in the last term of the equation. The last term is short-range and decays exponentially as the distance r increases. Only the first term behaves as the potential from a point source of multipole moments. It is independent of the Gaussian exponent α.

References

  1. Karplus M. and McCammon J. A., Nat. Struct. Biol. 9, 646 (2002). 10.1038/nsb0902-646 [DOI] [PubMed] [Google Scholar]
  2. Shao Y. et al. , Phys. Chem. Chem. Phys. 8, 3172 (2006). 10.1039/b517914a [DOI] [PubMed] [Google Scholar]
  3. Beatson R. and Greengard L., “A short course on fast multipole methods,” in Wavelets, Multilevel Methods and Elliptic PDEs (Oxford University Press, 1997), p. 1. [Google Scholar]
  4. Skeel R. D., Tezcan Ismail, and Hardy D. J., J. Comput. Chem. 23, 673 (2002). 10.1002/jcc.10072 [DOI] [PubMed] [Google Scholar]
  5. Essmann U. et al. , J. Chem. Phys. 103, 8577 (2005). 10.1063/1.470117 [DOI] [Google Scholar]
  6. York D. and Yang W., J. Chem. Phys. 101, 3298 (1994). 10.1063/1.467576 [DOI] [Google Scholar]
  7. White C. A., Johnson B. G., Gill P. M. W., and Head-Gordon M., Chem. Phys. Lett. 230, 18 (1994). 10.1016/0009-2614(94)01128-1 [DOI] [Google Scholar]
  8. White C. A., Johnson B. G., Gill P. M. W., and Head-Gordon M., Chem. Phys. Lett. 253, 268 (1996). 10.1016/0009-2614(96)00175-3 [DOI] [Google Scholar]
  9. White C. A. and Head-Gordon M., J. Chem. Phys. 104, 2620 (1996). 10.1063/1.470986 [DOI] [Google Scholar]
  10. Shao Y. and Head-Gordon M., Chem. Phys. Lett. 323, 425 (2000). 10.1016/S0009-2614(00)00524-8 [DOI] [Google Scholar]
  11. Shao Y., White C. A., and Head-Gordon M., J. Chem. Phys. 114, 6572 (2001). 10.1063/1.1357441 [DOI] [Google Scholar]
  12. Füsti-Molnár L. and Kong J., J. Chem. Phys. 122, 074108 (2005). 10.1063/1.1849168 [DOI] [PubMed] [Google Scholar]
  13. Füsti-Molnár L. and Pulay P., J. Chem. Phys. 117, 7827 (2002). 10.1063/1.1510121 [DOI] [Google Scholar]
  14. Füsti-Molnár L., J. Chem. Phys. 119, 11080 (2003). 10.1063/1.1622922 [DOI] [Google Scholar]
  15. Füsti-Molnár L. and Pulay P., J. Mol. Struct.: THEOCHEM 666, 25 (2003). 10.1016/j.theochem.2003.08.114 [DOI] [Google Scholar]
  16. Cisneros G. A., Piquemal J.-P., and Darden T. A., J. Chem. Phys. 125, 184101 (2006). 10.1063/1.2363374 [DOI] [PMC free article] [PubMed] [Google Scholar]
  17. Arfken G. and Weber H., Mathematical Methods for Physicists (Academic, San Diego, CA, 1996). [Google Scholar]
  18. Shan Y. et al. , J. Chem. Phys. 122, 054101 (2005). 10.1063/1.1839571 [DOI] [Google Scholar]
  19. Chang C.-M., Ross N. J., and Kong J., Phys. Rev. A 84, 022504 (2011). 10.1103/PhysRevA.84.022504 [DOI] [Google Scholar]
  20. Ross N. J., Chang C.-M., and Kong J., Can. J. Chem. 89, 657 (2011). 10.1139/v11-063 [DOI] [Google Scholar]
  21. Kong J., Brown S. T., and Füsti-Molnár L., J. Chem. Phys. 124, 094109 (2006). 10.1063/1.2173244 [DOI] [PubMed] [Google Scholar]
  22. Brown S. T., Füsti-Molnár L., and Kong J., Chem. Phys. Lett. 418, 490 (2006). 10.1016/j.cplett.2005.10.098 [DOI] [Google Scholar]
  23. Živković T. and Maksić Z. B., J. Chem. Phys. 49, 3083 (1968). 10.1063/1.1670551 [DOI] [Google Scholar]

Articles from The Journal of Chemical Physics are provided here courtesy of American Institute of Physics

RESOURCES