Sei sulla pagina 1di 12

Ewald Summation for Coulomb Interactions in a Periodic Supercell

Hark Lee and Wei Cai


Department of Mechanical Engineering, Stanford University, CA 94305-4040
January 10, 2009

Contents
1 Problem Statement

2 Charge Distribution Function

3 Splitting the Charge Distribution

4 Potential Field of a Gaussian Charge Distribution

5 Long Range Potential in Reciprocal Space

6 Implementation Issues

A Alternative Derivation of Ewald Summation

B Two-dimensional Ewald Summation

C One-dimensional Ewald Summation

11

This document gives a simple and self-contained description of the Classical Ewald method [1, 2].
The derivation here reflects the our thoughts when trying to understand and internalize the
method. We hope that it will be useful for others who also want to understand the basic idea of
Ewald summation.

Problem Statement

Consider N ions in vacuum, at locations r1 , r2 , r3 , ..., rN , and possessing point charges q1 , q2 , q3 , ..., qN ,
respectively. The total Coulomb interaction energy is
E=

1 X qi qj
40
|rij |

(1)

(i,j)

where rij = rj ri , 0 = 8.854 1012 C2 N1 m2 is vacuum permittivity (or electric constant),


and the sum is over all ionic pairs (i, j) (there are N (N 1)/2 pairs in total).
Now suppose the ions are subjected to periodic boundary conditions (PBC), which are described
by three repeat vectors c1 , c2 , c3 (forming a supercell). This means that whenever there is an
1

ion qi at location ri , there are also ions with charge qi at ri + n1 c1 + n2 c2 + n3 c3 , where n1 ,


n2 , n3 are arbitrary integers. To simplify our notation, we will write an arbitrary repeat vector,
n1 c1 +n2 c2 +n3 c3 , as n L, where L represents the characteristic length of the supercell. For example,
it is easy to picture a supercell with a cubic-shape. In this case, we can choose L = |c1 | = |c2 | = |c3 |
and vectors n form a simple cubic lattice (n1 , n2 , n3 ). The total Coulomb interaction energy for
these ions under PBC has to include the interactions between periodic images,
qi qj
1 XX
E=
(2)
40 n
|rij + n L|
(i,j)

The sum over all pairs can be rewritten into sums over all ions, with a factor 1/2 to cancel the
double-counting.
N

E=

1 1 X X X 0 qi qj
40 2 n
|rij + n L|

(3)

i=1 j=1

where the symbol is introduce to exclude the term j = i, if and only if n = 0. The infinite sum in
Eq. (3) not only converges very slowly but also is conditionally convergent, meaning that the result
depends on the order of the summation. The Ewald method evaluates E by transforming it into
summations that converges not only rapidly but also absolutely. The final expression of energy in
the Ewald method is given by Eq. (39). In the following we describe how and why we arrive at such
an expression.
To gain more physical insight, we consider the electrical potential field generated by the ions.
The potential field generated by an ion with charge qi at location ri is
i (r) =

1
qi
40 |r ri |

(4)

The potential field generated by all N ions together with their periodic images under PBC is
N
qj
1 XX
(r) =
40 n
|r rj + nL|

(5)

j=1

We can define [i] (r) as the potential field generated by all the ions plus their images, excluding
ion i,
[i] (r) (r) i (r) =

N
qj
1 X X0
40 n
|r rj + nL|

(6)

j=1

Again, the 0 symbol means that the term j = i is excluded, if and only if n = 0. Comparing Eqs.(3)
and (6), we see that
N
1 X
E=
qi [i] (ri )
2

(7)

i=1

Charge Distribution Function

The charge density distribution for the system of point charges considered above are described by
a collection of delta functions. In particular, the charge density for point charge qi is
i (r) = qi (r ri )

(8)
2

We can consider a more general problem, in which the charge distribution for each ion is not
necessarily a delta function, but could spread out in space. The potential field generated by this
charge distribution is the solution of the Poissons equation
2 i (r) =

i (r)
0

(9)

and can be written as


Z
1
i (r0 ) 3 0
i (r) =
d r
40
|r r0 |

