Construction of the two-electron contribution to the Fock matrix by numerical integration

11
This article was downloaded by: [University Of Maryland] On: 18 October 2014, At: 03:06 Publisher: Taylor & Francis Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House, 37-41 Mortimer Street, London W1T 3JH, UK Molecular Physics: An International Journal at the Interface Between Chemistry and Physics Publication details, including instructions for authors and subscription information: http://www.tandfonline.com/loi/tmph20 Construction of the two-electron contribution to the Fock matrix by numerical integration Sergio A. Losilla a , Mooses M. Mehine a & Dage Sundholm a a Department of Chemistry , University of Helsinki , A.I. Virtanens plats 1, FIN-00014 Helsinki , Finland Accepted author version posted online: 17 Aug 2012.Published online: 17 Sep 2012. To cite this article: Sergio A. Losilla , Mooses M. Mehine & Dage Sundholm (2012) Construction of the two-electron contribution to the Fock matrix by numerical integration, Molecular Physics: An International Journal at the Interface Between Chemistry and Physics, 110:19-20, 2569-2578, DOI: 10.1080/00268976.2012.720725 To link to this article: http://dx.doi.org/10.1080/00268976.2012.720725 PLEASE SCROLL DOWN FOR ARTICLE Taylor & Francis makes every effort to ensure the accuracy of all the information (the “Content”) contained in the publications on our platform. However, Taylor & Francis, our agents, and our licensors make no representations or warranties whatsoever as to the accuracy, completeness, or suitability for any purpose of the Content. Any opinions and views expressed in this publication are the opinions and views of the authors, and are not the views of or endorsed by Taylor & Francis. The accuracy of the Content should not be relied upon and should be independently verified with primary sources of information. Taylor and Francis shall not be liable for any losses, actions, claims, proceedings, demands, costs, expenses, damages, and other liabilities whatsoever or howsoever caused arising directly or indirectly in connection with, in relation to or arising out of the use of the Content. This article may be used for research, teaching, and private study purposes. Any substantial or systematic reproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in any form to anyone is expressly forbidden. Terms & Conditions of access and use can be found at http:// www.tandfonline.com/page/terms-and-conditions

Transcript of Construction of the two-electron contribution to the Fock matrix by numerical integration

Page 1: Construction of the two-electron contribution to the Fock matrix by numerical integration

This article was downloaded by: [University Of Maryland]On: 18 October 2014, At: 03:06Publisher: Taylor & FrancisInforma Ltd Registered in England and Wales Registered Number: 1072954 Registered office: Mortimer House,37-41 Mortimer Street, London W1T 3JH, UK

Molecular Physics: An International Journal at theInterface Between Chemistry and PhysicsPublication details, including instructions for authors and subscription information:http://www.tandfonline.com/loi/tmph20

Construction of the two-electron contribution to theFock matrix by numerical integrationSergio A. Losilla a , Mooses M. Mehine a & Dage Sundholm aa Department of Chemistry , University of Helsinki , A.I. Virtanens plats 1, FIN-00014Helsinki , FinlandAccepted author version posted online: 17 Aug 2012.Published online: 17 Sep 2012.

To cite this article: Sergio A. Losilla , Mooses M. Mehine & Dage Sundholm (2012) Construction of the two-electroncontribution to the Fock matrix by numerical integration, Molecular Physics: An International Journal at the InterfaceBetween Chemistry and Physics, 110:19-20, 2569-2578, DOI: 10.1080/00268976.2012.720725

To link to this article: http://dx.doi.org/10.1080/00268976.2012.720725

PLEASE SCROLL DOWN FOR ARTICLE

Taylor & Francis makes every effort to ensure the accuracy of all the information (the “Content”) containedin the publications on our platform. However, Taylor & Francis, our agents, and our licensors make norepresentations or warranties whatsoever as to the accuracy, completeness, or suitability for any purpose of theContent. Any opinions and views expressed in this publication are the opinions and views of the authors, andare not the views of or endorsed by Taylor & Francis. The accuracy of the Content should not be relied upon andshould be independently verified with primary sources of information. Taylor and Francis shall not be liable forany losses, actions, claims, proceedings, demands, costs, expenses, damages, and other liabilities whatsoeveror howsoever caused arising directly or indirectly in connection with, in relation to or arising out of the use ofthe Content.

This article may be used for research, teaching, and private study purposes. Any substantial or systematicreproduction, redistribution, reselling, loan, sub-licensing, systematic supply, or distribution in anyform to anyone is expressly forbidden. Terms & Conditions of access and use can be found at http://www.tandfonline.com/page/terms-and-conditions

Page 2: Construction of the two-electron contribution to the Fock matrix by numerical integration

Molecular PhysicsVol. 110, Nos. 19–20, October 2012, 2569–2578

INVITED ARTICLE

Construction of the two-electron contribution to the Fock matrix by numerical integration

Sergio A. Losilla*, Mooses M. Mehine and Dage Sundholm

Department of Chemistry, University of Helsinki, A.I. Virtanens plats 1, FIN-00014 Helsinki, Finland

(Received 27 March 2012; final version received 8 August 2012)

A novel method to numerically calculate the Fock matrix is presented. The Coulomb operator is re-expressed asan integral identity, which is discretized. The discretization of the auxiliary t dimension separates the x, y, and zdependencies transforming the two-electron Coulomb integrals of Gaussian-type orbitals (GTO) to a linear sumof products of two-dimensional integrals. The s-type integrals are calculated analytically and integrals of thehigher angular-momentum functions are obtained using recursion formulae. The contributions to the two-bodyCoulomb integrals obtained for each discrete t value can be evaluated independently. The two-body Fock matrixelements can be integrated numerically, using common sets of quadrature points and weights. The aim is tocalculate Fock matrices of enough accuracy for electronic structure calculations. Preliminary calculationsindicate that it is possible to achieve an overall accuracy of at least 10�12 Eh using the numerical approach.

