You are on page 1of 45

Ewald summation

Volodymyr P. Sergiievskyi
July 5, 2014

1 Charge splitting
The task is to compute the coulomb potential in a periodic boundary conditions.
1 X X qi qj 1 X X X q i qj
U= + (1)
2 i j6=i rij 2 n6=0 i j rij + n ◦ L

where n ≡ (nx , ny , nz ) ∈ Z3 , L ≡ (Lx , Ly , Lz ) is the size of the simulation box 1 . The symbol ◦
represents the Hadamard (pointwise) product: n ◦ L = (nx Lx , ny Ly , nz Lz ) .
Energy can be rewritten in terms of potential:
X
U= qi φi (ri ) (2)
i

where φi (r) is the potential, created by all the charges except the charge i:
X qj XX qj
φi (r) = + (3)
j6=i
rij n6=0 j |rij + n ◦ L|

Because the sum is converging only conditionally, the following technique is used for the cal-
culation: charges are splited into two parts.
1. The first part is the charges, screened with the gaussiansof opposite sign
2. The second part are the gaussians, to compensate ones added for the screening
This is represented in Figure 1. Mathematically, initial distributions of the point charges can
be represented as a sum of delta-functions. Thenm split can be written numerically as follows:
XX
ρ(r) ≡ qi δ(r − ri − n ◦ L) = ρ0 (r) + ρ1 (r) (4)
n

where 3/2 !
α2

−α2 (r−ri )2
XX
ρ0 (r) ≡ qi δ(r − ri − n ◦ L) − e (5)
n i
π
and
X X  α2 3/2 2 (r−r −n◦L)2
ρ1 (r) ≡ qi e−α i
(6)
n i
π
1
Here and below the atomic units are used, such that 4π0 ≡ 1 in coulomb law

1
Figure 1: Ewald sum decomposition: point charge interactions are replaced by sum of two inter-
actions: point charges with screened charges and pont charges with complementary gaussians

2
2 Potential of a gaussian charge
To calculate the potential of the charge distributions we can use the Poisson equation:

−∇2 φ(r) = 4πρ(r) (7)

Let’s calculate the potential of the gaussian charge distribution distributed around the origin:
 2 3/2
α 2 2
ρG (r) ≡ q e−α r (8)
π
Because the system in this case is spherically symmetric, we can use the spherical coordinates:
1 ∂ 2 (rφG )
∇2 φG ≡ (9)
r ∂r2
which gives the following equation:
3/2
∂ 2 (rφG ) α2

2 r2
− = 4πrq e−α (10)
∂r2 π
RR
Taking ∞
dr of both parts we find:
R  2 3/2 Z R
∂(rφG ) α 1 −α2 r2
− = −2qπ e (−2rα2 )dr (11)
∂r 0 π α2 ∞

Using that ∂φG /∂r(∞) = 0 and 2rα2 dr ≡ d(−α2 r2 ) we have


 2 1/2
∂(RφG ) α 2 2
= 2q e−α R (12)
∂r π
RR
Changing r → R and taking the integral 0 dr of both parts we have

RφG (R) − 0φG (0) = qerf(αR) (13)


Rx 2
where erf(x) ≡ √2
π 0
e−t dt is a Gauss error function. This gives the following potential:
q
φG (r) = erf(α|r|) (14)
|r|

3 Energy of the screened charges (real-part sum)


The potential of sum of charges is sum of the potentials of the single charges. For the single
screened charge we have:
 2 3/2 !
α 2 2
ρ0i (r) = qi δ(r − ri ) − e−α (r−ri ) (15)
π

The potential for this charge will be


qi qi qi
φ(r; ri , qi ) = − erf(α(r − ri )) ≡ erfc(α(r − ri )) (16)
r − ri r − ri r − ri

3
Then the potential of all charges except the i-th one can be written as follows:
X XX
φ0i (r) ≡ ψ(r; rj , qj ) + ψ(r; rj + n ◦ L, qj ) (17)
j6=i n6=0 j

X qj XX qj
= erfc(α(r − rj )) + erfc(α(r − rj − n ◦ L)) (18)
j6=i
|r − rj | n6=0 j
|r − r j − n ◦ L|

The energy of interaction of charges in the simulation box with this field can be written as
follows:
1X 0 1 X X qi q j 1 XXX q i qj
U0 ≡ qi φi (ri ) = erfc(αrij )+ erfc(α(ri −rj −n◦L))
2 i 2 i j6=i rij 2 n6=0 i j |ri − rj − n ◦ L|
(19)
In principle, the sum is taken for infinite number of box replications n = (nx , ny , nz ) where
nx , ny , nz = 0, 1 . . . ∞. However, erfc(x) decays fast, so the sum can be truncated after some
number of replications. For example, the sum can be taken only for n where n2x + n2y + n2z < n2max
with nmax =3 or 4.

4 Interaction of the charges with gaussians (fourier space


sum)
4.1 Basis set
Smooth functions, defined in volume V = Lx × Ly × Lz can be represented in a Fourier form:
1 Xˆ
f (r) = f (km )eikm r (20)
V m
 