(10)

The total Coulomb interaction energy can be written as,


N

E=

1 1 X X X0
40 2 n

ZZ

i=1 j=1

i (r)j (r0 ) 3 3 0
d rd r
|r r0 + nL|

(11)

and the potential field generated by all ions excluding ion i becomes
N Z
j (r0 )
1 X X0
d3 r0
[i] (r) =
40 n
|r r0 + nL|

(12)

j=1

When the charge densities are described by Eq. (8), Eqs. (11) and (12) reduce to Eqs.(3) and (6).

Splitting the Charge Distribution

We now return to our original problem, in which the charge distributions are described by delta
functions. But we can split it into two terms by adding and subtracting a Gaussian distribution.
i (r) = Si (r) + L
i (r)
Si (r) = qi (r ri ) qi G (r ri )
L
i (r) = qi G (r ri )

(13)

where


1
|r|2
G (r) =
exp 2
2
(2 2 )3/2

(14)

is the standard deviation of the Gaussian distribution. Another parameter, 1/( 2 ), is also
used in the literature. It is important to note that the delta function can be considered as a limit
of the Gaussian distribution when 0,
lim G (r) = (r)

(15)

Corresponding to the splitting of charge, the potential field i (r) can also be split into two terms,
i (r) = Si (r) + L
(r)
Z i 0
qi
(r r0 ) G (r r0 ) 3 0
Si (r) =
d r
40
|r r0 |
Z
qi
G (r r0 ) 3 0
L
i (r) =
d r
40
|r r0 |
3

(16)

The potential field generated by all ions excluding ion i can be split in a similar way,
[i] (r) = S[i] (r) + L
[i] (r)

(17)

This leads to the splitting of the Coulomb interaction energy


N

E=

1X
1X
qi S[i] (ri ) +
qi L
[i] (ri )
2
2
i=1

(18)

i=1

For reasons that will become clear later, we further split the energy E by adding and subtracting
a self-interaction term,
N

i=1

i=1

i=1

1X
1X
1X
S
L
self
E=
qi S[i] (ri ) +
qi L (ri )
qi L
i (ri ) E + E E
2
2
2

(19)

where
N

EL
E self

1X
qi S[i] (ri )
2

(20)

1
2

qi L (ri )

(21)

qi L
i (ri )

(22)

1
2

i=1
N
X
i=1
N
X
i=1

Notice that in E L the potential generated by ion i itself is no longer excluded.

Potential Field of a Gaussian Charge Distribution

The potential field generated by a charge distribution of the Gaussian form can be obtained by
solving the Poissons equation,
2 (r) =

G (r)
0

(23)

By symmetry, we know that (r) only depends on the magnitude r = |r|. In spherical coordinates,
the Poissons equation becomes,
1 2
G (r)
[r (r)] =
r r2
0
2

r G (r)
[r (r)] =
2
r
0
Z

r G (r)
2
[r (r)] =
dr =
G (r)
r
0
0
r
r


Z
1
r
2 r

2
erf
r (r) =
G (r) dr =
0 0
0 (2 2 )3/2 2
2


1
r
(r) =
erf
40 r
2
4

(24)

Rz

et dt. Therefore,


qi
1
|r ri |
erfc
40 |r ri |
2


qi
1
|r ri |
erf
40 |r ri |
2

where erf(z)
Si (r) =
L
i (r) =

(25)

where erfc(z) 1 erf(z). Because limz erf(z) = 1, we know that L


i (r) is a long-range nonsingular potential and Si (r) is a short-range singular potential. (In comparison, the Coulomb
potential of a point charge is both long-ranged and singular.) Given this result, we also have


N
qj
|r rj + nL|
1 X X0

S[i] (r) =
erfc
(26)
40 n
|r rj + nL|
2

j=1
as well as the short-range part of the total Coulomb interaction energy (first term in Eq. (18))
N

qi qj
1X
1 1 X X X0
E
erfc
qi S[i] (ri ) =
2
40 2 n
|ri rj + nL|
S

i=1

i=1 j=1

|ri rj + nL|


(27)