Keywords: Fock matrix; two-electron integrals; numerical integration

1. Introduction

The first step in Hartree–Fock (HF) and Kohn–Sham

(KS) calculations is to construct the corresponding

Fock matrix. The most time-consuming step of the

Fock-matrix construction is to gather the two-body

contribution, which involves contractions of two-body

integrals with the one-particle density matrix. The two-

body contributions to the matrix elements of the Fock

matrix (F) are obtained as

Fpq ¼XNr

XNs

Drs gpqrs �1

2gprqs

� �, ð1Þ

where N is the size of the one-particle basis set, D is the

one-particle density matrix, and gpqrs are the two-

electron integrals. Efficient algorithms can be formu-

lated when the Fock matrix is constructed in the

atomic orbital (AO) basis using Gaussian-type orbitals

(GTO) [1], because computation of the GTO integrals

using modern algorithms is relatively fast and the

formal scaling of N4 can be reduced by omitting tiny

contributions. The GTO basis functions, �p(r), are

defined as a product of the GTO functions in the three

Cartesian directions (x, y, and z)

�pðrÞ ¼ Npxlpxp y

lpyp z

lpzp e��pr

2p , ð2Þ

where rp¼ (xp, yp, zp)¼ (x�Xp, y�Yp, z�Zp), Rp¼

(Xp,Yp,Zp) are the Cartesian coordinates of the

centre of the pth basis function, �p is the exponent,and lp ¼ l px þ l py þ l pz represents the total angularmomentum, and Np is a normalization constant.

The construction of the Fock matrix can be doneefficiently by exploiting prescreening, that is, byidentifying vanishingly small terms using approximatevalues for the two-electron integrals as well as byassessing their contribution to the Fock matrix byusing one-particle density-matrix elements and differ-ences between the elements of subsequential one-particle density matrices in the iterative solution ofthe HF and KS equations [2–5]. In the successful semi-direct strategy, the most important integrals arecalculated and stored, whereas some of the less crucialones are recalculated, when they are needed [2,3,6]. Thediagonalization of the Fock matrix scales as N3 with asmall prefactor, which for very large one-particle basissets becomes the rate-determining step that has to beavoided. The formal computational costs can thoughbe made to approach linear scaling for large molecules[4,5,7–10].

The second limitation appearing in large-scale HFand KS calculations is the computational speed of asingle processor, which is approaching the upper limitof silicon-based computer technology. Thus, to achievea faster computational throughput, computations mustbe done in parallel [11,12]. Massively parallel calcula-tions using a huge number of processors (CPU) orgeneral purpose graphical processing units (GPGPU)

*Corresponding author. Email: [email protected]

ISSN 0026–8976 print/ISSN 1362–3028 online

� 2012 Taylor & Francis

http://dx.doi.org/10.1080/00268976.2012.720725

http://www.tandfonline.com

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 3: Construction of the two-electron contribution to the Fock matrix by numerical integration

require modifications of the algorithms to reducecommunications between the CPUs and the GPGPUs[13,14]. Efficient calculations on the GPGPUs mightrequire additional simplifications of the algorithms.One of the bottlenecks of the Fock-matrix constructionis the calculation of a large number of two-electronintegrals, which might contribute to practically allelements of the Fock matrix.

In this work, we present a novel method forconstructing the two-electron contribution to theFock matrix by numerical integration. Owing to thenumerical integration approach, the six-dimensionaltwo-electron integrals separate into products of two-dimensional integrals, which are easily calculatedanalytically. The corresponding integrals over higherangular-momentum functions can be obtained usingrecursion formulae. The numerical integration grid,the separation of the integrals, and the simpleexpressions for calculating the integrals render themethod well suited for massively parallel computerarchitectures.

The paper is organized as follows. In Section 2, themain ideas of the numerical approach are presented.Section 3 contains a more detailed description of thealgorithm including recursion relations for obtainingtwo-electron integrals of higher angular-momentumfunctions. The numerical quadrature and the choice ofintegration grid points are discussed in Section 4. InSection 5, we demonstrate the accuracy of the devel-oped numerical approach. The computational costs areexplored in Section 6. The applicability and a futureoutlook of the presented computational approach arediscussed in Section 7.

2. Construction of the two-body contribution to the

Fock matrix

The two-electron Coulomb integrals of electronicstructure calculations are given by

gpqrs ¼

Z Z�pðr1Þ�qðr1Þ

1

r12�rðr2Þ�sðr2Þd

3r1 d3r2: ð3Þ

In efficient calculations of two-electron integrals formolecular systems, the Coulomb operator is recastusing the standard integral expansion [15–20]:

1

r12¼

2

p1=2

Z 10

e�t2r2

12 dt: ð4Þ

The identity in Equation (4) has been used as a meansto produce effective analytical expressions for calcu-lating the gpqrs integrals when GTO are employed asbasis functions [15–20]. The same integral transforma-tion is also used and discretized in the direct

integration approach for electronic structure calcula-tions and for calculating electrostatic potentials numer-ically using finite-element functions or wavelets as localbasis functions [21–26]. Here, we exploit the separa-bility of the integrand when combining the integralform of the 1/r12 operator with GTO basis functionsand performing numerical integration in the auxiliary tdirection. The expression for the numerical integrationof the two-electron integrals is