2πmx 2πmy 2πmz
where m ≡ (mx , my , mz ) ∈ Z3 and km ≡ (km
x y
, km z
, km )≡ Lx
, Ly , Lz
To prove it, we check that the system {eikm r : m ∈ Z3 , r ∈ V } is orthonormal with respect to
the following scalar product: Z
1
ha(r), b(r)i ≡ a(r)b(r)dr (21)
V V
where x means complex conjugation.
Indeed Z
1
he ikm1
,eikm2
i= ei(km1 −km2 )r dr = (22)
V V
ZLx ZLy ZLz
1 x −k x )x y y z z
i(km
e 1 m2
dx i(km
e 1
−km 2
)y
dy ei(km1 −km2 )z dz (23)
V
0 0 0

x x
R Lx
Let’s calculate the first multiplier. If km 1
= km 2
we have 0
1dx = Lx . Otherwise

ZLx
x x 1 x x
ei(km1 −km2 )x dx = x x
(ei(km1 −km2 )Lx − e0 ) (24)
i(km 1
− km2 )
0

4
Considering the definition of km we have:
x x 2πi x x
ei(km1 −km2 )Lx = e Lx (m1 −m2 )Lx = cos(2π(mx1 − mx2 )) + i sin(2π(mx1 − mx2 )) = 1 (25)

Thus,
ZLx
x x
ei(km1 −km2 )x dx = Lx δmx1 ,mx2 (26)
0

And in general Z
1
ei(km1 −km2 )r dr = δm1 m2 (27)
V V

So, {eikm r : m ∈ Z3 , r ∈ V } is the basis in volume V.

4.2 Fourier representation of gaussian densities


We consider the Fourier representation of the gaussian density (6):
1 X
ρ1 (r) = ρ̂1 (km )eikm r (28)
V m

To find a particular coefficient ρ̂1 (km0 ) we can multiply both parts by e−ikm0 r and integrate
over r. Using the definition of scalar product we have:
Z
1 1 Xˆ 2
ρ1 (r)e−ikm0 r dr = f (km )heikm r , eikm r i (29)
V V m

Considering the orthonomality of the basis set (27) and equality


X
ρ̂1 (km )δmm0 = ρ̂1 (km0 ) (30)
m

we have Z
ρ̂1 (km0 ) = ρ1 (r)e−ikm0 r dr (31)

Using the density (6) we have:


Z X X  α2 3/2 Z X  2 3/2
α
−α2 (r−rj −n◦L)2 2 (r−r −n◦L)2
X
−ikm r
ρ1 (km ) = e qj e dr = e−ikm r qj e−α j
dr
V n j
π V n
π j
(32)
0 0 0 0
Changing theR integration variable to r , such that r ≡ r +n◦L we have dr = dr , r−r −n◦L =
r0 − rj , V dr = V −n◦L dr0 . This gives the following representation:
R

3/2
α2
XZ 
0 2 (r0 −r )2
X
ρ̂1 (km ) = e−ikm r e−ikm (n◦L) qj e−α j
dr0 (33)
n V −n◦L π j

Now, we can see, that e−ikm (n◦L) = 1. Indeed,


2πmx 2πmy
−i ny Ly −i 2πmz nz Lz
e−ikm (n◦L) = e−i Lx
nx Lx
e Ly
eL z (34)

5
and e−i2πmn = cos(2πmn) − i sin(2πmn) = 1 P R
In that case the term under the integral does not depend on n, and we can charge n V −n◦L
R
to R3 :
X  α2 3/2 Z 0 2 0 2
ρ̂1 (km ) = qj e−ikm r e−α (r −rj ) dr0 (35)
j
π R3

This in turn can be rewritten in a following form:


3/2 Z
α2

2 (r0 −r )2 −ik (r−r )
X X
ρ̂1 (km ) = qj e−α j m j
e−ikm rj d(r0 − rj ) = qj e−ikm rj Ĝα (km ) (36)
j
π R3 j

where 3/2 Z
α2

2 r2
Ĝα (km ) = e−α e−ikm r dr (37)
π R3

is a Fourier transformed Gaussian function. The three-dimensional transformation is product of


1-d transformations:
3/2 Z∞ Z∞ Z∞
α2

y
−α2 x2 −ikm
x x −α2 y 2 −ikm 2 z2 z
Ĝα (km ) = e e dx e y
e dy e−α e−ikm z dz (38)
π
−∞ −∞ −∞

In the x direction we have:


Z∞ Z∞ x 2 x 2 2 x 2
2 (x2 +2 ikm x+ i (km ) )+α2 i (km )
−α2 x2 x x
e e −ikm
dx = e−α 2α2 4α4 4α4 dx (39)
−∞ −∞

Z∞ r

x )2
(km 1 −α2 (x+
x
ikm
)2 ik x x )2
(km π
=e 4α2 e 2α2 dα(x − m2 ) = e− 4α2 (40)
α 2α α2
−∞
R∞ 2 √
where we used the Gaussian integral value: −∞ e−t dt = π
This gives the following value for the Fourier transformed Gaussian:
x )2 y z )2
(km (km )2 (km |km |2
− − −
Ĝα (km ) = e 4α2 e 4α2 e 4α2 = e− 4α2 (41)

and X |km |2
ρ̂1 (km ) = qj e−ikm rj e− 4α2 (42)
j

4.3 Poisson equation in a Fourier space


Let’s write the Fourier representations of charge and potential functions:
1 X
ρ(r) = ρ̂(kp )eikp r (43)
V p

1 X 1 X x y z
φ(r) = φ̂(ks )eiks r = φ̂(ks )eiks x eiks y eiks z (44)
V s V s ,s ,s
x y z

6
Figure 2: Potential acting on some specific charge can be represented as a difference of the total
potential of all gaussians and self-interaction potential.

Laplacian operator ∇2 can be rewritten as a sum:


∂ 2φ ∂ 2φ ∂ 2φ
∇2 φ(r) = + + 2 (45)
∂x2 ∂y 2 ∂z
Then, the x summand is
∂2 X iksx x iksy y iksz z
X x y z

2
φ̂(k s )e e e = i2 (ksx )2 )φ̂(ks )eiks x eiks y eiks z (46)
∂x s ,s ,s s ,s ,s
x y z x y z

The derivatives over y and z are analogous. Thus, the expression for the Laplacian is:
X X
∇2 φ(r) = i2 ((ksx )2 + (ksy )2 + (ksz )2 )φ̂(ks )eiks r = − |ks |2 φ̂(ks )eiks r (47)
sx ,sy ,sz s

Inserting this into the Poisson equation we have:


X X
|ks |2 φ̂(ks )eiks r = 4π ρ̂(kp )eikp r (48)
s p

Multiplying both parts by e−ikm r , integrating over V and using the orthogonality 1/V e−ikp r e−ikm r dr =
R
V
δmp we have:
|km |2 φ̂(km ) = 4π ρ̂(km ) (49)
and

φ̂(km ) = ρ̂(km ) (50)
|km |2

4.4 Gaussian interaction energy


Now, we can compute the total potential φ1tot (r) of all gaussian densities. To do this, we insert the
gaussian density representation in k-space (42) into the Poisson equation (50):
4π X −ikm rj − |km2|2
φ̂1tot (km ) = qj e e 4α (51)
|km |2 j

which gives the following potential in r-space:


1 X 1 1 1 X 4π X ikm (r−rj ) − |km2|2
φ1tot (r) = φ̂tot (km )eikm r = φ̂1tot (k = 0) + qj e e 4α (52)
V m V V m6=0 |km |2 j

7
The value at k = 0 should be computed separately. The case φ̂1tot (k = 0) = 0 corresponds to the
metallic media which surrounds the macroscopic simulation box.
The potential energy can be computed as follows:
1X 1
U1 = φ (rs )qs (53)
2 s s

where
φ1s (rs ) ≡ φ1tot (rs ) − φsG (rs ) (54)
is the potential, created by all the charges except the charge s, and φsG (rs ) is a “self-interaction”
of point charge s with the gaussian which represents this charge (see Figure 2 ).
Potential of one gaussian was computed before ( eq. (14) ). We only shift it to the position rs
qs
φsG (r) = erf(α|r − rs |) (55)
|r − rs |
To compute the energy, we need the potential at point rs :
erf(α|r − rs |)
φsG (rs ) = qs lim (56)
|r−rs |→0 |r − rs |
Defining R ≡ |r − rs | and using the definition of erf function we can expand it into the Taylor
series: Z R Z R
2 −t2 2 2
erf(R) = √ e dt = √ (1 − t2 + . . . )dt = √ R + o(R2 ) (57)
π 0 π 0 π
q
2
This gives erf(αR) ≈ 2 απ R and
r
erf(αR) α2
φsG (rs ) = qs lim = 2qs (58)
R→0 R π
Inserting this into expression for the potential energy (53) we have:
1X 1 1X s
U1 = φtot (rs )qs − φ (rs )qs (59)
2 s 2 s G
r
1 1X 1 X 4π 1 X X |km |2
ikm rjs − 4α 1X 2 α2
= φ̂1tot (k = 0) qs + q j q s e e 2
− 2qs (60)
V 2 s 2 m6=0 |km |2 V j s 2 s π

Assuming φ1tot (k = 0) < ∞, and adding this sum to the real-space sum (19)we have :

U = U0 + U1 = (61)
r
1 X 4π X X |km |2
ikm rjs − 4α α2 X 2
q j q s e e 2
− q (62)
2V m6=0 |km |2 j s π s s
1 X X qs qj 1 XXX qs q j
+ erfc(αrsj ) + erfc(α(rs − rj − n ◦ L)) (63)
2 s j6=s rsj 2 n6=0 s j |rs − rj − n ◦ L|

Note, we can also change eikm rjs to cos(km rjs ) in the first summand, because i sin(...) is odd,
and thus vanishes in sum of terms with m and −m. This makes the sum consistent with Ref. [1].

8
5 Ewald Sums Generalization for 1/rw potentials
5.1 Patterson function
With some modifications one can apply the Ewald technique not only to the 1/r Coulomb poten-
tialsm but also to a general potentials 1/rw for arbitrary m. In this section the methods given in
[2] and [3] is described with small modifications.
So, let we need to calculate the Lattice energy
1 X Ajs
S= (64)
2 j,s,n
|rj − rs + n ◦ L|w
rj 6=rs +n◦L

where rj , rs are the particle positions, L ≡ (Lx , Ly , Lz ) is the box size, n ≡ (nx , ny , nz ) ∈ Z3 is the
index of the box replica, n ◦ L = (nx Lx , ny Ly , nz Lz ) is the point-wise multiplication.
To avoid the sum divergence due to infinite singularities, we can rewrite the sum in a following
way:
1 X Ajs φ(rjs;n ) 1 X Ajs (1 − φ(rjs;n ))
S= w
+ w
(65)
2 j,s,n rjs;n 2 j,s,n rjs;n
rjs;n 6=0 rjs;n 6=0

where rjs;n ≡ |rj − rs + n ◦ L|, φ(r) is a smooth decaying function, such that φ(0) = 1, φ(∞) = 0
The sum can be represented in the integral form. To do it, first let’s assume that the space is
descritized in such a way, that atoms can have only positions in the grid points. The number of
grid points in the box of volume V is Nx × Ny × Nz . Increasing Nx , Ny , Nz we can locate atoms
with any necessary accuracy, so this assumption is not a big limitation of generality.
Now, we consider the Patterson function
Nx ,Ny ,Nz Nx ,Ny ,Nz
1 X X
ikm r 1 X X
P (r) = F2 (km )e = Ajs exp(2πi(m ÷ L) · (r + rs − rj )) (66)
V js m ,m ,m =0 V js m ,m ,m =0
x y z x y z

where m ≡ (mx , my , mz ), L ≡ (Lx , Ly , Lz ),


X
F2 (km ) = Ajs exp(km (rs − rj )) (67)
js

, km ≡ 2πm ÷ L, ÷ is a point-wise division, i.e. m ÷ L = (mx /Lx , my /Ly , mz /Lz ). We consider


the case when the particle positions are sticked to the grid points, i.e.

r≡p◦L÷N rj ≡ pj ◦ L ÷ N (68)

where p, pj ∈ Z3 , N ≡ (Nx , Ny , Nz ). Considering the case Nx , Ny , Nz → ∞ we have


Nx Nx
1 X mx px + pxs − pxj 1 X mx
exp(2πi Lx ) = exp(2πi ∆px ) (69)
Nx m =0 Lx Nx Nx m =0 Nx
x x

where ∆px ≡ px + pxs − pxj .


We consider the case Nx → ∞. Then, there are two cases:
1. ∆px = nx Nx , nx ∈ Z

9
2. ∆px 6= nx Nx

In the first case we have


mx
exp(2πi Nx M ) = exp(2πimx nx ) = 1 (70)
Nx
and
Nx
1 X mx
Nx exp(2πi ∆px ) = Nx (71)
Nx m =0 Nx
x

In the second case if Nx → ∞ the sum above can be rewritten in a terms of integral, i.e.:

Nx Z 1
1 X mx x Nx
Nx exp(2πi ∆p ) → Nx exp(2πit∆px )dt = (exp(2πi∆px ) − exp(0)) = 0 (72)
Nx m =0 Nx 2πi∆px
x 0

The first case is equivalent to the following:

x x
px + pxs − pxj
∆p = p + pxs − pxj = nx Nx ⇒ Lx = x + xs − xj = nx Lx (73)
Nx
The same in three dimensions:
r + rs − rj = n ◦ L (74)
Then, the two above cases can be summarized in a following formula:
N
X X
exp(2π(m ÷ L) · (r + rs − rj ) = Nx Ny Nz ζ(r + rs − rj − n ◦ L) (75)
m=0 n∈Z3

where ζ(r) for r ≡ p ◦ L ÷ N is defined in a following way:

ζ(r) = ζ(p ◦ L ÷ N) = δpx δpy δpz (76)

This gives the following expression for P (r):

Nx Ny Nz X X
P (r) = Aj s ζ(r + rs − rj − n ◦ L) (77)
V js 3 n∈Z

5.2 Integral representation


The sum (65) can be rewritten in a following form:

1 − φ(|r|)
Z Z
1 φ(|r|) 1
S= (P (r) − ζ(r)P (r)) dr + (P (r) − ζ(r)P (r)) dr (78)
2 R3 |r|w 2 R3 |r|w

where ζ(r) ≡ δ(r)/δ(0)


Indeed
P − ζP )φ (P − ζP )1 (P − ζP )1
Z Z Z Z Z
P ζP
S = 1/2( w
+ w
− w
) = 1/2 w
− 1/2 (79)
r r r r rw

10
The first summand is
ζ(r + rs − rj − n ◦ L)
Z Z
1 P (r) 1 Nx Ny Nz X X
w
dr = Ajs (80)
2 |r| 2 V js n R3 |r|w

We have the discrete grid in the real space. Thus, the integral over the whole space can be rewritten
in a form of sum. In that case the number of grid points in the box of volume V = Lx Ly Lz is
N = (Nx , Ny , Nz ), thus grid step is V /Nx Ny Nz . The sum then is rewritten as follows:

1 Nx Ny Nz X X X ζ(r + rs − rj − n ◦ L) V 1 XX Ajs
S= Ajs w
=
2 V js n p=−∞
|r| Nx Ny Nz 2 js n |rj − rs + n ◦ L|w
(81)
there the sum is taken over all j and s, including self interaction (j = s, n = 0 ).
The second summand is responsible for the self-interactions:
Z
1 P (r) 1 XX Ajs
ζ(r) w dr = ζ(rs − rj + n ◦ L) (82)
2 R3 r 2 js n |rs − rj + n ◦ L|w

Because all atoms are inside the box, ζ(rs − rj + n ◦ L) is non-zero only when n = 0 and s = j.
Thus, the second summand is
1 XX Ajs
δjs δnx δny δnz (83)
2 js n |rs − rj + n ◦ L|w

Combining both summands we have


Z
1 1 1 X Ajs
S= (P (r) − ζ(r)P (r)) w dr = (84)
2 R3 |r| 2 jsn
|rj − rs + n ◦ L|w
rs −rj +n◦L6=0

5.3 Parseval theorem


As it was shown, the sum (65) can be splitted into several parts. Indeed, in expresion (65) we see
that
S = S1 + S2 (85)
where
X X Asj φ(|rs − rj + n ◦ L|)
S1 = (86)
n js
|rs − rj + n ◦ L|w
rs −rj +n◦L6=0

X X Asj (1 − φ(|rs − rj + n ◦ L|))


S2 = (87)
n js
|rs − rj + n ◦ L|w
rs −rj +n◦L6=0

The function φ(r) decays to zero, thus the sum S1 can be computed directly in real space. The
second sum S2 can be represented using the Petterson function (66):

1 − φ(r)
Z
1
S2 = (P (r) − ζ(r)P (r)) dr = I21 − I22 (88)
2 R3 |r|w

11
where
1 − φ(r)
Z
1
I21 = P (r) dr (89)
2 R3 |r|w
1 − φ(r)
Z
1
I22 = ζ(r)P (r) dr (90)
2 R3 |r|w
The second integral I22 can be also calculated directly. In assumption of discrete particle
positions and using the representation (77) we have
1 X Nx Ny Nz X X 1 − φ(r) V
I22 = Ajs ζ(p) ζ(r + rs − rj − n ◦ L) w
(91)
2 p V js n
|r| Nx Ny Nz

Again, ζ(r)ζ(r + rs − rj − n ◦ L) = δsj δnx δny δnz which gives

1X 1 − φ(|rs − rj |)
I22 = Ajj lim (92)
2 j rs →rj |rs − rj |w

For the first integral I21 we can use the Parseval’s theorem. Let’s use the following definitions
of the direct and inverse continous Fourier transformations:
Z
F T3 [f (r)](h) ≡ f˜(h) = f (r) exp(2πih · r)dr (93)
R3
Z
IF T3 [f˜(h)](r) ≡ f (r) = f˜(h) exp(−2πih · r)dh (94)
R3
The reason, why we are using exactly these definitions is that the same definitions are used in Ref.
[4], where results for the particular useful for us φ-functions are discussed.
Then Parseval’s theorem can be written in a following way:
Z Z
f (r)g(r)dr = f˜(h)g̃(h)dh (95)
R3 R3

Indeed, using the definitions above


Z Z Z Z
f (r)g(r)dr = dr dh1 f˜(h1 ) exp(−2πh1 · r) dh2 g̃(h2 ) exp(−2πh2 · r) (96)
ZZ Z
= dh1 dh2 f˜(h1 )g̃(h2 ) exp(2πi(h2 − h1 ) · r)dr (97)
ZZ Z
= dh1 dh2 f˜(h1 )g̃(h2 )δ(h2 − h1 ) = f˜(h)g̃(h)dh (98)

Using this relation for the integral I21 (89) we have


 
1 − φ(|r| 1 − φ(|r|
Z Z
I21 = P (r) dr = P̃ (h)F T3 (h)dh (99)
R3 |r|w R3 |r|w

We can calculate the continuous Fourier transformation of the Petterson function P̃ (h). Using
the definition (66) we have Z
P̃ (h) = P (r) exp(2πh · r)dr (100)
R3

12
1 X XZ
= Ajs exp(2πi(m ÷ L) · (r + rs − rj )) (101)
V js m R3
Z
1 X X
= Ajs exp(2πi(m ÷ L) · (rs − rj ) exp(2πi((m ÷ L) + h) · r)dr (102)
V js m R3

1 X X
= Ajs δ((m ÷ L) + h) exp(2πi(m ÷ L) · (rs − rj )) (103)
V js m

We see, that the function is non-zero only in the Fourier points h = −(m ÷ L), and also up to the
δ factor is equal to the function F2 , defined previously (67).

5.4 Special choice of φ


5.4.1 Definition
In [4] and later in [2] it is proposed to use the following φ function:

Γ(w/2, K 2 πr2 )
φ(r) = (104)
Γ(w/2)

where Z ∞
Γ(w/2, a) ≡ tw/2−1 e−t dt (105)
a

Γ(w/2) ≡ Γ(w/2, 0) is a Gamma function, and K is some constant. To be consistent with our
previous definitions, we require that the following equality holds:

α2 = πK 2 (106)

where α is a constant used in Ewald procedure. Thus, we can re-write the definition of φ:
Z∞
1
φ(r) = tw/2−1 e−t dt (107)
Γ(w/2)
α2 r 2

For w = 1 we have:
Z∞ Z∞ √

2 2 −1/2 −t −( t)2 dt π
Γ(1/2, α r ) = t e dt = 2 e √ =2 erfc(αr) (108)
2 t 2
α2 r 2 t=α

2 r2
t=αr


From the same expression we find Γ(1/2) = π which gives

φ(r) = erfc(αr) (109)

13
5.4.2 Fourier part
Now we can use this function in our derivations. In Ref. [4], Appendix 3, the Fourier transformation
of (1 − φ(r))/rw is given, and after that generalized for K 6= 1 in Ref. [2]:

π w−3/2 hw−3 πh2


 
1 − φ(r)
F T3 = Γ(−w/2 + 3/2, ) (110)
rw Γ(1/2) K2

In our notation
α2 πh2 πh2 π 2 h2
πK 2 = α2 ⇒ K 2 = ⇒ 2 = 2 = 2 (111)
π K α /π α
Inserting (103) and (110) into (99) we have

π w−3/2 hw−3 π 2 h2
Z
1 X X
I21 = Ajs δ((m÷L)+h) exp(2πi(m÷L)·(rs −rj )) Γ(−w/2+3/2, 2 )dh
2V R3 js m
Γ(w/2) α
(112)
Using the properties of δ function this integral can be rewritten as a sum, with h = −m ÷ L:

1 π w−3/2 X π 2 |hm |2
I21 = F2 (2πhm )|hm |w−3 Γ(−w/2 + 3/2, ) (113)
2V Γ(w/2) m α2
P
where hm ≡ m ÷ L, F2 (2πhm ) = js Ajs exp(2πihm · (rs − rj )) ThereP is the special case m = 0. If
w ≤ 3, than the sum diverges in general case, and the condition sj Asj = 0 required. For w > 3
in Ref. [2] the following expression is given (without the proofs or explanations):

πh2 2
lim F2 (h)hw−3 Γ(−w/2 + 3/2, 2
) = F2 (0)π 3/2−w/2 K w−3 (114)
h→0 K w−3
To prove this relation, we can use the following property of Γ(z; b2 ):
Z ∞ ∞ Z
z −t2 2
2
Γ(z + 1; b ) = t e dt = t e − z (−e−t )tz−1 dt = b2z e−b + zΓ(z; b2 )
z −t
(115)
b2 b2

Which gives the reccurent formula:


1 1 2
Γ(z; b2 ) = Γ(z + 1; b2 ) − b2z e−b (116)
z z
1 1 2 1 2
= Γ(z + 2; b2 ) − b2(z+1) e−b − b2z e−b (117)
z(z + 1) z(z + 1) z
1 1 2 1 2 1 2
= Γ(z + 3; b2 ) − b2(z+2) e−b − b2(z+1) e−b − b2z e−b (118)
z(z + 1)(z + 2) z(z + 1)(z + 2) z(z + 1) z
= ... (119)
Applying this procedure M times we get the following representation
M −1
2 Γ(z + M ; b2 ) −b2
X b2(z+p)
Γ(z; b ) = −e (120)
z(z + 1)...(z + M − 1) p=0
z(z + 1)...(z + p)

14
For z = 3/2 − w/2, b2 = πh2 /K 2 ,M > w/2, we have
M −1 w−3 z+p 2(z+p) −2(z+p)
w−3 2 hw−3 Γ( 23 − w2 + M ; b2 ) −b2
X h π h K
h Γ(z; b ) = −e (121)
z(z + 1)...(z + M − 1) p=0
z(z + 1)...(z + p)

Using that 2(z + p) = 3 − w + 2p we have


M −1 3/2−w/2+p w−3−2p
w−3 2hw−3 Γ( 23 − w2 + M ; b2 ) −b2
X π K
h Γ(z; b ) = −e h2p (122)
z(z + 1)...(z + M − 1) p=0
z(z + 1)...(z + p)

Taking a limit h → 0, b → 0, we have

Γ(3/2 − w/2 + M ; b2 ) = Γ(3/2 − w/2 + M ) < ∞ (123)

(because 3/2 − w/2 + M > 1 and Γ behaves like factorial in this region), hw−3 → 0, h2p → 0 when
p>0
The only non-zero term is a summand at p = 0:

3 w e0 π 3/2−w/2 K w−3 2
hw−3 Γ( − ; b2 ) → − = π 3/2−w/2 K w−3 (124)
2 2 3/2 − w/2 w−3

In that case, considering that F2 (0) = sj Asj and K w−3 = (α2 /π)0.5(w−3) we have
P

!
3/2−w/2 w−3 2 X αw−3 2
F2 (0)π K = Asj π 3/2−w/2 (125)
w−3 sj
π w/2−3/2 w−3
!
X 2
= Asj π 3−w αw−3 (126)
sj
w−3

Then we can write I21 in a following way:


!!
π w−3/2 X π 2 |hm |2 2 X
I21 = F2 (2πhm )|hm |w−3 Γ(−w/2 + 3/2, ) + π 3−w w−3
α Asj
2V Γ(w/2) m6=0
α2 w−3 sj
(127)
!!
2 2
1 X π |hm | 2 X
= π w−3/2 F2 (2πhm )|hm |w−3 Γ(−w/2 + 3/2, ) + π 3/2 w−3
α Asj
2V Γ(w/2) m6=0
α2 w−3 sj

P (128)
(Again, for w < 3 we have Asj = 0, and there are no second summand)

5.4.3 Real part


We can also calculate the real integral I22 , using the formula (92) and definition of φ given by
(104). In this definitions we have

Γ(w/2, α2 r2 ) 1
Γ(w/2) − Γ(w/2, α2 r2 )

1 − φ(r) = 1 − = (129)
Γ(w/2) Γ(w/2)

15
Using the definition of Γ(w/2, a) we have
Z ∞ Z ∞ Z α2 r2
w/2−1 −t w/2−1 −t
2 2
Γ(w/2) − Γ(w/2, α r ) = t e dt − t e dt = tw/2−1 e−t dt (130)
0 α2 r 2 0

Using this representation we have for I22 the following expression:


! Z α2 r 2
1X 1 − φ(r) 1 X 1
I22 = Ajj lim = Ajj lim w tw/2−1 e−t dt (131)
2 j r→0 rw 2Γ(w/2) j
r→0 r 0

To find limiting value for the integral we can expand e−t into the Taylor series, i.e.
Z α2 r 2 Z α2 r 2 Z α2 r 2 Z α2 r 2
w/2−1 −t w/2−1 w/2−1
t e dt = t (1 − t + ...)dt = t dt − tw/2 dt + ... (132)
0 0 0 0
α2 r 2 α2 r 2
1 w/2 1
w/2+1 2 1 w+2 w+2
= t − t + ... = αw rw − α r + ... (133)
w/2 0 w/2 + 1
0 w w/2
This representation gives
Z α2 r 2
1 2 w
tw/2−1 e−t dt = α + O(r2 ) (134)
rw 0 w
Inserting this into (131) gives
!
1 X 2αw
I22 = Ajj (135)
2Γ(w/2) j
w

5.4.4 Final expression


Using the φ function definition (104) we can also write the real-space sum S1 :
1 X X Γ(w/2, α2 |rsj;n |2 )
S1 = Asj (136)
2Γ(w/2) n sj
|rsj;n |w
rsj;n 6=0

where rsj;n ≡ rs − rj + n ◦ L.
Combining now all the summands we can write the final expression for the latice sum:

S = S1 + I21 − I22 = (137)



1 X X Γ(w/2, α2 |rsj;n |2 )
Asj (138)
2Γ(w/2) |rsj;n |w

n sj
rsj;n 6=0

π w−3/2 X π 2 |hm |2
+ F2 (2πhm )|hm |w−3 Γ(−w/2 + 3/2, ) (139)
V m6=0 α2
! ! !
π 3/2 αw−3 2 X X 2αw
+ Asj − Ajj (140)
V w − 3 sj j
w

For α2 = πK 2 , Asj = qs qj this sum is the same as the result in Ref. [2]

16
6 Particular cases
6.1 w=1: electrostatic interaction
For w = 1 we have
Γ(1/2; α2 r2 )
φ(r) = = erfc(αr) (141)
Γ(1/2)

Γ(1/2) = π (142)
(see (108), (109) for the derivation).
Z ∞
2
2
Γ(−w/2 + 3/2; b ) = Γ(1; b ) = 2
e−t dt = e−b (143)
b2

Also, in case of electrostatic interaction we have

Asj = qs qj (144)
!2
X X
Asj = qj =0 (145)
sj j
X X
Ajj = qj2 (146)
j j
! !
X X X
F2 (2πhm ) = qs qj e2πihm (rs −rj ) = qj e−2πihm rj qs e2πihm rs = F (km )F (−km ) = |F (km )|2
sj j s
(147)
where X
F (km ) ≡ F (2πhm ) = qj e−2πihm rj (148)
j

Inserting this into the general expression for S (137) we have




1 X X πerfc(α|rsj;n |)
S= √  qs qj (149)
2 π n sj
|rsj;n |
rsj;n 6=0

π −1/2 X −π 2 |hm |2
+ |F (km )|2 |hm |−2 e α2 (150)
V m6=0
!!
X
−2α qj2 (151)
j

Using the definitions km ≡ 2πhm , F (km ) ≡ ρ̂(km ), we have

−2 1 4π 2
|hm | = = (152)
|km |2 /4π 2 |km |2

π 2 |hm |2 π 2 |km |2 /4π 2 |km |2


= = (153)
α2 α2 4α2
17
So, we have
r
1X X erfc(α|rsj;n |) 1 X 4π −|km2 |2 α2 X 2
S= qs qj + |ρ̂(km )|2 e 4α − q (154)
2 n sj
|rsj;n | 2V m6=0 |km |2 π j j
rsj;n 6=0

which is the same as the usual Ewald sum (61) with the Fourier component computed as (216).

6.2 Lennard-Jones interaction


6.2.1 General case: w=2k+2
The Lennard-Jones potential between the particles s and j in a general case can be defined as
12 6
4sj σsj 4sj σsj
  
σsj 12  σsj 6 Asj Bsj
Usj (r) = 4sj − = 12
− 6
= 12 − 6 (155)
r r r r r r

To calculate Ewald sums for the potentials 1/r6 and 1/r12 we can start from the more general case
w = 2k + 2 where k ∈ Z+ . To compute the sum (137) we need to know the values of two functions:

Γ( w2 ; a2 ) Γ(k + 1; a2 )
Φw (a) = = (156)
Γ( w2 ) Γ(k + 1)

Γ(− w2 + 32 ; b2 ) Γ(−k + 12 ; b2 )
Ψw (b) = = (157)
Γ( w2 ) Γ(k + 1)
For the Γ function there is a known relation which allows to calculate its values:

Γ(x + 1) = xΓ(x) (158)

In particular, Γ(k + 1) = k!. We can find the same relation for the function Γ(z; a2 ). To do it, we
use integration by parts:
Z∞ Z∞
z −t ∞ 2
−tz e−t a2 −e−t tz−1 dt = a2z e−a + zΓ(z; a2 )
2

Γ(z + 1; a ) = t e dt = −z (159)
a2 a2

Using this relation, we can calulate some particular values of Γ(z, a2 ). For example:
R∞ 2
k=z=0, w=2: Γ(1; a2 ) = e−t dt = e−a
a2
2 −a2 2 2
k=z=1, w=4: Γ(2; a ) = a e 2
+ e−a = e−a (1 + a2 )
2 2 2
k=z=2, w=6: Γ(3; a2 ) = a4 e−a + 2e−a (1 + a2 ) = e−a (2 + 2a2 + a4 )
In the general case
w 2
Γ( , a2 ) = Γ(k + 1; a2 ) = a2k e−a + kΓ(k; a2 ) (160)
2
2
 2

= a2k e−a + k · a2k−2 e−a + (k − 1)Γ(k − 1; a2 ) = ... (161)
2 2 2 2
= a2k e−a + ka2k−2 e−a + k(k − 1)a2k−4 e−a + ... + k!e−a (162)

18
This gives the following expression for φ(k + 1; a2 ):
k
Γ(k + 1; a2 ) a2k a2(k−1) a2 a2p
 
2 −a2
X
Φw (a) = = e−a + + ... + +1 =e (163)
Γ(k + 1) k! (k − 1)! 1! p=0
p!

We can also rewrite (159) from right to left, i.e.:

2 1 2 2z −b2

Γ(z; b ) = Γ(z + 1; b ) − b e (164)
z
Changing z → z − 1 we have

2 1  2 2z−2 −b2

Γ(z − 1; b ) = Γ(z; b ) − b e (165)
z−1
This relation allows us to calculate the values of Γ(− w2 + 32 ; b2 ) = Γ(−k − 1 + 3/2; b2 ) For a
given k argument is 3/2 − k − 1 = z − 1 which gives z = 3/2 − k Thus, we have
1 2
Γ(3/2 − k − 1; b2 ) = Γ(1/2 − k; b2 ) = (Γ(3/2 − k; b2 ) − b1−2k e−b ) (166)
1/2 − k


k = 0, z = 3/2, w = 2 : Γ(1/2 − k; b2 ) = Γ(1/2; b2 ) = πerfc(b)
√ 2
1
Γ(1/2 − 1; b2 ) = −1/2 ( πerfc(b) − b−1 e−b )
k = 1, z = 1/2, w = 4 : √ 2
= −2 πerfc(b) + 2b−1 e−b
√ 2 2
1
Γ(1/2 − 2; b2 ) = −3/2 (−2 πerfc(b) + 2b−1 e−b − b−3 e−b )
k = 2, z = −1/2, w = 6 : √ 2 2
= 43 πerfc(b) − 34 b−1 e−b + 23 b−3 e−b
We can also derive a general formula. We can do it step-by-step.

Γ(3/2 − w/2; b2 ) = Γ(3/2 − k − 1; b2 ) = Γ(1/2 − k; b2 ) (167)


1  2

= Γ(1/2 − k + 1; b2 ) − b1−2k e−b (168)
1/2 − k
2 2 2
= Γ(1/2 − k + 1; b2 ) − b1−2k e−b (169)
1 − 2k 1 − 2k
Recoursively changing Γ(1/2 − k + 1; b2 ) to its representation we have:

Γ(3/2 − w/2; b2 ) = (170)


2 1 2 1 2 2 2
= Γ(1/2 − k + 2; b2 ) − b3−2k e−b − b1−2k e−b (171)
(1 − 2k) (3/2 − k) (1 − 2k) 3/2 − k 1 − 2k
2 2 2 2 2 2 2
= Γ(1/2 − k + 2; b2 ) − b3−2k e−b − b1−2k e−b (172)
(1 − 2k) (3 − 2k) (1 − 2k) (3 − 2k) 1 − 2k

Doing this k times we come to Γ(1/2 − k + k; b2 ) = Γ(1/2; b2 ) = πerfc(b). So, we have the
following formula:
Γ(3/2 − w/2; b2 ) = (173)

19
2 2 2 √
= ... πerfc(b) (174)
(1 − 2k) (3 − 2k) (2k − 1 − 2k)
2 2 2 2
− ... b−1 e−b (175)
(1 − 2k) (3 − 2k) (2k − 1 − 2k)
2 2 2 2
− ... b−3 e−b (176)
(1 − 2k) (3 − 2k) (2k − 3 − 2k)
2 2 2 2
− ... b−5 e−b (177)
(1 − 2k) (3 − 2k) (2k − 5 − 2k)
−... (178)
2 2 2
− b3−2k e−b (179)
(1 − 2k) (3 − 2k)
2 2
− b1−2k e−b (180)
(1 − 2k)
Above equations can be rewritten using the following notation:

Γ(3/2 − w/2; b2 ) = (181)


1 √ 
k −1 −b2
= (−2) πerfc(b) − b e (182)
(2k − 1)!!
1!! 2
−(−2)k−1 b−3 e−b (183)
(2k − 1)!!
3!! 2
−(−2)k−2 b−5 e−b (184)
(2k − 1)!!
−... (185)
(2k − 5)!! 3−2k −b2
−(−2)2 b e (186)
(2k − 1)!!
(2k − 3)!! 1−2k −b2
−(−2) b e (187)
(2k − 1)!!
where (2m − 1)!! ≡ 1 · 3 · 5 · · · · · (2m − 1). This gives the following final formula (for w ≥ 4, k ≥ 1):
k−1
!
3 w 2 1 √ 2
 2
X
Γ( − ; b ) = (−2)k πerfc(b) − b−1 e−b − e−b (−2)k−p (2p − 1)!!b−2p−1
2 2 (2k − 1)!! p=1
(188)

20
6.2.2 Case w = 6
Using the general formulae (163) and (188) for the case w = 6 we have:
w 2
Γ( ; a2 ) = e−a 2 + 2a2 + a4

(189)
2
4√
 
3 w 2 4 −1 2 −3 −b2
Γ( − ; b ) = πerfc(b) + − b + b e (190)
2 2 3 3 3
w
Γ( ) = Γ(3) = 2! = 2 (191)
2
Inserting these values to the (137) we have

1 X X exp(−a2 )
2 + 2a2 + a4

S=  Asj 6
(192)
4 n sj
|rsj;n |
rsj;n 6=0

π 9/2 X 4√
   
3 4 −1 2 −3 −b2
+ F2 (2πhm )|hm | πerfc(b) + − b + b e (193)
V m6=0 3 3 3
! ! !
π 3/2 α3 2 X X 2α6
+ Asj − Ajj (194)
V 3 sj j
6
where a2 ≡ α2 rsj;n
2
, b2 ≡ π 2 |hm |2 /α2 .
After opening the brackets:
exp(−a2 )
 
1 X 2 1 4
S= Asj 1+a + a (195)
2 nsj |rsj;n |6 2
rsj;n 6=0

π 9/2 X √
   
3 1 1 −b2
+ F2 (2πhm )|hm | πerfc(b) + − e (196)
3V m6=0 2b3 b
! !
1 π 3/2 α3 X α6 X
+ Asj − Ajj (197)
6 V sj
12 j

This expression is the same as the result in [2], up to subtitution α2 → πK 2 , Asj → qs qj .


If we use the definition of a2 = α2 rsj;n
2 6
, we have rsj;n = a6 /α6 . Also, we can use that hm =
km /2π, and h3m = km3
/8π 3 . In that case the sum can be written as follows
α6 X
 
−6 −4 1 −2 −a2
S= Asj a + a + a e (198)
2 nsj 2
rsj;n 6=0

π 3/2 X √
   
3 1 1 −b2
+ F2 (km )|km | πerfc(b) + − e (199)
24V m6=0 2b3 b
! !
1 π 3/2 α3 X α6 X
+ Asj − Ajj (200)
6 V sj
12 j

In this representation the sum is the same that eq. (24) in Ref. [3], up to subtitution α → 1/η,
Asj → Bsj , V → Ω, km → h.

21
6.2.3 Case w = 12
Using the general formulae (163) and (188) for the case w = 12 we have:
w 2
Γ( ; a2 ) = a10 + 5a8 + 20a6 + 60a4 + 120a2 + 120 e−a

(201)
2
32 √
 
3 w 2 32 −1 16 −3 8 −5 4 −7 2 −9 −b2
Γ( − ; b ) = − πerfc(b) + b − b + b − b + b e (202)
2 2 945 945 945 315 63 9

   
2 16 8 12 30 105 −b2
= −16 πerfc(b) + − 3+ 5 − 7 + 9 e (203)
945 b b b b b
w
Γ( ) = Γ(6) = 5! = 120 (204)
2
Inserting these values into (137) we get

2
1  X e−a
Asj 12 a10 + 5a8 + 20a6 + 60a4 + 120a2 + 120

S= (205)
240 rsj;n

nsj
rsj;n 6=0

2 π 10.5 X √
   
9 16 8 12 30 105 −b2
+ F2 (2πhm )|hm | −16 πerfc(b) + − 3+ 5 − 7 + 9 e (206)
945 V m6=0 b b b b b
! ! !
π 3/2 α9 2 X X 2α12
+ Asj − Ajj (207)
V 9 sj j
12
Opening the brackets
2  10
e−a a8 a6 a4

1 X a 2
S= Asj 12 + + + +a +1 (208)
2 nsj rsj;n 120 24 6 2
rsj;n 6=0

π 10.5 X √
   
1 9 16 8 12 30 105 −b2
+ F2 (2πhm )|hm | −16 πerfc(b) + − 3+ 5 − 7 + 9 e (209)
945 · 120 V m6=0 b b b b b
! !
π 3/2 α9 X α12 X
+ Asj − Ajj (210)
1080V sj
1440 j
12
Using that rsj;n = a12 /α12 and h9m = km
9
/512π 9 we can rewrite the expression above as follows:
 −2
α12 X a−4 a−6 a−8

a −10 2
S= Asj + + + +a + 1 e−a (211)
2 nsj 120 24 6 2
rsj;n 6=0

π 3/2 X √
   
1 9 16 8 12 30 105 −b2
+ F2 (km )|km | −16 πerfc(b) + − 3+ 5 − 7 + 9 e
945 · 120 · 512 V m6=0 b b b b b
! ! (212)
3/2 9 12
π α X α X
+ Asj − Ajj (213)
1080V sj
1440 j

22
7 Numerical aspects
7.1 Representation of the Fourier-space sum
7.1.1 w=1
To compute the fourier-space sum
1 X 4π X ikm ·(rj −ri )
−|km |2
Uf ourier = q j q s e e 4α2 (214)
2V k 6=0 |km |2 js
m

we use that for point charges ρ(r) = j qj δ(rj ) and ρ̂(km ) = j qj eikm rj
P P
Then X
|ρ̂(km )|2 ≡ ρ̂(km )ρ̂(−km ) = qj qs eikm (rj −rs ) (215)
js

and one can rewrite the k-space sum in the following form:
1 X 4π |km |2
2 − 4α
Uf ourier = |ρ̂(k m )| e 2
(216)
2V m6=0 |km |2

This is consistent with Ref. [5].


Let now use the following units:

L = Lx = Ly = Lz = 1 (217)

km = m (218)
L
Then
|km |24π 2 2 1 π 2 m2
e− 4α2 m
= exp(− ) = exp(− ) (219)
L2 4α2 α2
And the Fourier sum can be rewritten in a following form:
X
Uf ourier = β(km )ρ(km )ρ(−km ) (220)
m6=0

where
1 4πL2 π 2 m2 1 π 2 m2
β(km ) = exp(− ) = [V = 1, L = 1] = exp(− ) (221)
2V 4π 2 m2 α2 2πm2 α2

7.1.2 w=6
Similar representation can be also written for the case w = 6 and w = 12.
For w = 6 we have
π 9/2 X √
   
3 1 1 −b2
Uf ourier = F2 (km )|hm | πerfc(b) + − e (222)
3V m6=0 2b3 b

where b2 = π 2 |hm |2 /α2 Thus |hm | = αb/π, and

π 9/2 X α 3 b3 √
   
1 1 −b2
Uf ourier = F2 (km ) 3 πerfc(b) + − e (223)
3V m6=0 π 2b3 b

23
X
= F2 (km )β6 (km ) (224)
m6=0

where
α3
β6 (km ) = B6 (b = πhm /α) (225)
V
π 3/2 3 √
   
1 2 −b2
B6 (b) = b πerfc(b) + −b e (226)
3 2

7.1.3 w=12
For w = 12 we have
Uf ourier = (227)
π 10.5 √
   
1 X
9 16 8 12 30 105 −b2
F2 (km )|hm | −16 πerfc(b) + − 3+ 5 − 7 + 9 e (228)
945 · 120 V m6=0
b b b b b

Changing hm → αb/π
Uf ourier = (229)
10.5 9 9 √
   
1 π X α b 16 8 12 30 105 −b2
F2 (km ) 9 −16 πerfc(b) + − 3+ 5 − 7 + 9 e (230)
945 · 120 V m6=0
π b b b b b
X
= F2 (km )β12 (km ) (231)
m6=0

where
α9
β12 (km ) = B12 (b) (232)
V
π 3/2  √  2
B12 (b) = −16b9 πerfc(b) + 16b8 − 8b6 + 12b4 − 30b2 + 105 e−b (233)
945 · 120
We note, that functions B6 , B12 depend only on one argument and do not depend on the
parameters of the system. So, they can be tabulated before the calculations start.

7.2 Calculation of |ρ̂(k)|2


For w = 1 we need to calculate |ρ̂(k)|2
X X X X
ρ̂(k)ρ̂(−k) = ( qj cos(k · rj ) + i qj sin(k · rj ))( qj cos(k · rj ) − i qj sin(k · rj )) (234)
j j j j

!2 !2
X X
= qj cos(k · rj ) − i2 qj sin(k · rj ) (235)
j j
!2 !2
X X
= qj cos(k · rj ) + qj sin(k · rj ) (236)
j j

Now, using the symmetry in k-space we can reduce the sum to the sum over kx , ky , kz ≥ 0
Indeed, β(k) = β(|k|). For ρ̂(k) we can introduce the following definitions:

|ρ̂sx ,sy ,sz (k)|2 ≡ Cs2x sy sz (k) + Ss2x sy sz (k) (237)

24
where !2
X
Cs2x sy sz (k) = qj cos(sx kx xj + sy ky yj + sz kz zj ) (238)
j
!2
X
Ss2x sy sz (k) = qj sin(sx kx xj + sy ky yj + sz kz zj ) (239)
j

where
sx , sy , sz ∈ {+1, −1} ≡ {+, −} (240)
for example
|ρ̂+−+ (k)|2 ≡ |ρ̂+1,−1,+1 (k)|2 ≡ C+−+
2 2
(k) + S+−+ (k) (241)
!2 !2
X X
≡ qj cos(kx xj − ky yj + kz zj ) + qj sin(kx xj − ky yj + kz zj ) (242)
j j

In general, for kx , ky , kz ≥ 0 there exist 8 combinations of sx , sy , sz . Due to the symmetry, we have

|ρ̂sx ,sy ,sz (k)|2 = |ρ̂−sx ,−sy ,−sz (k)|2 (243)

which means that only 4 of 8 combinations are independent.


Then, the sum can be rewritten in a following form:
X
Uf ourier = β(km )ρ(km )ρ(−km ) = (244)
m6=0

X
β(|km |) |ρ̂+++ (km )|2 + |ρ̂++− (km )|2 + |ρ̂+−+ (km )|2 + |ρ̂+−− (km )|2

=2 (245)
mx ,my ,mz >0
X
β(|km |) |ρ̂+++ (km )|2 + |ρ̂+−+ (km )|2

+2 (246)
mx ,my >0,mz =0
X
β(|km |) |ρ̂+++ (km )|2 + |ρ̂++− (km )|2

+2 (247)
mx =0,mz >0,my =0
X
β(|km |) |ρ̂+++ (km )|2

+2 (248)
mx >0,my ,mz =0
X
β(|km |) |ρ̂+++ (km )|2 + |ρ̂++− (km )|2 + |ρ̂+−+ (km )|2 + |ρ̂+−− (km )|2

+ (249)
mx =0,my ,mz >0
X
β(|km |) |ρ̂+++ (km )|2 + |ρ̂+−+ (km )|2

+ (250)
mx ,mz =0,my >0
X
β(|km |) |ρ̂+++ (km )|2 + |ρ̂++− (km )|2

+ (251)
mx ,my =0,mz >0

So cumbersome representation appears because we need to account for all cases when one of
coordinates is zero. In that case we need to avoid double summation. E.g., if kz = 0, then
cos(xkx + yky + zkz ) and cos(xkx + yky − zkz ) represent the same summand, thus ρ̂(+ + −) should

25
be excluded from summation. The same is with all other coordinates. The sum can be rewritten
in a more compact manner with the use of sign function:

 −1, x < 0
sgn(x) = 0, x = 0 (252)
1, x > 0

The sum can be written in a following form


X 
Uf ourier = (sgn(mx ) + 1)β(|km |) |ρ̂+++ (km )|2 + sgn(my )|ρ̂+−+ (km )|2
mx ,my ,mz ≥0
m6=0
(253)
+ sgn(mz )|ρ̂++− (km )|2 
+ sgn(my mz )|ρ̂+−− (km )|2

The values of |ρ̂sx sy sz (km )|2 = Cs2x sy sz (k) + Ss2x sy sz (k) should be pre-computed for the combina-
tions + + +, + + −, + − +, + − − and for all kx , ky , kz ≥ 0.
The values of Cs2x sy sz (k), Ss2x sy sz (k) can be calculated recurrently, atom-by-atom and k-by-k,
using the formulae for sin/cos of sums and differences of angles. For example, for the atom at
coordinates (x, y, z) we have
cos(xkx + yky + z(kz + dkz )) = cos(xkx + yky + zkz ) cos(dkz ) − sin(xkx + yky + zkz ) sin(dkz ) (254)
which allows us to calculate the values of cos k-by-km and avoid multiple calls of the cos procedure.

7.3 Calculation of F2 (k)


In ewald summation we rewrite the fourier part sum in a form
X
Uf ourier = β(km )F2 (km ) (255)
m

where beta(k) differs for 1/r, 1/r6 , 1/r1 2 potentials and


X
F2 (km ) = Asj exp(ikm · (rs − rj )) (256)
sj

If Asj = qs qj then F2 (km ) can be represented as


F2 (km ) = ρ̂(km )ρ̂(−km ) = |ρ̂(km )|2 (257)
where X
ρ̂(km ) = qj exp(ikm · rj ) (258)
j

This calculation requires only N operations, while calculation of double sum using the original
notation requires N 2 operations, where N is the number of particles.
For other potentials we cannot do such reduction, because in general case Asj 6= As Aj . However,
if there are not very much atoms with different Asj values (which is usually the case, for example
for Lennard Jones potential), we can rewrite summation in a following way:
M X
M N (t1 ) N (t2 )
X X X X
F2 (km ) = At1 t2 exp(ikm · (rts1 − rtj2 ) = At1 t2 F t1 (km )F t2 (km ) (259)
t1 =1 t2 =1 s=1 j=1 t1 ,t2

26
where M is the number of different atomtypes in the system, N (t) is the number of atoms of type
t, rts are the coordinates of s-th particle of type t, and
N (t)
X
F t (km ) = exp(ikm · rts ) (260)
s=1

In this notation the total number of operations is N + M 2 , so if M << N it is almost the same as
in Coulomb potential case.
To avoid operations with the complex numbers in the calculations we can rewrite the definition
above in a following way:
F t (km ) = Cm
t t
+ iSm (261)
where
N (t)
X
t
Cm = cos(ikm rs ) (262)
s=1
N (t)
X
t
Sm = sin(ikm rs ) (263)
s=1

Then

F 1 (km )F 2 (−km ) = (Cm


1 1
+ iSm 2
)(Cm 2
− iSm 1
) = Cm 2
Cm 1 2
+ Sm 1 2
Sm − iCm 1
Sm + iSm 2
Cm (264)

Normally most of potentials are symmetric, i.e Asj = Ajs . In that case we can rewrite F2 (km )
in a following way:
X XX
Att F t (km )F t (−km ) + At1 t2 F t1 (km )F t2 (−km ) + F t2 (km )F t1 (−km )

F2 (km ) =
t t1 t2 >t1
(265)
We have:
F t (km )F t (−km ) = (Cm
t 2 t 2
) + (Sm ) (266)
And
F 1 (km )F 2 (−km ) + F 2 (km )F 1 (−km ) = (267)
1 2 1 2 1 2 1 2
= Cm Cm + Sm Sm − iCm Sm + iSm Cm + (268)
1 2 1 2 1 2 1 2
Cm Cm + Sm Sm + iCm Sm − iSm Cm (269)
1 2 1 2
= 2(Cm Cm + Sm Sm ) (270)
This gives the following formula for F2 :
X
t1 t2 t1 t2

F2 (km ) = At1 t2 Cm Cm + Sm Sm (271)
t1 t2

We can see, that the sum is again symmetric:


X
t1 t2 t1 t2

F2 (−km ) = F2 (k−m ) = C−m C−m + S−m S−m (272)
t1 t2

Due to the properties of sin and cos we have


t t t t
C−m = Cm , S−m = −Sm (273)

27
which gives X
t1 t2 t1 t2

F2 (−km ) = Cm Cm + (−Sm )(−Sm ) = F2 (km ) (274)
t1 t2

As well as in case of Coulomb potential we can use the symmetry of β(km ) and F2 to reduce
the whole sum to the sum over kx , ky , kz > 0.
we can also use symmetry of beta again:
X 
Uf ourier = (sgn(mx ) + 1)β(km ) F2+++ (km )+ sgn(my )F2+−+ (km )
mx ,my ,mz ≥0
m6=0
(275)
+ sgn(mz )F2++− (km ) 
+ sgn(my mz )F2+−− (km )

where X
s sy sz t1 t2 t1 t2

F2 x (km ) = Cm (sx , sy , sz )Cm (sx , sy , sz ) + Sm (sx , sy , sz )Sm (sx , sy , sz ) (276)
t1 t2

N (t)
X
t
Cm (sx , sy , sz ) = cos(sx xtj km
x
+ sy yjt km
y
+ sz zjt km
z
) (277)
j=1

N (t)
X
t
Sm (sx , sy , sz ) = sin(sx xtj km
x
+ sy yjt km
y
+ sz zjt km
z
) (278)
j=1

(xtj , yjt , zjt ) = rtj are the coordinates of the j-th particle of type t.

7.4 Lennard Jones Potential


For calculation of the Lennard-Jones potential we can use the general formulae for 1/r6 and 1/r12
potentials. However, to calculate F2LJ6 and F2LJ12 is not practical in that case, because the sums
are almost the same up to the At1 t2 coefficients. Indeed, the Lennard-Jones energy can be written
as difference of LJ12 and LJ6 terms:

UfLJ LJ12 LJ6


ourier = Uf ourier − Uf ourier (279)

where X
UfLJ12
ourier = (1 + sgn(mx ))β12 (km )F2LJ12 (km ) (280)
m≥0
X
UfLJ6
ourier = (1 + sgn(mx ))β6 (km )F2LJ6 (km ) (281)
m≥0
h
t (+++) t (+++) t (+++) t (+++)
F2LJ6,12 (km ) = LJ6,12
P
t1 t2 At1 t2 Cm1 Cm2 + Sm1 Sm2
 
t (+−+) t2 (+−+) t (+−+) t2 (+−+)
+sgn(ky )· Cm1 Cm + Sm1 Sm

t1 (++−) t2 (++−) t1 (++−) t2 (++−)
 (282)
+sgn(kz )· Cm Cm + Sm Sm
 i
t (+−−) t2 (+−−) t (+−−) t2 (+−−)
+sgn(ky kz )· Cm1 Cm + Sm1 Sm

28
Expanding all the definitions, for UfLJ
ourier we get
XX h
LJ t1 t2 t (+++) t2 (+++) t (+++) t2 (+++)
Uf ourier = βLJ (km ) Cm1 Cm + Sm1 Sm
m≥0 t1 t2  
t (+−+) t2 (+−+) t (+−+) t2 (+−+)
+sgn(ky )· Cm1 Cm + Sm1 Sm
  (283)
t1 (++−) t2 (++−) t1 (++−) t2 (++−)
+sgn(kz )· Cm Cm + Sm Sm
 i
t1 (+−−) t2 (+−−) t1 (+−−) t2 (+−−)
+sgn(ky kz )· Cm Cm + Sm Sm

where
t1 t2
(km ) ≡ (1 + sgn(mx )) ALJ12 LJ6

βLJ t1 t1 β12 (km ) + At1 t2 β6 (km ) (284)
t1 t2
we note, that βLJ
do not depend on the particle coordinates, which means that they can be
computed ones at startup and then used. We note, that the calculations using the formula (283)
are faster than the direct calculations of two sums (280), (281). Indeed, let we have Nt different
types of molecules and Nk grid points in the positive part of k-space (mx , my , mz ≥ 0). Then
calculation of (282) for each k-space gri point requires 8Nk Nt2 multiplications for each of F2LJ6 and
F2LJ12 , thus in total 16Nk Nt2 multiplications 3 . Eqch of calculations using formulae (280),(281)
require Nk multiplications, thus in total using the irect scheme we get (2+16Nt2 )Nk multiplications.
The same calculations using the formula (283) require only 9Nt2 Nk multiplications. We note also,
t1 t2 t2 t1
that for LJ potential coefficients are symmetric, i.e. At1 t2 = At2 t1 which implies βLJ = βLJ . This
allows one to count only half of summands, i.e.:
XX X h
LJ t1 t2 t (+++) t2 (+++) t (+++) t2 (+++)
Uf ourier = (2 − δt1 t2 )βLJ (km ) Cm1 Cm + Sm1 Sm
m≥0 t1 t2 ≥t1  
t (+−+) t2 (+−+) t (+−+) t2 (+−+)
+sgn(ky )· Cm1 Cm + Sm1 Sm
  (285)
t1 (++−) t2 (++−) t1 (++−) t2 (++−)
+sgn(kz )· Cm Cm + Sm Sm
 i
t1 (+−−) t2 (+−−) t1 (+−−) t2 (+−−)
+sgn(ky kz )· Cm Cm + Sm Sm

This summation requires only 9/2Nk (Nt2 + Nt ) multiplications 4


.

8 Forces
8.1 Real space
To calculate forces which act on the particles we need to take the derivatives of the potential. The
force component over the x axis acting on particle s is
∂U
Fpx = − (286)
∂xp
In our case, all potential components (Coulomb, LJ6, LJ12) can be written in a following form:
1X 1X
U= usj (rsj;n ) = Asj ψ(rsj;n ) (287)
2 sj,n 2 sj;n
3
we do not count multiplication by sgn functions, because they are usually implemented with logical statements.
4
Again, multiplication by 2 − δt1 t2 can be implemented with logical operations and summation: if t1=t2 then
Sum := Sum + Sum

29
where rsj;n = |rsj;n | = |rs − rj + n ◦ L|
From the general expressions for the Ewald sum for different potentials (154), (198), (211)
and remembering that a ≡ αrsj;n , we have the following expressions for ψ in Coulomb and LJ
potentials
erfc(αr)
ψ C (r) = (288)
r
For Lennard-Jones interactions
α2 α4
 
LJ6 −α2 r2 1
ψ (r) = e + 4 + 2 (289)
r6 r 2r

α2 α4 α6 α8 α10
 
LJ12 −α2 r2
ψ (r) = e 1 + 10 + 8 + 6 + + (290)
r 2r 6r 24r4 120r2
Using the general expression (137) for particular case of w = 2k + 2 ((163) ) we have
w/2−1
w 1 Γ(w/2; α2 r/2 ) −w −α2 r2
X 1 α2l
ψ (r) = w = r Φw (αr) = e (291)
r Γ(w/2) l=0
l! rw−2l

Now we can take the derivative of (287) we have

∂U 1X ∂ψ(rsj;n ) ∂rsj;n
= Asj (292)
∂xp 2 sj;n ∂rsj;n ∂xp

Using the definition of rsj;n we get

∂rsj;n ∂
q
= (xs − xj + nx Lx )2 + (ys − yj + ny Ly )2 + (zs − zj + nz Lz )2 (293)
xp xp

δsp δjp
= 2(xp − xj + nx Lx ) + 2(xs − xp + nx Lx )(−1) (294)
2rpj;n 2rsp;n
δsp δsp
= (xp − xj + nx Lx ) + (xp − xs − nx Lx ) (295)
rpj;n rpj;n
Inserting this into (292) we get

∂U 1 X ∂ψ(rpj;n ) 1
= Apj (xp − xj + nx Lx ) (296)
∂xp 2 s=p,j;n ∂rpj;n rpj;n

1 X ∂ψ(rsp;n ) 1
+ Asp (xp − xs − nx Lx ) (297)
2 s,j=p;n ∂rsp;n rsp;n

Renaming in the second sum s → j, n → −n (sum is anyway over all space) we get

∂U 1X ∂ψ(rpj;n ) 1
= Apj (xp − xj + nx Lx ) (298)
∂xp 2 j;n ∂rpj;n rpj;n

1X ∂ψ(rjp;−n ) 1
+ Ajp (xp − xj + nx Lx ) (299)
2 j;−n ∂rjp;−n rjp;−n

30
Now, we see that

rjp;−n = |rj − rp − n ◦ L| = | − (rp − rj + n ◦ L)| = rpj;n (300)

Then, using that Apj = Ajp the two sums can be combined in one:

∂U X ∂ψ(rpj;n ) 1
= Apj (xp − xj + nx Lx ) (301)
∂xp j;n
∂r pj;n r pj;n

Because the similar expressions can be written also for the derivatives over yp ,zp , we can write
X ∂ψ(rpj;n ) 1 X
Fp = − Apj (rp − rj + n ◦ L) = Apj FR (rpj;n ) ◦ rpj;n (302)
j;n
∂rpj;n rpj;n j;n

where ◦ means point-wise multiplication and

1 ∂ψ(r)
FR (r) = − (303)
r ∂r
Having the exact expressions (288),(289), (290), (291), we can calculate the force components.

8.1.1 Coulomb potential


For Coulomb potential:
∂ψ C (r) 1 1 ∂
= − 2 erfc(αr) + erfc(αr) (304)
∂r r r ∂r
Considering the definition of erfc:
Z αr
2 2
erfc(αr) = 1 − erf(αr) = 1 − √ e−t dt (305)
π 0

which gives
∂ ∂ 2α 2 2
erfc(αr) = α erfc(αr) = − √ e−α r (306)
∂r ∂αr π
and
∂ψ C (r) 1 2 2 2
= − 2 erfc(αr) − √ e−α r (307)
∂r r r π
Which gives  
1 erfc(αr) 2 2 2
FRC (r) = 2 + √ e−α r (308)
r r π

8.1.2 Lennard-Jones
In case of Lennard-Jones potential we may start from the general expression (291) for w = 2k + 2,
namely:  
w/2−1 2l
∂ w ∂  −α2 r2 X 1 α 
ψ (r) = e w−2l
(309)
∂r ∂r l=0
l! r

31
w/2−1 w/2−1
X 1 α2l X 1 α2l (2l − w)
2 −α2 r2 −α2 r2
= −2α re + e (310)
l=0
l! rw−2l l=0
l! rw−2l+1
 
w/2−1 2l+2 w/2−1 2l
2 2
X 2 α X 1 α (w − 2l) 
= −e−α r  w−2l−1
− (311)
l=0
l! r l=0
l! rw−2l+1

Changing in the first sum l → l0 , where l0 = l + 1 and using that l! = (l0 − 1)! = l0 !/l0 we have:
 
l=w/2−1,l0 =w/2 0 2l 0 w/2−1 2l
∂ w 2 2
X 2l α X 1 α (w − 2l)
ψ (r) = −e−α r  0
0 ! r w−2l +1
− w−2l+1
 (312)
∂r 0
l=0,l =1
l l=0
l! r

Considering that at l0 = 0 the first summand is zero and at that l = w/2 causes w − 2l − 0 which
nullify the second summand, we can rewrite the sum in a following form:
w/2 w/2
∂ w 2 2
X (2l + w − 2l) α2l X 1 α2l
−α2 r2
ψ (r) = −e−α r = −we (313)
∂r l=0
l! rw−2l+1 l=0
l! rw−2l+1

This gives
w/2
1 ∂ψ w 2 2
X 1 α2l
FRw (r) =− = we−α r (314)
r ∂r l=0
l! rw−2l+2
Comparing this to the expression (291) we can see, that expressions have similarities. Actually,
the force component FRw can be written in a following way:
w
 
w w w −α2 r2 α
FR (r) = 2 ψ (r) + e (315)
r (w/2)!
where ψ w (r) = r−w Φw (αr). From the numerical point of view, it is also reasonable to define the
function Cw (r):
w/2−1
X 1
Cw (r) = (αr)2l (316)
l=0
l!
Then 2 2
e−α r
ψ w (r) = Cw (r) (317)
rw
2 2 
e−α r αw

Cw (r)
FR (r) = w 2 + (318)
r rw (w/2)!
For the LJ potential components:
C6 (r) α6
 
6 2 2
FR6 (r) = 2 e−α r + (319)
r r6 6

C12 (r) α12


 
12 2 2
FR12 (r) = 2 e−α r + (320)
r r12 720
Inserting them into the sum and considering that we get:

FLJ LJ12
p = Fp − FLJ6
p = (321)

32
X X LJ(p,j)
(ALJ12
pj F 12
R (r pj;n ) − A LJ6 6
pj F R (rpj;n ))r pj;n = FR (rpj;n )rpj;n (322)
jn jn

where
LJ(p,j)
FR (r) = ALJ12
pj FR12 (r) − ALJ6 6
pj FR (r) (323)
Considering that ALJ6 6 LJ12
pj = 4pj σpj , Apj
12
= 4pj σpj we have
LJ(p,j) 12 12 6
FR6 (r)

FR (r) = 4pj σpj FR (r) − σpj (324)

Considering the definition of FR12 , FR6 we have


2 2  12 12 6 6
LJ(p,j) 4pj e−α r  σ 12
pj σpj α  σ 6
pj σpj α
FR (r) = 2
12 C12 (r) + 12 −6 C6 (r) − 6 (325)
r r 720 r 6

To reduce the number of operations, the values of (σ/r)6 and (αr)6 can be pre-computed. Then
we rewrite the last expression in a following way:
2 2 
LJ(p,j) 4pj e−α r  σ 12
pj
 σ 12 (αr)12
pj
 σ 6
pj
 σ 6 (αr)6 
pj
FR (r) = 2
12 C12 (r) + 12 −6 C6 (r) − 6
r r r 720 r r 6
(326)
2 2  
4pj e−α r (αr)12 (αr)6
   
σpj 6  σpj 6
= 6 2 C12 (r) + − C6 (r) − (327)
r2 r r 720 6
To see, how the number of operations reduces, we can use the definitions
 σ 6
pj
S≡ A = (αr)6 (328)
r
Then the above expression can be written more compactely:
2 2 
4pj e−α r A2
   
LJ(p,j) A
FR (r) = 6S 2S C12 (r) + − C6 (r) − (329)
r2 720 6

8.2 Fourier space


8.2.1 Coulomb potential
The Fourier space sum can be written as a sum of Coulomb and Lennard-Jones sums:

Uf ourier = UfCourier + UfLJ


ourier (330)

where UfCourier and UfLJ


ourier are defined by eqs. (373), (285) respectively. For the Coulomb potential
we have
∂U C X h ∂ 2 2

= (1 + sgn(mx ))β(km ) C+++ (km ) + S+++ (km )
∂xp m≥0
∂xp
∂ 2 2

+sgn(my ) · C+−+ (km ) + S+−+ (km )
∂xp (331)
∂ 2 2

+sgn(mz ) · C (km ) + S++− (km )
∂xp ++−
∂ 2 2
i
+sgn(my mz ) · C+−− (km ) + S+−− (km )
∂xp

33
Now we calculate the derivative of separate sumands. For the cosine sum:
∂ 2 X ∂ x y z
Csx sy sz (km ) = 2Csx sy sz qj cos(sx xj km + sy y j km + sz zj km ) (332)
∂xp j
∂xp
X
= 2Csx sy sz qj δpj (− sin(rp(sx sy sz ) · km ))sx km
x x
= (−sx )2Csx sy sz qp sin(rspx sy sz · km )km (333)
j
s s s
where rpx y z ≡ (sx xp , sy yp , sz zp ) By analogy for the sine sum:

∂ 2 X ∂ x y z
Ssx sy sz (km ) = 2Ssx sy sz qj sin(sx xj km + sy y j km + sz zj km ) (334)
∂xp j
∂xp

x
= (+sx )2Ssx sy sz qp cos(rspx sy sz · km )km (335)
Combining both togather:
∂  2 
x
Csx sy sz (km ) + Ss2x sy sz (km ) = (sx )2qp km Ssx sy sz cos(rspx sy sz km ) − Csx sy sz sin(rspx sy sz km )

∂xp
(336)
and the total ∂UfCourier /∂xp is

∂UfCourier x
X h
= 2qp km (1 + sgn(mx ))β(km ) S+++ cos(r+++
p km ) − C+++ sin(r+++
p km )
∂xp m≥0 
+sgn(my ) · S+−+ cos(r+−+
p km ) − C+−+ sin(r+−+
p km )
+sgn(mz ) · S++− cos(r++−
p km ) − C++− sin(r++−
p km ) i
+−− +−−

+sgn(my mz ) · S+−− cos(rp km ) − C+−− sin(rp km )
(337)
By analogy, ∂U C /∂yp , ∂U C /∂zp are:

∂UfCourier y
X h
= 2qp km (1 + sgn(mx ))β(km ) S+++ cos(r+++
p km ) − C+++ sin(r+++
p km )
∂yp m≥0 
−sgn(my ) · S+−+ cos(r+−+
p km ) − C+−+ sin(r+−+
p km )
+sgn(mz ) · S++− cos(r++−
p km ) − C++− sin(r++−
p km ) i
+−− +−−

−sgn(my mz ) · S+−− cos(rp km ) − C+−− sin(rp km )
(338)
∂UfCourier z
X h
= 2qp km (1 + sgn(mx ))β(km ) S+++ cos(r+++
p km ) − C+++ sin(r+++
p km )
∂zp m≥0 
+sgn(my ) · S+−+ cos(r+−+
p km ) − C+−+ sin(r+−+
p km )
−sgn(mz ) · S++− cos(r++−
p km ) − C++− sin(r++−
p km ) i
+−− +−−

−sgn(my mz ) · S+−− cos(rp km ) − C+−− sin(rp km )
(339)

34
Then the force FC
p = −∂UC /∂rp can be written in a following way:

∂UfCourier
=− FC
p =
∂rp h
k+++ ◦ C+++ sin(rp k+++ ) − S+++ cos(rp k+++
P 
= 2qp m≥0 (1 + sgn(mx ))β(km ) m m m )
(340)
+ · sgn(my ) · k+−+ ◦ C+−+ sin(rp k+−+ ) − S+−+ cos(rp k+−+

m m m )
+sgn(mz ) · k++−
m ◦ C++− sin(rp k++−
m ) − S++− cos(rp k++−
m ) i
+sgn(my mz ) · k+−− ◦ C+−− sin(rp k+−− ) − S+−− cos(rp k+−−

m m m )

s sy sz x y z
where kmx ≡ (sx , sy , sz ) ◦ km = (sx km , sy km , sz km ), ◦ is a point-wise multiplication.

8.2.2 LJ forces
To calculate the forces induced by the LJ interaction we need to take the derivative of the fourier
LJ representation (285):

∂UfLJ
ourier
XX
t1 t2
h


t (+++) t (+++) t (+++) t (+++)

= βLJ (k m ) ∂xτp
Cm1 Cm2 + Sm1 Sm2
∂xτp m≥0 t t 1 2  
∂ t (+−+) t2 (+−+) t (+−+) t2 (+−+)
+sgn(ky )· ∂xτp
Cm1 Cm + Sm1 Sm (341)
 
∂ t (++−) t2 (++−) t (++−) t2 (++−)
+sgn(kz )· ∂xτp
Cm1 Cm + Sm1 Sm
 i
∂ t (+−−) t (+−−) t (+−−) t (+−−)
+sgn(ky kz )· ∂xτp
Cm1 Cm2 + Sm1 Sm2

Now we can calculate the derivatives separately for each of sumands:


   
∂ t1 (sx sy sz ) t2 (sx sy sz )
 ∂ t1 (sx sy sz ) t2 (sx sy sz ) t1 (sx sy sz ) ∂ t2 (sx sy sz )
Cm Cm = C Cm + Cm C (342)
∂xτp ∂xτp m ∂xτp m

N (t)
∂ t(sx sy sz ) X ∂
C = cos(sx xtj km
x
+ sy yjt km
y
sz zjt km
z
) (343)
∂xτp m j=1
∂x τ
p

N (t)
X
= δτ t δpj (− sin(ksmx sy sz rτp ))sx km
x x
= (−sx )km δτ t sin(ksmx sy sz rτp ) (344)
j=1

Then
XX
t1 t2 ∂ t1 (sx sy sz ) t2 (sx sy sz )

βLJ (km ) τ
Cm Cm (345)
m≥0 t1 t2
∂xp
XX
x t1 t2
= (−sx )km βLJ (km )δt1 τ sin(ksmx sy sz rτp )Cm
t2 (sx sy sz )
(346)
m≥0 t1 t2
XX
x t1 t2 t1 (sx sy sz )
+(−sx )km βLJ (km )Cm δτ t2 sin(ksmx sy sz rτp ) (347)
m≥0 t1 t2

X X
x τ t2
= (−sx )km βLJ (km ) sin(ksmx sy sz rτp )Cm
t2 (sx sy sz )
(348)
m≥0 t2

35
X 
t1 τ
+ βLJ (km ) sin(ksmx sy sz rτp )Cm
t1 (sx sy sz )
(349)
t1
τt tτ
Considering, that βLJ = βLJ the sums are the same up to renaming t1 ↔ t2 . Thus, we have
XX
t1 t2 ∂ t1 (sx sy sz ) t2 (sx sy sz )

βLJ (km ) τ
Cm Cm (350)
m≥0 t1 t2
∂xp
XX
x τt t(sx sy sz )
= (−sx )2km βLJ (km )Cm sin(ksmx sy sz rτp ) (351)
m≥0 t

The same for sum of sines:


N (t)
∂ t(sx sy sz ) X ∂
S = sin(sx xtj km
x
+ sy yjt km
y
sz zjt km
z x
) = sx km δτ t cos(ksmx sy sz rτp ) (352)
∂xτp m j=1
∂x τ
p

which implies
XX
t1 t2 ∂ t1 (sx sy sz ) t2 (sx sy sz )

βLJ (km ) Sm Sm (353)
m≥0 t1 t2
∂xτp
XX
x τt t(sx sy sz )
= (+sx )2km βLJ (km )Sm cos(ksmx sy sz rτp ) (354)
m≥0 t

This gives the following expression for the ∂ULJ /∂xτp :

∂UfLJ
ourier x
XX
τt
h 
t(+++) +++ τ t(+++) +++ τ

= 2k m β LJ (km ) Sm cos(km rp ) − C m sin(km rp )
∂xτp m≥0 t  
t(+−+) t(+−+)
+sgn(ky )· Sm cos(k+−+
m rτ
p ) − C m sin(k+−+ τ
m rp ) (355)
 
t(++−) ++− τ t(++−) ++− τ
+sgn(kz )· Sm cos(km rp ) − Cm sin(km rp )
 i
t(+−−) t(+−−)
+sgn(ky kz )· Sm cos(k+−−
m rτ
p ) − C m sin(k+−− τ
m rp )

Considering the signs of sy and sz we can also write ∂ULJ /∂ypτ and ∂ULJ /∂zpτ :

∂UfLJ
ourier y
XX
τt
h 
t(+++) +++ τ t(+++) +++ τ

= 2k m β LJ (km ) Sm cos(km rp ) − C m sin(km rp )
∂ypτ m≥0 t  
t(+−+) t(+−+)
−sgn(ky )· Sm cos(k+−+
m rτ
p ) − C m sin(k+−+ τ
m rp ) (356)
 
t(++−) ++− τ t(++−) ++− τ
+sgn(kz )· Sm cos(km rp ) − Cm sin(km rp )
 i
t(+−−) +−− τ t(+−−) +−− τ
−sgn(ky kz )· Sm cos(km rp ) − Cm sin(km rp )

∂UfLJ
ourier z
XX
τt
h 
t(+++) +++ τ t(+++) +++ τ

= 2km βLJ (km ) Sm cos(km rp ) − Cm sin(km rp )
∂zpτ m≥0 t  
t(+−+) t(+−+)
+sgn(ky )· Sm cos(k+−+
m rτ
p ) − C m sin(k+−+ τ
m rp ) (357)
 
t(++−) ++− τ t(++−) ++− τ
−sgn(kz )· Sm cos(km rp ) − Cm sin(km rp )
 i
t(+−−) t(+−−)
−sgn(ky kz )· Sm cos(k+−−
m rτ
p ) − C m sin(k+−− τ
m rp )

36
This gives the following representation for the force:
∂U LJ
FLJ
pτ = −
f ourier
=
XX h  ∂rτp 
τt t(+++) t(+++)
=2 βLJ (km ) k+++
m ◦ C m sin(k+++ τ
m rp ) − Sm cos(k +++ τ
m r p )
m≥0 t  
+sgn(ky )· +−+
km ◦ C m
t(+−+) +−+ τ
sin(km rp ) − Sm
t(+−+) +−+ τ
cos(km rp ) (358)
 
t(++−) t(++−)
+sgn(kz )· k++−
m ◦ C m sin(k++− τ
m rp ) − Sm cos(k ++− τ
m r p )
 i
+−− t(+−−) +−− τ t(+−−) +−− τ
+sgn(ky kz )· km ◦ Cm sin(km rp ) − Sm cos(km rp )
s sy sz x y z
where kmx ≡ (sx , sy , sz ) ◦ km = (sx km , sy km , sz km ), ◦ is a point-wise multiplication.

9 Monte Carlo Move


9.1 Energy difference
9.1.1 Real space
For the Monte Carlo move one need:
1. randomly select a molecule.

2. change the coordinates of the molecule( either randomly or using the force-bias, as we do)

3. count the energy difference between the new and initial position and either accept or decline
the move
Let M be the indexes of the atoms of the selected molecule. We can calculate the real-space
forces using the expressions (302), (308), (321), (329) and k-space forces using the expressions (340),
(358). Using these forces we can calculate the new position of the molecule. Let {rnew j ; j ∈ M}
be the new positions of the atoms of the molecule. The energy difference in the real-space we can
calculate using the real-part sums in expressions (154), (198), (211). Considering that for s, j ∈ /M
the sums are equal, and ignoring the intermolecular interactions (which are anyway constant for
the rigid molecules) we can write the difference in a following way:

∆Ureal = [Ureal ]new old


M − [Ureal ]M (359)

where "
XXX erfc(α|rold,new
sj;n |)
[Ureal ]old,new
M = qs q j (360)
n s∈M j ∈M
/
|rold,new
sj;n |
#
ALJ12 ALJ6

sj sj
+ exp(−α 2
|rold,new
sj;n |2 ) C (|rold,new
old,new 12 12 sj;n |) − C (|rold,new
old,new 6 6 sj;n |) (361)
|rsj;n | |rsj;n |
where rold new new
sj;n = rs − rj + n ◦ L, rsj;n = rs − rj + n ◦ L,
w/2−1
X (αr)2l
Cw (r) = (362)
l=0
l!

37
9.1.2 K-space coulomb
For the k-space sum we can write the difference as a sum of coulomb and LJ parts:

∆Uf ourier = ∆UfCourier + ∆UfLJ


ourier (363)

where
∆UfCourier = [UfCourier ]new − UfCourier (364)
∆UfCourier = [UfLJ
ourier ]
new
− UfLJ
ourier (365)
and Coulomb and Lennard-Jones energies are calculated with formulae (373) and (285) with new
and old atom positions respectively. For the [UfCourier ]new
M we have

[UfCourier ]new =
 
X 
+++ new 2 +++ new 2
(sgn(mx ) + 1)β(|km |) ([Cm ] ) + ([Sm ] )
mx ,my ,mz ≥0
m6=0  
+sgn(my )· +−+ new 2
([Cm +−+ new 2
] ) + ([Sm ] ) (366)
 
++− new 2 ++− new 2
+sgn(mz )· ([Cm ] ) + ([Sm ] )
 
+−− new 2 +−− new 2
+sgn(my mz )· ([Cm ] ) + ([Sm ] )

where
X X
sx sy sz new
[Cm ] = qj cos(km rj ) + qj cos(km rnew
j
sx sy sz
) = Cm sx sy sz
+ ∆Cm (367)
j ∈M
/ j∈M

X X
sx sy sz new
[Sm ] = qj sin(km rj ) + qj sin(km rnew
j
sx sy sz
) = Sm sx sy sz
+ ∆Sm (368)
j ∈M
/ j∈M
s s s s s s
The increments ∆Cmx y z , ∆Smx y z
are the sums other the atoms of the molecule. We will
indicate such sums with the subscript M , i.e.:
sx sy sz sx sy sz new sx sy sz
∆Cm = [Cm ]M − [Cm ]M (369)
sx sy sz sx sy sz new sx sy sz
∆Sm = [Sm ]M − [Sm ]M (370)
where X X
sx sy sz new
[Cm ]M = qj cos(km rnew
j ); sx sy sz
[Cm ]M = qj cos(km rj ) (371)
j∈M j∈M
X X
sx sy sz new
[Sm ]M = qj sin(km rnew
j ); sx sy sz
[Sm ]M = qj sin(km rj ) (372)
j∈M j∈M

Using the representations (367),(368) we can calculate the difference


sx sy sz new 2 sx sy sz 2
([Cm ] ) − (Cm )
sx sy sz 2 sx sy sz sx sy sz sx sy sz 2 sx sy sz 2
= (Cm ) + 2Cm ∆Cm + (∆Cm ) − (Cm )
sx sy sz sx sy sz sx sy sz
= (2Cm + ∆Cm ) ∆Cm

38
and
sx sy sz new 2 sx sy sz 2 sx sy sz sx sy sz sx sy sz
([Sm ] ) − (Sm ) = (2Sm + ∆Sm ) ∆Sm
This gives the following representation for ∆Ufcourier :

∆UfCourier = 
X 
+++ +++ +++ +++ +++ +++
(sgn(mx ) + 1)β(|km |) (2Cm + ∆Cm ) ∆Cm + (2Sm + ∆Sm ) ∆Sm
mx ,my ,mz ≥0
m6=0  
+−+ +−+ +−+ +−+ +−+ +−+
 
+sgn(my )· 2Cm + ∆Cm ∆Cm + 2Sm + ∆Sm ∆Sm
 
++− ++− ++− ++− ++− ++−
 
+sgn(mz )· 2Cm + ∆Cm ∆Cm + 2Sm + ∆Sm ∆Sm
 
+−− +−− +−− +−− +−− +−−
 
+sgn(my mz )· 2Cm + ∆Cm ∆Cm + 2Sm + ∆Sm ∆Sm
(373)

9.1.3 K-space LJ
For calculation of the LJ sum we can use expression (285), which in non-expanded form can be
written as follows: X XX  
LJ t1 t2 t1 t2 t1 t2
Uf ourier = βLJ (km ) Cm Cm + Sm Sm (374)
m∈Z3 t1 t2

Here we return back to the summation over all m ∈ Z3 (rather than over only positive), and to the
full summation over t1 and t2 (instead of the t2 ≥ t1 ). This is done to make derivations simpler.
Then we can write the same expansion for [UfLJourier ]
new
:
X X  
t1 t2
[UfLJ
ourier ]
new
= βLJ t1 new
(km ) [Cm ] [Cmt2 new
] t1 new t2 new
+ [Sm ] [Sm ] (375)
m∈Z3 t1 t2

where X X
t new
[Cm ] = cos(km rj ) + cos(km rnew
j
t
) = Cm t
+ ∆Cm
j ∈M
/ t j∈Mt
X X
t new
[Sm ] = sin(km rj ) + sin(km rnew
j
t
) = Sm t
+ ∆Sm
j ∈M
/ t j∈Mt

Mt = {j ∈ M : T (j) = t}
and T (j) is the type of the atom with index j.
In this notation
X X  
t1 t2
[UfLJ
ourier ] new
= βLJ (km ) (C t1
m + ∆C t1
m )(C t2
m + ∆C t2
m ) + (Sm
t1
+ ∆S t1
m )(Sm
t2
+ ∆Sm
t2
) (376)
m∈Z3 t1 t2

Considering that

(C 1 + ∆C 1 )(C 2 + ∆C 2 ) − C 1 C 2 = C 1 ∆C 2 + C 2 ∆C 1 + ∆C 1 ∆C 2

we have for the energy difference the following:

∆UfLJ LJ
ourier = [Uf ourier ]
new
− UfLJ
ourier

39
"
X X X X
t1 t2 t1 t2 t1 t2 t2 t1 t1 t2 t1 t2
= βLJ Cm ∆Cm + βLJ Cm ∆Cm + βLJ ∆Cm ∆Cm
m t1 t2 t1 t2 t1 t2
#
X X X
t1 t2 t1 t2 t1 t2 t2 t1 t1 t2 t1 t2
+ βLJ Sm ∆Sm + βLJ Sm ∆Sm + βLJ ∆Sm ∆Sm
t1 t2 t1 t2 t1 t2
t1 t2 t2 t1
Considering that βLJ = βLJ , the first and the second summands are actually the same. Then we
can rewrite:
XX     
LJ t1 t2 t1 t1 t2 t1 t1 t2
∆Uf ourier = βLJ (km ) 2Cm + ∆Cm ∆Cm + 2Sm + ∆Sm ∆Sm
m t1 t2

To reduce the total number of operations, we can use that for types which are not present in the
t t
selected molecule the increments ∆Cm , ∆Sm are zero:
t t new t
∆Cm = [Cm ]M − [Cm ]M
t t new t
∆Sm = [Sm ]M − [Sm ]M
where X
t
[C, Sm ]M = cos, sin(km rj )
j∈Mt
X
t new
[C, Sm ]M = cos, sin(km rnew
j )
j∈Mt

For t not in types of the molecule Mt is empty:

t∈
/ T (M ) ⇔ Mt = ∅

where [
T (M ) = T (j)
j∈M

Then we can rewrite the sum as follows:


XX X     
LJ t1 t2 t1 t1 t2 t1 t1 t2
∆Uf ourier = βLJ (km ) 2Cm + ∆Cm ∆Cm + 2Sm + ∆Sm ∆Sm
m t1 t2 ∈Mt

Again, this sum can be rewritten as a sum for m ≥ 0:

(  ∆UfLJ
ourier =
XX X     
t1 t2 t1 (+++) t1 (+++) t2 (+++) t1 (+++) t1 (+++) t2 (+++)
βLJ (km ) 2Cm + ∆Cm ∆Cm + 2Sm + ∆Sm ∆Sm
m t1 t2 ∈Mt  
  
t1 (+−+) t1 (+−+) t2 (+−+) t1 (+−+) t1 (+−+) t2 (+−+)
sgn(my )· 2Cm + ∆Cm ∆Cm + 2Sm + ∆Sm ∆Sm
    
t1 (++−) t1 (++−) t2 (++−) t1 (++−) t1 (++−) t2 (++−)
sgn(mz )· 2Cm + ∆Cm ∆Cm + 2Sm + ∆Sm ∆Sm
    )
t (+−−) t (+−−) t (+−−) t (+−−) t (+−−) t (+−−)
sgn(my mz )· 2Cm1 + ∆Cm1 ∆Cm2 + 2Sm1 + ∆Sm1 ∆Sm2

(377)

40
10 The Algorithm
Using the derivations done in the previous section, we can write the following Mote Carlo Move
algorithm:

1. Select the molecule M .

2. Calculate [Ureal ]old


M .

t t
3. Calculate [Sm ]M , [Cm ]M and [Sm ]M , [Cm ]M for t ∈ T (M )

4. Calculate the forces

5. Select the new position of the molecule

6. Calculate [Ureal ]new


M

7. ∆Ureal = [Ureal ]new old


M − [Ureal ]M

8. Calculate [Sm ]new new t new t new


M , [Cm ]M and [Sm ]M , [Cm ]M for t ∈ T (M )

9. ∆C, Sm = [C, Sm ]new


M − [C, Sm ]M
 t new t
t [C, Sm ]M − [C, Sm ]M , t ∈ T (M )
∆C, Sm =
0, t ∈/ T (M )

10. Calculate ∆UfCourier , ∆UfLJ


ourier

11. ∆Uf ourier = ∆UfCourier + ∆UfLJ


ourier

12. Calculate new forces ( needed to decide about acception/decination the move)

13. Accept or decline the move

14. if accepted then update the sums:


[C, Sm ]new = C, Sm + ∆C, Sm
 t t
t new C, Sm + ∆C, Sm t ∈ T (M )
[C, Sm ] = t
C, Sm t ∈
/ T (M )
However, the algorithm can be accelerated a little-bit. Indeed, we can save the time needed for
computation of the forces and the energies in the real space. The real-space sum can be defined
in a following way:
1X
Ureal = usj (|rsj;n |)
2 sjn

where
usj (r) = qs qj ψ C (r) + 4sj (σsj
12 12 6 6
ψ (r) + σsj ψ (r))
erfc(αr)
ψ C (r) =
r
2 2
w e−α r
ψ (r) = Cw (r)
rw

41
w/2−1
X (αr)2l
Cw (r) =
l=0
l!
We can re-write the sum in a following form:
1X
Ureal = uj
2 j

where X
uj = usj (|rsj;n |)
s;n

Then if the molecule M moves, we need to update the sums:


new
Ureal = Ureal + ∆Ureal

where
∆Ureal = [Ureal ]new
M − [Ureal ]M
XX X
[Ureal ]new
M = usj (|rnew
sj;n |) = unew
j
j∈M s;n j∈M
X
[Ureal ]M = uj
j∈M

So, if uj are stored, then to calculate the potential energy difference in a real space we only
need to re-calculate unew
j for j ∈ M which is N NM operations where NM is number of atoms
in the molecule. Note, that in calculation of uj we can avoid summation of the inter-molecular
contributions, because the molecules are rigid and thus the total inter-molecular contributions are
constant (do not change after the move). Let M (j) be the molecule which contains the atom j.
Then we define X X
uj ≡ u(rsj;n ) unew
j ≡ new
u(rsj;n )
s∈M
/ (j);n s∈M
/ (j);n

However, if the move is accepted, we need then to update the uj . To do this, let’s look at uj
where j ∈
/ M:
X X
unew
j = u(|rsj;n |) + u(|rnew new
sj;n |) = uj + [uj ]M − [uj ]M
s∈M
/ ;n s∈M ;n

where X
[uj ]M = u(|rsj;n |)
s∈M ;n
X
[uj ]new
M = u(|rnew
sj;n |)
s∈M ;n

The same with forces. The real-space force acting at atom p can be written as
X
Fp = fpj (rpj;n ) (378)
j;n

where  
LJ(p,j)
fpj (r) = qp qj FRC (|r|) + FR (|r|) ◦ r

42
LJ(p,j)
where FRC , FR are defined by (308) and (329) and ◦ means a point-wise multiplication. Then,
if the molecule M moves, the new forces can be written as follows:
 X

 fpj (rnew
pj;n ) p∈M

j ∈M,n
/
Fnew
p = X X


 f pj (r pj;n ) + fpj (rp − rnew
j + n ◦ L) p ∈
/M
j ∈M,n
/ j∈M,n

For p ∈ M we do take sum over j ∈ / M , because we assume that the molecule is rigid, thus the
inter-molecular forces should compensate itself. Considering that the sum is over all n ∈ Z3 we
can change n → −n and re-write the second sum in case p ∈ / M as follows:
X X X
[Fp ]new
M ≡ f (r
pj p − r new
j + n ◦ L) = f (r
pj p − rnew
j − n ◦ L) = fpj (−rnew
jp;n )
j∈M,n j∈M,n j∈M ;n

where rnew new


jp;n = rj − rp + n ◦ L. We also can represent the sum over j ∈ / M as a difference of a full
sum (378) and the sum over j ∈ M (again sum over n is equivalent to sum over −n:
X X
fpj (rpj;n ) = Fp − fpj (rp − rj − n ◦ L)
j ∈M,n
/ j∈M,n

X
= Fp − fpj (−(rj − rp + n ◦ L)) = Fp − [Fp ]M
j∈M,n

where X X
[Fp ]M ≡ fpj (−(rj − rp + n ◦ L)) = fpj (−rjp;n )
j∈M,n j∈M,n

Then for p ∈
/ M we can write

Fnew
p = Fp + [Fp ]new
M − [Fp ]M

We note, also, that some actions better do in connection. For example, calculation of forces is
better do with the calculation of the energy, because the formulae for their calculation has many
common parts (and thus calculations can be accelerated by their re-useage). With these additions,
the algorithm can be re-written as follows:
Input:

• rj for j = 1 . . . N

• uj , Fj , for all j = 1 . . . N
t t
• Cm S m Cm Sm for all m ∈ Z3 for all t = 1 . . . Nt where 2π|m|/L < Kmax

Output:
If accepted:

• Selected molecule M

• rnew
j for j ∈ M

• unew
j , Fnew
j , for all j = 1 . . . N

43
• [Cm ]new [Sm ]new [Cm
t new
] t new
[Sm ] for all m ∈ Z3 for all t = 1 . . . Nt

Algorithm:

1. Select the molecule M .

2. [Ureal ]old
P
M = j∈M uj .

t t
3. Calculate [Sm ]M , [Cm ]M and [Sm ]M , [Cm ]M for t ∈ T (M )

4. Calculate total force and total torque of the molecule M :


X X
FM = Fj τM = dj × Fj
j∈M j∈M

where dj = rj − RM M
C , RC is the center of mass of the molecule.

5. Select the new position of the molecule

6. For p ∈ M , j ∈
/ M calculate
X
• unew
p = new
upj (rpj;n )
j ∈M
/ ;n
X
• [uj ]new
M = upj (rpj;n )
p∈M
X
• [Ureal ]new
M = unew
p
p∈M
X
• Fnew
p = fpj (rnew
pj;n )
j ∈M
/
X
• [Fj ]new
M = fpj (−rnew
jp;n )
p∈M

7. ∆Ureal = [Ureal ]new old


M − [Ureal ]M

8. Calculate [Sm ]new new t new t new


M , [Cm ]M and [Sm ]M , [Cm ]M for t ∈ T (M )

9. ∆C, Sm = [C, Sm ]new


M − [C, Sm ]M
 t new t
t [C, Sm ]M − [C, Sm ]M , t ∈ T (M )
∆C, Sm =
0, t ∈/ T (M )

10. Calculate ∆UfCourier , ∆UfLJ


ourier

11. ∆Uf ourier = ∆UfCourier + ∆UfLJ


ourier

12. Calculate new forces and torques for molecule M :


X X
FMnew = F new
j τ M
new = dj × Fnew
j
j∈M j∈M

13. Accept or decline the move

44
14. if accepted then:

(a) Update k-space sums: [C, Sm ]new = C, Sm + ∆C, Sm


 t t
t new C, Sm + ∆C, Sm t ∈ T (M )
[C, Sm ] = t
C, Sm t∈/ T (M )
(b) For j ∈
/ M calculate
X
• [uj ]M = u(rpj;n )
p∈M ;n
X
• [Fj ]M = fpj (−rjp;n )
p∈M ;n

(c) For j ∈
/ M update uj ,Fj :
uj = uj + [uj ]new
new
M − [uj ]M Fnew
j = Fj + [Fj ]new
M − [Fj ]M

References
[1] M. P. Allen and D. J. Tildesley. Computer Simulation of Liquids. Oxford University Press,
1991.

[2] Donald E. Williams. Accelerated convergence of crystal-lattice potential sums. Acta Crystal-
lographica Section A, 27:452–455, 1971.

[3] Naoki Karasawa and William A. Goddard III. Acceleration of convergence for lattice sums. J.
Phys. Chem., 93:7320–7327, 1989.

[4] B. R. A. Nijboer and F. W. de Wette. On the calculation of lattice sums. Physica, 23:309–321,
1957.

[5] Daan Frenkel and Berend Smit. Understanding Molecular Simulations. Academic Press, 2002.

45

You might also like