Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Contents
1 Problem Statement
6 Implementation Issues
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)
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
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)
(10)
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).
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)
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
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)
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
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)
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)
N
X
L
i (k)
(34)
i=1
(35)
j=1
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
(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)
S
(k)
+
c.c.
fjL =
2V 0
k2
rj
(42)
k6=0
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
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.
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)
|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)
|z zi |
|z zi |
|zzi |2 /(4 2 )
=
e
erf
20
2
0
(58)
=
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].
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)
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