gpqrs ¼Xk

!k ~gpqrsðtkÞ þ C1pqrsðtfÞ: ð5Þ

The first term in Equation (5) corresponds to thecontributions from each grid point, ~gpqrsðtkÞ, whereasthe second term contains the analytical contributionobtained by integrating from the end of the quadratureinterval to infinity. The quadrature points are denotedtk with tf as the t value at the end of the quadratureinterval. With the definitions

GpqðtkÞ ¼Xr

Xs

Drs!k ~gpqrsðtkÞ �1

2~gprqsðtkÞ

� �, ð6Þ

and

G1pqðtfÞ ¼Xr

Xs

Drs C1pqrsðtf Þ �1

2C1prqsðtf Þ

� �, ð7Þ

the Fock matrix can be computed as:

Fpq ¼Xk

GpqðtkÞ þ G1pqðtfÞ: ð8Þ

The quadrature used in the present approachsignificantly differs from the Rys method [15]. In Rysquadrature, the grid points and the integrationweights for the individual two-electron integrals arechosen such that the exact value of the integral isobtained. Here, we use a larger number of fixed gridpoints and integration weights for all integrals. Thus,the present quadrature does not provide exact ana-lytical values for the integrals. However, the errorscan be made negligibly small for electronic structurecalculations, as shown in Section 5. The mainadvantage with common grid points and integrationweights is that the quadrature provides a new indexthat can be used for distributing the computationaltask to processors that compute in parallel. Theexpression for the construction of the two-electroncontribution to the Fock matrix is shown inEquation (8).

In Section 3, we show that recursion relations canbe employed when calculating two-electron integralsfor higher angular-momentum functions. Owing to theseparability, the recursion relations treat the x, y and zdirections independently from each other, yielding

2570 S.A. Losilla et al.

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 4: Construction of the two-electron contribution to the Fock matrix by numerical integration

simple recursion formulae with low computational

scaling. Therefore, the operation count for computing

two-electron integrals of higher angular-momentum

functions might become smaller than for the corre-

sponding analytical evaluation of the integral even

though a few dozens of quadrature points are required

for the desired accuracy.

3. Cartesian-separated form of the two-electron

integrals

By using GTOs, the two-electron integrals can be

rewritten as a linear combination of Coulomb inte-

grals, VnPQ,

gpqrs ¼ NpqrsKpqKrs

Xl pxþl qxuP¼0

Xl pyþl qyvP¼0

Xl pz þl qzwP¼0

TP,xlpx l

qx uP

TP,y

lpy l

qy vP

TP,zlpz l

qz wP

�XlrxþlsxuQ¼0

XlryþlsyvQ¼0

XlrzþlszwQ¼0

TQ,xlrxl

sxuQ

TQ,ylryl

syvQ

TQ,zlrzl

szwQ

VnPQ, ð9Þ

with

VnPQ ¼

Z ZxuP1Py

vP1Pz

wP

1Pe��Pr

21P

�1

r12xuQ2Qy

vQ2Qz

wQ

2Qe��Qr

22Qd3r1d

3r2, ð10Þ

where we have used the definitions

Npqrs ¼ NpNqNrNs, ð11Þ

�pq ¼�p�q�p þ �q

ð12Þ

Kpq ¼ e��pqR2pq ð13Þ

n ¼ ðuP, vP, . . . ,wQÞ: ð14Þ

P and Q are simplified indices standing for the pair

indices pq and rs, respectively. VnPQ is the Coulomb

interaction between two Gaussian charge distributions

with exponents �P¼ �pþ �q and �Q¼ �rþ �s, centred at

RP¼ (�pRpþ �qRq)/(�pþ �q) and RQ¼ (�rRrþ �sRs)/

(�rþ �s). The coefficients TP,�lp�lq�nP,T

Q,�lr�ls�nQ

arise from prod-

ucts of the type

ð�P � XpPÞlp� ð�P � XqPÞ

lq� ¼

Xlp�þlq�nP¼0

TP,�lp�lq�nP�nPP , ð15Þ

where �P¼ ��XP, for �2 {x1, y1, z1}, XP2 {XP,YP,ZP}

are the coordinates of centre P, Xij¼Xj�Xi and

nP2 {uP, vP,wP} [27,28]. The explicit expression for

the normalization constants is Np ¼ N0p�ðl

px Þ�ðl

py Þ�ðl

pz Þ,

with

N0p ¼ p�3=4 2�1=2p

� �lpþ3=4ð16Þ

and �(i)¼ [(2i� 1)!!]�1/2.Introducing the operator expansion in

Equation (4), a separated x, y, and z form of the

integrand of VnPQ is obtained

VnPQ ¼

2

p1=2

ZIuPuQðt; �P,�Q,XPQÞIvPvQðt; �P,�Q,YPQÞ

� IwPwQðt;�P,�Q,ZPQÞdt, ð17Þ

where the IuPuQðt;�P,�Q,XPQÞ functions are

obtained by integrating in two Cartesian directions

(�12 {x1, y1, z1} and �22 {x2, y2, z2})

InPnQðt; �P,�Q,XPQÞ

¼

Z Z�nP1 �

nQ2 e��P�

21 e�t

2ð�2��1þXPQÞ2

e��Q�22 d�1d�2, ð18Þ

where the integration coordinates have been shifted as

�1! �1þXP and �2! �2þXQ. The analytical expres-

sion for the lowest-order t-dependent functions is

given by