This is similar to the total Coulomb interaction energy E, except for the erfc term that truncates
the potential function at large distances. Due to the erfc truncation, E S can be directly computed
from a sum in real space. Now that we have the analytic expression for the long-range potential,
we can easily obtain the self energy term,
lim erf(z) =

2
z

L
i (ri ) =

qi
40

z0

E self

2 1

N
1 X 2
1

qi
40 2

(28)

i=1

Long Range Potential in Reciprocal Space

L
Because L
i (r) is long-ranged, the long-range interaction E defined in Eq. (19) cannot be directly
computed by a sum in real space. The basic idea of the Ewald sum is to transform it into a sum
in the reciprocal space, given that this potential is no longer singular [1].
By not excluding the contribution from any ion, L (r) is the potential field generated by a
periodic array of ions. Because the total charge density field

L (r) =

N
XX
n

L
i (r + nL)

(29)

i=1

is a periodic function, so is L (r). Hence it makes sense to Fourier transform L (r) to the reciprocal
space. Let L (k) and L (k) be the Fourier transform of L (r) and L (r), respectively.
Z
L (k) =
L (r) eikr d3 r
ZV
L
(k) =
L (r) eikr d3 r
V

The integral is over the volume V of the supercell. The inverse Fourier transform is
1 X L
L (r) =
(k) eikr
V
k
X
1
L (r) =
L (k) eikr
V
k

The summation is over the reciprocal lattice of the lattice defined by the translation vectors c1 ,
c2 , c3 . The potential field and the charge distribution are related to each other by the Poissons
equation
2 L (r) =

L (r)
0

(30)

which can be transformed into reciprocal space to give


k 2 L (k) =

L (k)
0

(31)

Hence our strategy of computing E L is the following. First, we obtain the Fourier transform of
the charge density. Dividing the result by k 2 we obtain the Fourier transform of the long range
potential. The long-range potential in real space is then obtained by inverse Fourier transform,
which finally gives rise to E L . This is described by the following expressions.
L

(r) =

N
XX

qj G (r rj + nL)

n j=1
L

(k) =

Z X
N

qj G (r rj + nL) eikr d3 r

V j=1

N
X

Z
qj

j=1

N
X

G (r rj ) eikr d3 r

R3

qj eikrj e

2 k 2 /2

(32)

j=1

R
where k = |k| and R3 means integration over the entire 3-dimensional space. In the above derivation, we have used the fact that k is a reciprocal vector and exp(ik nL) = 1. Notice that

L
i (k) = qj e

2 k 2 /2

(33)

is the Fourier transform of L


i (r) and
L (k) =

N
X

L
i (k)

(34)

i=1

The potential field in reciprocal space is


2 2
N
1 X
e k /2
L (k) =
qj eikrj
0
k2

(35)

j=1

Now applying inverse Fourier transform, we get


1 X L
L (r) =
(k) eikr
V
k6=0

N
1 X X qj ik(rrj ) 2 k2 /2
e
e
V 0
k2

(36)

k6=0 j=1

The contribution to the k = 0 term is zero if the supercell is charge neutral, i.e.
long-range interaction energy is

PN

i=1 qi

= 0. The

1X
qi L (ri )
2
i=1

N N
1 X X X qi qj ik(ri rj ) 2 k2 /2
e
e
2V 0
k2
k6=0 i=1 j=1

For convenience, let us define the structure factor S(k) of the charge distribution
S(k)

N
X

qi eikri

(37)

i=1

Then the long-range interaction energy can be simply expressed as


2 2
1 X e k /2
E =
|S(k)|2
2V 0
k2

(38)

k6=0

Combining Eqs. (27), (28), (38), the total Coulomb interaction energy can be finally written as,
E = E S + E L E self


N N
|ri rj + nL|
qi qj
1 1 X X X0

erfc
=
40 2 n
|ri rj + nL|
2
i=1 j=1

2 2
N
1
1 X 2
1 X e k /2
2

|S(k)|
qi
+
2V 0
k2
40 2

(39)

i=1

k6=0