I00ðt;XPQÞ ¼pe�LPQðtÞX2

PQ

½ðUPQ þ t2Þð�P þ �QÞ�1=2

, ð19Þ

where UPQ¼ �P�Q/(�Pþ �Q) and LPQ(t)¼UPQt2/

(UPQþ t2). The corresponding InPnQ ðt;XPQÞ functions

for GTOs with higher angular momentum can be

computed using the recursion formulae

InPþ1,nQðt;XPQÞ ¼1

2�P

@

@XPQInPnQðt;XPQÞ

þnP2�P

InP�1,nQðt;XPQÞ, ð20aÞ

InP,nQþ1ðt;XPQÞ ¼�1

2�Q

@

@XPQInPnQðt;XPQÞ

þnQ2�Q

InP,nQ�1ðt;XPQÞ, ð20bÞ

These expressions are equivalent to the relations

encountered in other recursive algorithms to compute

integrals over GTOs [19,29]. From the above we see

that in the general case, the InPnQ ðt;XPQÞ functions have

the form:

InPnQðt;XPQÞ ¼pe�LPQðtÞX2

PQ

½ðUPQ þ t2Þð�P þ �QÞ�1=2

FnPnQðt;XPQÞ,

ð21Þ

Molecular Physics 2571

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 5: Construction of the two-electron contribution to the Fock matrix by numerical integration

where FnPnQ ðt;XPQÞ is a polynomial of XPQ of the order

nPþnQ. The corresponding recursion relations for the

FnPnQðt;XPQÞ functions are

FnPþ1,nQ ðt;XPQÞ

¼1

2�P

"@

@XPQFnPnQðt;XPQÞ�2LPQðtÞXPQFnPnQðt;XPQÞ

þnPFnP�1,nQ ðt;XPQÞ

#, ð22aÞ

FnP,nQþ1ðt;XPQÞ

¼1

2�Q

"�

@

@XPQFnPnQ ðt;XPQÞþ2LPQðtÞXPQFnPnQ ðt;XPQÞ

þnQFnP,nQ�1ðt;XPQÞ

#: ð22bÞ

From the recursion relations, it is evident that

FnP,nQðt;XPQÞ is similar to FnQ,nPðt;XPQÞ with �P! �Qand �Q! �P and with XPQ!�XPQ. The lowest-order

FnP,nQðt;XPQÞ functions have the following form

F00ðt;XPQÞ ¼ 1,

F10ðt;XPQÞ ¼�LPQðtÞXPQ

�P,

F11ðt;XPQÞ ¼LPQðtÞ � 2LPQðtÞX2

PQ

2�P�Q,

F20ðt;XPQÞ ¼�P � LPQðtÞ þ 2L2

PQðtÞX2PQ

2�2P:

ð23Þ

An important advantage with the recursion relations is

that obtaining the FnmaxP

, nmaxQðt;XPQÞ function requires

nmaxP þ nmax

Q iterations, each one at a cost of 6(nPþ

nQþ 1) floating point operations.The product of the three one-dimensional expres-

sions given by Equation (21) yields the following final

expression for the VnPQ Coulomb integrals

VnPQ ¼

2

p1=2

Z 10

MPQðtÞFuPuQðt;XPQÞFvPvQðt;YPQÞ

� FwPwQðt;ZPQÞdt

¼2

p1=2

Z 10

WnPQðtÞdt, ð24Þ

where R2PQ ¼ X2

PQ þ Y2PQ þ Z2

PQ, and

MPQðtÞ ¼p3e�LPQðtÞR

2PQ

½ðUPQ þ t2Þð�P þ �QÞ�3=2: ð25Þ

Inserting the expression for VnPQ in Equation (24) into

Equation (9) yields

gpqrs ¼2

p1=2KpqKrsNpqrs

Z 10

MPQðtÞ

�Xl pxþl qxuP¼0

XlrxþlsxuQ¼0

TP,xlpx l

qx uP

FuPuQ ðt;XPQÞTQ,xlrxl

sxuQ

24

35

�Xl pyþl qyvP¼0

XlryþlsyvQ¼0

TP,y

lpy l

qy vP

FvPvQðt;YPQÞTQ,ylryl

syvQ

24

35

�Xl pz þl qzwP¼0

XlrzþlszwQ¼0

TP,zl pz l

qz wP

FwPwQðt;ZPQÞT

Q,zlrzl

szwQ

24

35dt:ð26Þ

The previous expression can be reorganized to ease theevaluation of integrals for shells of basis functions. Ashell is the set of all functions �i(r) with the sameexponent, centre and angular momentum. A Cartesianshell of angular momentum L is composed of(Lþ 1)(Lþ 2)/2 different functions. The two-electronintegrals can be rewritten as

gpqrs ¼2

p1=2KpqKrsN

0pqrs

Z 10

MPQðtÞYxlpxl

qxl

rxl

sxðtÞYy

lpylqylrylsyðtÞ

�Yzlpz lqz lrzl

szðtÞdt, ð27Þ

with N0pqrs ¼ N0

pN0qN

0rN

0s . The four-index Y�

lp�lq�lr�ls�

ðtÞ iscomputed as

Y�lp�lq�lr�ls�

ðtÞ ¼Xlp�þlq�nP¼0

Xlr�þls�nQ¼0

~TP,�lp�lq�nPFnPnQðt;XPQÞ ~T

Q,�lr�ls�nQ: ð28Þ

The lp� - and l

q� -dependent parts of the normalization

constants have been assimilated into TP,�:

~TP,�lp�lq�nP¼ �ðlp� Þ�ðl

q� ÞT

P,�lp�lq�nP: ð29Þ

Integrals over spherical basis functions are triviallycomputed by multiplying Yx

laxlbxl

cxl

dxYy

laylbylcyldyYz

laz lbz lczldz

with

the corresponding factors to transform between theCartesian and spherical functions. This can be donebefore the integration over t is carried out. Thus,calculation of two-electron integrals for spherical basisfunctions does not incur any additional steps.

4. Numerical integration in the t space

Analytical integration of the expression in Equation(26) for arbitrary orders of the angular momentum isnot practical, if at all feasible. Instead, we need toresort to some numerical integration procedure.

2572 S.A. Losilla et al.

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 6: Construction of the two-electron contribution to the Fock matrix by numerical integration

Given the similarity of the integrands to the ones

discussed in our previous work in the context of

electrostatic potential calculations [23], we exploit here

a similar procedure to develop an efficient and accurate

quadrature scheme.The integral in Equation (24) is subdivided into

three intervals. In the first interval, [0, tl], the integrand

WnPQðtÞ can be approximated with locally defined

polynomials, implying that Gauss–Legendre quadra-

ture would provide accurate results. This can easily be

understood when considering that close to t¼ 0 the

dominant factor in MnPQðtÞ is either (UPQþ t2)�3/2

for UPQ� 1 or e�LPQðtÞR2PQ � e�R

2PQ

t2 for UPQ� 1. The

dominating t-dependent factor is multiplied by the

product of the FnP,nQðt;XPQÞ functions, which behaves

like an even polynomial with respect to t, when t� 1.For t� 1 values, the LPQ(t) function is given by

LPQðtÞ ¼ UPQ

X1m¼0

ð�1ÞmUmPQt�2m

ð30Þ

and (UPQþ t2)�3/2 can be expressed as a series

expansion

1

UPQ þ t2� �3=2 ¼X

1

m¼0

ð�1ÞmcmUmPQt�ð3þ2mÞ, ð31Þ

where the coefficients cm are [30]

cm ¼ð2mþ 1Þ!!

m!2m: ð32Þ

WnPQðtÞ is thus a smoothly decaying function of t

regardless of the values for UPQ and RPQ. In the second

interval, [tl, tf], the leading term of WnPQðtÞ is propor-

tional to t�3. Thus, it can be integrated accurately

using Gauss–Legendre quadrature in logarithmic coor-

dinates. The quadrature in logarithmic coordinates is

identical to the one in the first interval, except that the

quadrature points {tk} are obtained as fe�kg, where {�k}are Gauss–Legendre quadrature points for the interval

[ln(tl), ln(tf)], and each integration weight !k is multi-

plied by an extra factor e�k . Finally, in the semi-infinite