The summation for E S is short-ranged in real space (truncated by the erfc function) and the
2 2
summation for E L is short-ranged in reciprocal space (truncated by e k /2 ).

Implementation Issues

In Molecular Dynamics (MD) simulations, we need to compute not only the interaction energy E,
but also the forces on the ions due to this interaction. The force on ion j is
fj

E S
E L
E
=

fjS + fjL
rj
rj
rj

(40)


The short-range force fjS is essentially the force due to the pair potential (r) = erfc[r/( 2 )]/r
and can be computed directly from a sum in real space. The long-range force fjL can be computed
by first computing the derivative of the structural factor,
S(k)
= i k qj eikrj
rj

(41)

and then follow the chain rule,




2 2
S(k)
1 X e k /2

S
(k)
+
c.c.
fjL =
2V 0
k2
rj

(42)

k6=0

where c.c. means complex conjugate.


The method described above is called the Classical Ewald (CE) method [1, 2], whose computational cost scales as O(N 3/2 ) (with optimal choice of for each N ). The Particle Mesh Ewald
(PME) method [3] is a more advanced method which scales as O(N log(N )). Hence PME is more
efficient than CE in the limit of large N .

Alternative Derivation of Ewald Summation

Suppose we would like to compute the potential field generated by point charge qi at ri and its
periodic images. The result is
1 X
qi
i (r) =
(43)
40 n |r ri nL|
(This summation is actually divergent. But the divergent component is a constant. This constant
will disappear if we sum up the potential field of a collection of point charges whose total charge is
zero.) Its Fourier transform is
1 ikri
i (k) =
e
(44)
0 k 2
where k = |k| and for brevity we have set qi = 1 here. (Notice that the k = 0 term is ill-defined,
which corresponds to the constant term in real-space potential i (r).) If we want to obtain the
total energy, we may sum over the k vector over the reciprocal space. But the summation over the
reciprocal space is also conditionally convergent. To construct an absolutely convergent summation,
we use the mathematical identity,
Z
1
2
ek t dt = 2
(45)
k
0
Hence,
Z
1 ikri k2 t
e
e
dt
(46)
i (k) =
0
0
Next we break the integral into two parts and assign them to the short- and long-range part of the
potential field.
Z

Z
1 ikri
S
L
k2 t
k2 t
i (k) = i (k) + i (k) =
e
e
dt +
e
dt
(47)
0

0
Z
1 ikri k2 t
S
i (k) =
e
e
dt
0
0
Z
1 ikri k2 t
L
(k)
=
e
e
dt
i
0

The long-range potential can be integrated analytically to give


L
i (k) =

1 ikri k2
e
e
0 k 2

(48)

With = 2 /2, this expression is connected to the expression of E L discussed in Section 5. The
next step is to convert Si (k) to real space. We do so by inverse Fourier transform.
1 X S
Si (r) =
i (k) eikr
V
k
Z
1 X ik(rri ) k2 t
e
e
dt
=
V 0
0
k
Z X
1
2
=
eik(rri ) ek t dt
V 0 0
k

Notice that the summation above is simply the inverse Fourier transform of a Gaussian distribution
(identifying t with 2 /2). Hence,
Z
2
1 X e|rri +nL| /(4t)
S
i (r) =
dt
0 n 0
(4 t)3/2


1 X
1
|r ri |
=
erfc

40 n |r ri |
2


1 X
1
|r ri |

(49)
=
erfc
40 n |r ri |
2
This expression is connected to the expression of E S discussed in Section 4. The above is a standard derivation of Ewald summation in many papers and books. It makes use of the magical
split of 1/k 2 into two integrals, given in Eq. (47). This approach may be mathematically appealing to some readers but may look like black-magic to others who are looking for more physical
intuition.

Two-dimensional Ewald Summation

The derivation in Appendix A can be generalized to a two-dimensional periodic array of point


charges [4]. The coordinate system is chosen such that the 2-dimensional plane that contains all
the image charges is perpendicular to z-axis. The potential field generated by point charge qi at ri
and its periodic images is
1 X
qi
i (r) =
(50)
40 m |r ri + mL|
where mL is real-space repeat vectors of the 2-d lattice. Its 2-dimensional Fourier transform is
i (, z) =

e|zzi | i
i
e
2 0

(51)

where i = (xi , yi ), = || and is a vector in the 2-d reciprocal lattice. Again, for brevity we
have set qi = 1 here. (This result can be easily obtained by 1-dimensional inverse Fourier transform
of i (k) along z-axis.) Notice that in the limit of 0,
i (0, z) =

|z zi |
2 0

(52)
9

Notice that as long as |z zi | > 0, i (, z) decays exponentially fast in the 2-d reciprocal space.
In this case, the summation over reciprocal space will be absolutely convergent. However, the sum
becomes conditionally convergent when |z zi | = 0. In practice, the decay rate becomes very slow
even if |z zi | is non-zero but very small.
To construct absolutely convergent sums, we take a similar approach as in Appendix A and use
the following identity.1
Z
e|zzi |
1
2 2
2
e t |zzi |/(4t ) dt
(54)
=
2
0
Again, we can split i (, z) into a short-range part and a long-range part.
Z Z 
1
2 2
2
S
L
ii
i (, z) = i (, z) + i (, z) =
e
+
e t |zzi |/(4t ) dt
0
0

Z
1
2 2
2
Si (, z) =
e t |zzi |/(4t ) dt
eii
0
Z0
1
2 2
2
L
eii
e t |zzi |/(4t ) dt
i (, z) =
0

(55)

The long-range potential can be integrated analytically to give







1
|z zi |
|z zi |
L
ii
|zzi |
|zzi |
i (, z) =
e
e
erfc +
+e
erfc
(56)
40
2
2
As 0, Si (, z) goes to




|z zi |

1
|zzi |2 /(4 2 )
S

e
|z zi | erfc
i (0, z) =
2
2
0



|z

z
|
|z

z
|
2
2
i
i
=
e|zzi | /(4 )
erfc
20
2
0

(57)

Thus for self-consistency, we require that as 0, L


i (, z) goes to
L
i (0, z) Si (0, z)
i (0, z) =
|z zi |
=
Si (0, z)
2 0



|z zi |
|z zi |
|zzi |2 /(4 2 )
=
e

erf
20
2
0

(58)

The next step is to convert Si (, z) to real space. We do so by inverse Fourier transform.


1 X S
Si (r) =
(, z) ei
A i
XZ
1
2 2
2

=
ei(i ) e t |zzi |/(4t ) dt
A 0
0
k
#
Z "X
1
2
i(i ) 2 t2

=
e
e
e|zzi |/(4t ) dt
A 0 0
k

This identity is related to the one used in Appendix A due to the following inverse Fourier transform identity.
Z
h
i
2
2 2
2
2 2
2 2
2
2
1
1
F 1 2 t e( +kz )t =
2 t e( +kz )t eikz z dz = e t z /(4t )
(53)
2

10

Notice that the summation in the bracket is simply the inverse Fourier transform of a 2-dimensional
Gaussian distribution (identifying t with 2 /2). Hence,
Z
2
2
1 X e|i +mL| /(4t ) |zzi |/(4t2 )
S
i (r) =
e
dt
4 t2
0 m 0
Z
2
2
1 X e|rri +mL| /(4t )
dt
=
4 t2
0 m 0


1
1 X
1
|r ri |

=
erfc

2
0 4 n |r ri |


1
1 X
|r ri |

(59)
=
erfc
40 n |r ri |
2
In the last step, we have used the correspondence = 2 /2. Eq. (59) is identical Eq. (49), meaning
that physically the charge distribution are split in the same way in 3D and 2D Ewald summation.
In 3D Ewald sum, the k = 0 term represent a constant potential field in 3D space and can be
set to zero (without introducing any measurable effect.) In 2D Ewald sum, however, the = 0
term represent a constant potential field in 2D plane but its value can depend on z, as in Eq. (58).
So more care must be taken to evaluate the = 0 term in 2D Ewald sum [4, 5].

One-dimensional Ewald Summation