interval, [tf,1[,R1tf

WnPQðtÞdt can be obtained accu-

rately by integrating analytically the leading t�3 term.

For a sufficiently large t, WnPQðtÞ can be approximated

to first order as

WnPQðtÞ � CPQt

�3 þOðt�5Þ ð33Þ

with

CPQ ¼M1PQFuPuQð1;XPQÞFvPvQ ð1;YPQÞ

� FwPwQð1;ZPQÞ ð34Þ

and

M1PQ ¼p3e�UPQR

2PQ

ð�P þ �QÞ3=2

ð35Þ

and FnPnQð1;XPQÞ ¼ limt!1 FnPnQðt;XPQÞ. Note that

M1PQ is not limt!1MPQ(t). Both FnPnQð1;XPQÞ and

M1PQ factors may be computed by replacing LPQ(t) with

UPQ whenever they appear in their expressions.

The error in evaluating the integralR1tf

WnPQðtÞdt

analytically by approximating WnPQðtÞ � CPQ=t

3

is proportional to t�4f , which is apparent from

Equation (33).Hence, Vn

PQ may be expressed as a numerical

integral in t space as

VnPQ ¼

2

p1=2

Z 10

WnPQðtÞdt�

2

p1=2Xk

!kWnPQðtkÞþ

CPQ

p1=2t2f,

ð36Þ

where the sum over k includes the quadrature points in

both linear and logarithmic coordinates.To express the Fock-matrix elements as the sum-

mation given in Equation (8), the quadrature points

and weights have to be identical for all VnPQ integrals.

Generally, this is not possible, because WnPQðtÞ is steep

when either UPQ is small or both UPQ and RPQ are

large, as illustrated in Figure 1(a). The variety of the

exponents and distances in an ordinary molecular

electronic structure calculation implies that different

quadrature intervals need to be employed to compute

VnPQ accurately. However, this problem can be circum-

vented by performing the numerical integration in a

new transformed t0 coordinate, which is obtained by

the transformation

t0 ¼ sPQt ¼ U�1=2PQ þ RPQ

� �t: ð37Þ

The transformed functions are illustrated in

Figure 1(b). For all UPQ and RPQ values, the functions

behave in a similar manner. Hence, the VnPQ terms can

be integrated using one quadrature scheme generating

the ft0kg points and the corresponding {!k} weights in

the intervals ½0, t0l �, ½t0l, t0f �. The integrals can then be

computed as

VnPQ �

2

p1=2sPQ

Xk

!kWnPQ

t0ksPQ

� þCPQs

2PQ

p1=2t02f :ð38Þ

In the vicinity of t0 ¼ 0 and for UPQ� 1, the

WnPQðt

0=sPQÞ functions can be approximated by an even

polynomial times a Gaussian function, nPQðt0Þe�t

02

,

where nPQðt0Þ is an even polynomial. Therefore, a

further possibility to improve the accuracy, or to

Molecular Physics 2573

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 7: Construction of the two-electron contribution to the Fock matrix by numerical integration

reduce the amount of quadrature points, is by com-

puting the Coulomb integral as

VnPQ ¼

2

p1=2

Z 10

WnPQðt

0Þ � nPQðt0Þe�t

02� �

dt0

þ2

p1=2

Z 10

nPQðt0Þe�t

02

dt0, ð39Þ

since the integrand of the first term is small as compared

to WnPQðt

0Þ. For large UPQ values, the integrand of the

first termmight in some cases become vanishingly small.

The second term can be evaluated analytically.Inserting Equation (38) into Equation (27), we

obtain the final expression

gpqrs ¼2

p1=2KpqKrsN

0pqrs

�Xk

!kMPQðt0kÞY

xlpxl

qxl

rxl

sxðt0kÞ

�Yy

lpylqylryl

syðt0kÞY

zlpz l

qz lrzl

szðt0kÞ þ

s2PQ

2t02fM1PQY

xlpxl

qxlrxl

sxð1Þ

�Yy

lpylqylryl

syð1ÞYz

lpz lqz lrzl

szð1Þ

�: ð40Þ

From Equation (40), it is clear that the integration

of the tail can be treated on an equal footing with the

other quadrature points, with weight s2PQ=2t02f and

computing MPQ and the elements of Y� using UPQ

instead of LPQ(t) every time it appears in their

expressions.The previous approach is equivalent to approxi-

mating the r�112 operator as [24]

1

r12�

2

p1=2Xk

!ke�t2

kr212 þ

pt2fðr1 � r2Þ: ð41Þ

Therefore, the approach presented here can be usedreadily to compute integrals hpqjg12jrsi for any two-body operator g12(r1, r2) which can be approximated asa linear combination of Gaussian functions.

5. Numerical accuracy

The algorithm has been implemented as a Pythonprogram (Sivari) to assess the accuracy of the proposedmethods. The choice of the programming language isdue to its simplicity, as it allows one to deploy acompletely functional version in about 200 lines ofcode. This is feasible largely due to the availability ofPython libraries, namely NumPy [31], which canperform a large variety of numerical tasks, andPyQuante [32], which provides high-level quantumchemistry functions. PyQuante in particular greatlysimplifies the debugging process and enables theinclusion of the computed two-electron integrals intofull electronic structure calculations. The obviousdrawback is that, being completely implemented inthe scripted language, our Python program is extre-mely slow. Therefore, it is not sensible to compare itsperformance with production libraries and subrou-tines. A prototype Fortran program capable of com-puting integral shells has been implemented to measurefloating-point operation (FLOP) counts and memorycosts, as is discussed in Section 6.

The chosen intervals for the t-integration were [0, 4]and [4, 105] for the linear and logarithmic integration,respectively, using 25 quadrature points in each inter-val, or in total 51 points, including the additional pointthat is needed for the tail integration. This is morethan sufficient for computing all relevant Vn

PQ

0.0 0.5 1.0 1.5 2.0 2.5 3.0

t

0.0 0.5 1.0 1.5 2.0 2.5 3.0

t„

0.0

0.2

0.4

0.6

0.8

1.0

WP

Q(t

)/W

PQ(0

)

0.0

0.2

0.4

0.6

0.8

1.0

WP

Q(t

)/W

PQ(0

)

RPQ= 1 , UPQ= 10−2

RPQ= 1 , UPQ= 1

RPQ= 1 , UPQ= 102

RPQ= 10 , UPQ= 102

(a)

RPQ= 1, UPQ= 10−2

RPQ= 1, UPQ= 1

RPQ= 1, UPQ= 102

RPQ= 10, UPQ= 102

(b)

Figure 1. Scaled WnPQðtÞ functions for some UPQ and RPQ values expressed using (a) the normal t coordinate and (b) the

transformed t0 coordinate using the coordinate transformation in Equation (37).

2574 S.A. Losilla et al.

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 8: Construction of the two-electron contribution to the Fock matrix by numerical integration

Coulomb integrals with an accuracy of more than 10digits. The amount of quadrature points can probablybe reduced while still providing the needed accuracy.The subtraction technique in Equation (39) has notbeen used, although some preliminary tests for lp¼ 0show promising improvements in the accuracy.

Figure 2 shows the relative error in the calculatedVn

PQ values for exponents in the range of 10�2–104,with angular-momentum functions up to f in the basisset. For each shell, some sub-shells were picked (e.g.110 and 011 for the d shell). For all cases, the accuracyis at least 11 digits and independent of the sub-shellangular momentum. Test calculations show that theerrors are of the same order of magnitude for two-electron integrals involving angular-momentum func-tions as high as L¼ 9 functions.

The quality of the Fock matrices obtained with thenumerical algorithm was further tested by using thetwo-electron integrals in Hartree–Fock calculations.The structures of H2 and H2O were optimized at theHF/6-31G** level [33,34] using the Turbomole pro-gram package [35]. The self-consistent field (SCF)procedure was carried out using both the two-electronintegrals computed with Sivari and using the defaultsubroutine in PyQuante, starting from the same

molecular orbital guess. The convergence criterionfor the energy was 10�4 Eh, and the direct inversion ofthe iterative subspace (DIIS) procedure [36] was usedto enforce convergence. Figure 3 shows the errors inthe Fock matrix for the converged calculation usingthe cc-pVDZ basis set [37]. In every case, the errorswere smaller than 10�11 Eh. The errors in the Hartree–Fock total energies, given in Table 1, are smaller than10�12 Eh, which is well below the convergencethreshold.

6. Computational cost

The algorithm for computing all the integrals arisingfrom four different shells is outlined in Figure 4. Theformulas for the FLOP count and memory cost arereported in Table 2. The most CPU-expensive step isaccumulating the product of the H� terms into eachintegral for each tk point, with a cost of four FLOP perintegral per quadrature point. The leading term is thusO(L8Nt). In comparison with other algorithms, thepresent one has a low asymptotic behaviour and smallprefactor for the most expensive step. However, theadditional loop over quadrature points significantlyincreases the costs implying that the method is more

Figure 2. Relative error in the numerically computed interaction energies of pairs of Cartesian Gaussian charge distributionsVn

PQ. The errors are given in the logarithmic (log10) scale. White colour indicates identical results up to machine accuracy. Eachgraph corresponds to a different combination of angular momenta. For instance, the second graph from the top in the lastcolumn corresponds to V

ð0,1,2,0,1,0ÞPQ ¼

R Rx01Py

11Pz

21P expð��Pr

21PÞr

�112 x

02Qy

12Qz

02Q expð��Qr

22QÞ d

3r1 d3r2. The exponents �P and �Q,

ranging from 10�2 to 104, are given as the ordinates and abscissa, respectively. The centres are located at RP¼ (0, 0, 0) andRQ¼ (3�1/2, 3�1/2, 3�1/2), yielding RPQ¼ 1.

Molecular Physics 2575

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 9: Construction of the two-electron contribution to the Fock matrix by numerical integration

competitive when basis functions with large L valuesare present.

Table 3 shows the FLOP count for different valuesof L and number of quadrature points Nt, for

computing all the integrals arising from four different

function shells with the same L. These were computed

with the prototype Fortran code on an Intel Xeon

E5540 (2.53GHz), with 51 quadrature points. The

CPU time for the calculation was directly proportional

to the FLOP count, at a cost of about 10 ns per FLOP.

As an example, the calculation took 0.14 s for L¼ 4,

and 9.04 s for L¼ 8.The number of quadrature points can be decreased

to lower the computational cost, at the cost of

accuracy. Also, the amount of quadrature points per

processor can be reduced by using k as an index for

parallelization. As shown in Section 2, independent

contributions to the Fock matrix can be obtained by

contracting the partial contributions to the integrals

from a few quadrature points with the density matrix.

Therefore, only the contributions to the Fock matrix,

(a) (b)

(d)(c)

Figure 3. Error in the Fock matrix (in Eh) for some small closed-shell systems as obtained using the cc-pVDZ basis set. In thewhite areas, both the numerical and the analytical approaches yield identical Fock-matrix elements.

Table 1. Errors in the Hartree–Fock total energy (in Eh) when using the numerical two-electron integrals.

Molecule STO-3G 6-31G** 6-31þþG** 6-311G** cc-pVDZ

H2 0.0 0.0 1.8�10�15 4.4�10�16 4.4�10�16

He 1.3�10�15 4.4�10�16 4.4�10�16 4.4�10�16 0.0H2O 4.3�10�13 5.0�10�13 4.4�10�13 7.1�10�14 5.5�10�13

Ne 7.2�10�13 6.8�10�13 6.8�10�13 6.3�10�13 6.3�10�13

Figure 4. Pseudocode of the algorithm to compute theintegrals arising from the uncontracted shells p, q, r, s.

2576 S.A. Losilla et al.

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 10: Construction of the two-electron contribution to the Fock matrix by numerical integration

of much smaller size than the set of two-electronintegrals, need to be communicated in a parallelimplementation.

7. Conclusions

A novel numerical integration approach for calculatingtwo-electron contributions to the Fock matrix has beendeveloped and implemented. The molecular orbitalsare expanded in Gaussian-type orbitals (GTO),whereas the two-electron Coulomb integrals and thecorresponding contribution to the Fock matrix areobtained by integrating the auxiliary t directionnumerically. The integral representation of the 1/r12operator in combination with the use of GTO basisfunctions factorizes the t-dependent integrand intoproducts of two-dimensional integrals, which are easierto compute than the six-dimensional Coulomb inte-grals. The two-dimensional integrals can be obtainedfor higher angular-momentum functions by usingdecoupled recursion formulae in the Cartesian direc-tions, which yields an approach with a low FLOPcount for high angular momentum functions. Anaccurate numerical integration scheme has been devel-oped. A few dozens of quadrature points are neededfor obtaining an accuracy of 10�12 Eh for the Fockmatrix elements. The new index introduced by thequadrature might be explored in parallel computing.

The proposed method might also be useful in othercontexts where a huge number of expensive Coulombintegrals has to be calculated.

Acknowledgements

This research has been supported by the Academy of Finlandthrough its Computational Science Research Programme(LASTU) and within project 137460 and the HumanFrontier Science Program through the grant RGP00391/2008. CSC – the Finnish IT Center for Science is thanked forcomputer time. We also acknowledge the Magnus EhrnroothFoundation for financial support. The authors would like tothank Jussi Lehtola for his helpful suggestions.

References

[1] S.F. Boys, Proc. R. Soc. London 200, 542 (1950).[2] M. Haser and R. Ahlrichs, J. Comput. Chem. 10, 104

(1989).[3] H. Horn, H. Weiss, M. Haser, M. Ehrig and

R. Ahlrichs, J. Comput. Chem. 12, 1058 (1991).[4] E. Schwegler, M. Challacombe and M. Head-Gordon,

J. Chem. Phys. 106, 9708 (1997).[5] T. Helgaker, H. Larsen, J. Olsen and P. Jørgensen,

Chem. Phys. Lett. 327, 397 (2000).

[6] J. Almlof, K. Fægri and K. Korsell, J. Comput. Chem.

3, 385 (1982).[7] X.P. Li, R.W. Nunes and D. Vanderbilt, Phys. Rev. B

47, 10891 (1993).[8] C.A. White, B.G. Johnson, P.M.W. Gill and M. Head-

Gordon, Chem. Phys. Lett. 253, 268 (1996).

[9] E. Strain, G.E. Scuseria and M.J.J. Frisch, Chem. Phys.

271, 51 (1996).[10] M. Challacombe and E. Schwegler, J. Chem. Phys. 106,

5526 (1997).[11] H. Takashima, S. Yamada, S. Obara, K. Kitamura,

S. Inabata, N. Miyakawa, K. Tanabe and

U. Nagashima, J. Chem. Phys. 23, 1337 (2002).

[12] C. van Wuellen, J. Comput. Chem. 32, 1195 (2011).[13] I.S. Ufimtsev and T.J. Martinez, J. Chem. Theory

Comput. 4, 222 (2008).[14] R. Olivares-Amaya, M.A. Watson, R.G. Edgar,

L. Vogt, Y. Shao and A. Aspuru-Guzik, J. Chem.

Theory Comput. 6, 135 (2010).

Table 2. CPU and memory costs for the different parts of the algorithm, for integrating over four different shellswith the same number L.

Step FLOP count Memory (floats)

Compute all ~TP,�

, ~TQ,�

6(Lþ 1)2(4Lþ 1) 6(Lþ 1)3

Compute �(X) at X, Y, Z [(2Lþ 1)2(24L� 1)þ 4]Nt 3(2Lþ 1)2

Contract Y� (�¼ x, y, z) 3(Lþ 1)2[2(Lþ 1)3þ (2Lþ 1)2]Nt 3(Lþ 1)4

Accumulate (pqjrs) (Lþ 1)4(Lþ 2)4Nt/4 (Lþ 1)4(Lþ 2)4/16

Table 3. Total FLOP count for (LLjLL) typeintegral shells as a function of L and the numberof quadrature points Nt.

L FLOP count

0 6þ 19Nt

1 121þ 871Nt

2 486þ 8631Nt

3 1248þ 52315Nt

4 2550þ 235699Nt

5 4536þ 853239Nt

6 7350þ 2610391Nt

7 11136þ 6998731Nt

8 16038þ 16886355Nt

Molecular Physics 2577

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4

Page 11: Construction of the two-electron contribution to the Fock matrix by numerical integration

[15] M. Dupuis, J. Rys and H.F. King, J. Chem. Phys. 65,111 (1976).

[16] L.E. McMurchie and E.R. Davidson, J. Comp. Phys.26, 218 (1978).

[17] S. Obara and A. Saika, J. Chem. Phys. 84, 3963 (1986).[18] S. Obara and A. Saika, J. Chem. Phys. 89, 1540 (1988).

[19] R. Ahlrichs, Phys. Chem. Chem. Phys. 8, 3072 (2006).[20] S. Reine, T. Helgaker and R. Lindh, WIREs Rev.,

Comput. Mol. Sci. 2, 290 (2012).

[21] D. Sundholm, J. Chem. Phys. 122, 194107 (2005).[22] J. Juselius and D. Sundholm, J. Chem. Phys. 126, 94101

(2007).

[23] S.A. Losilla, D. Sundholm and J. Juselius, J. Chem.Phys. 132, 024102:1 (2010).

[24] S.A. Losilla and D. Sundholm, J. Chem. Phys. 136,214104 (2012).

[25] R.J. Harrison, G.I. Fann, T. Yanai, Z. Gan andG. Beylkin, J. Chem. Phys. 121, 11587 (2004).

[26] T. Yanai, G.I. Fann, Z. Gan, R.J. Harrison and

G. Beylkin, J. Chem. Phys. 121, 2866 (2004).

[27] T. Helgaker, P. Jørgersen and J. Olsen, MolecularElectronic-Structure Theory (Wiley, Chichester, 2000).

[28] H. Taketa, S. Huzinaga and K. O-ohata, J. Phys. Soc.Jpn. 21, 2313 (1966).

[29] N. Flocke and V. Lotrich, J. Comp. Chem. 29, 2722(2008).

[30] M. Abramowitz and I.A. Stegun, Handbook ofMathematical Functions (Dover Publications,New York, 1965).

[31] E. Jones, T. Oliphant, P. Peterson, et al., Open sourcescientific tools for Python, http://www.scipy.org/2001–

[32] R. Muller, PyQuante: Python Quantum Chemistry.

[33] P.C. Hariharan and J.A. Pople, Theor. Chim. Acta 28,213 (1973).

[34] W.J. Hehre, R. Ditchfield and J.A. Pople, J. Chem.Phys. 56, 2257 (1972).

[35] R. Ahlrichs, M. Bar, M. Haser, y Horn and C. Kolmel,Chem. Phys. Lett. 162, 165, current version: see (1989).

[36] P. Pulay, Chem. Phys. Lett. 73, 393 (1980).

[37] T.H. Dunning Jr, J. Chem. Phys. 90, 1007 (1989).

2578 S.A. Losilla et al.

Dow

nloa

ded

by [

Uni

vers

ity O

f M

aryl

and]

at 0

3:06

18

Oct

ober

201

4