Now consider a 1-dimensional periodic array of point charges parallel to the z-axis. The potential
produced by these charges is
1 X
qi
i (r) =
(60)
40 t |r ri + tL|
where tL is lattice repeat vectors along the z-axis. tx = 0, ty = 0, tz = 0, 1, 2, . The
1-dimensional Fourier transform of i (r) is
qi
K0 (
|kz |) eikz zi
(61)
20
p
where = (x, y), = (x xi )2 + (y yi )2 , K0 is the modified Bessel function of the second
kind.2 Notice that in the limit of 0,
i (, kz ) =

i (, kz ) =

qi
ln
20

(62)

Notice that as long as |z zi | > 0, i (, kz ) decays exponentially fast with kz . In this case, the
summation over reciprocal space will be absolutely convergent.3 However, the summand blows up
when = 0. In practice, the decay rate becomes very slow even if is non-zero but very small.
To construct absolutely convergent sums, we first try a similar approach as in Appendix A and
use the following identity.
Z Z 
Z
1 kz2 t2 2 /(4t2 )
1 kz2 t2 2 /(4t2 )
K0 (
|kz |) =
e
dt =
+
e
dt
(63)
t
t
0

0
2

(1)

(1)

K (x) = 2 i+1 H (ix). H = J (x) + iY (x) is the Hankel function. J (x) is Bessel function of the first
kind. Y (x) is Bessel function
p of the second kind.
3
For large x, K (x) 2x ex .

11

However, I am not able (yet) to find an analytic expression for the partial integral,
Z
1 kz2 t2 2 /(4t2 )
e
dt
0 t

(64)

This means difficulty in extending the above approach to construct a 1-dimensional Ewald sum.
To make progress, we split i (r) into a short-range and a long-range part in a different way,
i (r) = Si (r) + L
i (r)

(65)

where
L
i (r) =

qi X
1
p
40 t
|r ri + tL|2 + 2

(66)

where is a constant smoothing-out parameter. The analytic structure of L


i (r) is very similar
to that of i (r). For example, its 1-dimensional Fourier transform is,
qi
(67)
L
K0 (
|kz |) eikz zi
i (, kz ) =
20
p
where = 2 + 2 . For any > 0, always stays positive and K0 (
|kz |) is both finite at
small kz and rapidly decaying at large kz . The short-range potential is simply
!
X
q
1
1
i
Si (r) =
p
(68)
40 t
|r ri + tL|
|r ri + tL|2 + 2
It is easy to show that the summand 1/|tL|3 for large t. Hence the summation is absolutely convergent. The convergence speed is not as fast as that in 2D and 3D Ewald summation (exponential
convergence). This is due to the difficulty in obtaining the analytic solution for the 1-dimensional
Fourier transform of the potential field of Gaussian charge distributions. The smooth charge distribution chosen here is not optimal in the sense that the real space sum converges only polynomially
fast. But the simplicity of the expressions is the advantage of this approach. The speed of convergence is not a critical issue given the one-dimensionality of the summation.

References
[1] P. P. Ewald, The calculation of optical and electrostatic grid potential, Ann. Phys. (Leipzig)
64, 253 (1921).
[2] S. W. de Leeuw, J. W. Perram and E. R. Smith, Simulation of Electrostatic Systems in Periodic
Boundary Conditions. I. Lattice Sums and Dielectric Constants, Proc. Roy. Soc. Lond. A 373,
27-56 (1980); ibid. Simulations of Electrostatic Systems in Periodic Boundary Conditions. II.
Equivalence of Boundary Conditions, Proc. Roy. Soc. Lond. A 373, 57-66 (1980).
[3] T. Darden, D. York and L. Pedersen, Particle mesh Ewald: An N log(N ) method for Ewald
sums in large systems, J. Chem. Phys. 98, 10089 (1993).
[4] F. E. Harris, Ewald Summations in Systems with Two-Dimensional Periodicity, Int. J. Quantum Chem. 68, 385 (1998).
[5] I.-C. Yeh and M. L. Berkowitz, Ewald summation for systems with slab geometry, J. Chem.
Phys. 111, 3155 (1999).

12

Potrebbero piacerti anche