Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay...

38
Non-bonded Interactions Overview Computation of the Non-Bonded Potential Recall that the non-bonded contribution to the potential function takes the form V nb (R)= X i <j - A ij r 6 ij + B ij r 12 ij ! + X i <j q i q j r ij . Since each of these sums contains O (N 2 ) terms, direct evaluation of the non-bonded potential is impractical in systems containing thousands or more atoms. In such cases, it is usually necessary to estimate V nb using faster, approximate methods. Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38

Transcript of Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay...

Page 1: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Overview

Computation of the Non-Bonded Potential

Recall that the non-bonded contribution to the potential function takesthe form

Vnb(R) =∑i<j

(−

Aij

r6ij

+Bij

r12ij

)+∑i<j

qiqj

rij.

Since each of these sums contains O(N2) terms, direct evaluation of thenon-bonded potential is impractical in systems containing thousands ormore atoms. In such cases, it is usually necessary to estimate Vnb usingfaster, approximate methods.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38

Page 2: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Spherical Cutoffs

Cutoff Techniques

Cutoff techniques reduce the cost of the non-bonded computations toorder O(N) by ignoring non-bonded interactions between nuclei separatedby more than some maximum distance, b.

Typically, the interaction function is altered multiplicatively: f (r) isreplaced by f (r)S(r) where S(r) is zero for r > b.

The cutoffs can be applied using distances between atoms or betweengroup centers. Group-based methods treat atoms that belong to thesame residue or base similarly.

Cutoffs can be applied directly to the energy and to the force field.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 2 / 38

Page 3: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Spherical Cutoffs

Truncation

Truncation methods abruptly set the interaction term equal to 0 whenr ≥ b:

S(r) =

{1 if r < b0 if r ≥ b.

Advantage: easy to implement.

Disadvantage: because the truncated potential function isdiscontinuous, optimization and MD routines run poorly.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 3 / 38

Page 4: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Spherical Cutoffs

Switching

Switch functions smoothly reduce the energy to 0 over an interval [a, b].One example is

S(r) =

1 if r < a1 + y(r)2(2y(r)− 3)) if a ≤ r ≤ b0 if r ≥ b,

where y(r) = (r2 − a2)/(b2 − a2).

S(r) as defined above is continuously differentiable, so thecorresponding force field is continuous.

If a is close to b, then the derivative in [a, b] will be large.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 4 / 38

Page 5: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Spherical Cutoffs

Shift Functions

Shift functions gradually reduce the energy over the entire interval [0, b].One formulation used in CHARMM is:

S(r) =

{[1− r/b]2 if r < b0 if r ≥ b.

There is a tradeoff between smoothness and underestimation of thepotential:

Switch functions have larger derivatives but only underestimate theenergy over the region [a, b].

Shift functions underestimate the energy at all distances, but varymore smoothly.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 5 / 38

Page 6: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Spherical Cutoffs

Bookkeeping

Calculating the distance rij for every pair of atoms in the moleculerequires O(N2) steps.

To implement cutoff techniques in order O(N) calculations, eachatom is assigned a pairlist of atoms that are within some distanceb + c at the start of the calculation.

c should be taken large enough that only those atoms containedwithin the pairlist are likely to come within distance b of theassociated nucleus over the course of the calculation.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 6 / 38

Page 7: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Spherical Cutoffs

Cutoff Techniques in Practice

Truncation is almost never used because of the problems caused bydiscontinuities.

Shift functions are used with van der Waals forces, which decayrapidly over long distances (like r−6).

Because the Coulomb potential decays slowly (like r−1), long-rangeelectrostatic interactions are especially important in chargedmolecules like DNA.

Many studies have reported that structural modeling using sphericalcutoffs of the electrostatic potential gives poor results.Group-based methods perform especially poorly.Accurate results may be attainable using atom-based shifts withcutoffs of 12A (Norberg & Nilsson, 2000).

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 7 / 38

Page 8: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Overview

Ewald summation originated in crystallography as a method forcalculating slowly convergent electrostatic potentials.

We consider a group of point charges in an infinite periodic lattice.

Each point charge is screened by a smooth charge distribution of theopposite sign. This leads to a rapidly converging potential (directsum).

The screening charges are compensated by a smooth distributionthat leads to slowly converging potential (indirect sum).

Because the compensatory distribution is smooth, it can be convertedto a rapidly converging Fourier series (Poisson summation).

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 8 / 38

Page 9: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Periodic Extension of the Charge Distribution

To apply Ewald summation to the electrostatic potential encountered inMM, we imagine that the molecule sits in a cubic cell of side length L thatis used to form an infinite periodic lattice. We then seek to calculate

Vel =1

2

′∑n

N∑i ,j=1

qiqj

|xij + n|

where

n = L(n1, n2, n3) denotes a cell-coordinate vector;

The ′ over the first sum means that terms with i = j are omittedwhen n = (0, 0, 0).

Ewald summation can also be carried out over other periodic lattices.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 9 / 38

Page 10: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Screening and Canceling Distributions

The charge distribution is decomposed as∑i

qiδxi =∑

i

qi

(δi − (ν + xi )

)+∑

i

qi (ν + xi )

where ν is a probability distribution with a smooth density and ν + xi

denotes the translate of ν to xi .

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 10 / 38

Page 11: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Screening Distribution

The screening distribution ν is usually taken to be a radially-symmetricthree-dimensional Gaussian distribution with density:

gβ(r) ≡(β√π

)3

e−β2r2.

As β increase, ν converges weakly to a point mass at 0.

gβ(r) has smooth, rapidly-decaying tails.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 11 / 38

Page 12: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Poisson’s Equation

Given a charge distribution ρ(r), the electrostatic potential Φ(r) can befound by solving Poisson’s equation

∇2Φ(r) = −4πρ(r).

Recall that the solution can be expressed as a convolution

Φ(r) =

∫R3

ρ(r′)

|r− r′|dr′,

where G (r, r′) = 1|r−r′| is the fundamental solution in R3:

∇2G (r, r′) = −4πδ(r− r′).

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 12 / 38

Page 13: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Potential of a Gaussian Charge

The potential of a Gaussian screening charge located at zero is

ΦGauss(r) =

∫R3

gβ(r′)

|r− r′|dr′ =

∫R3

gβ(s + r)

|s|ds

=

(β√π

)3 ∫R3

exp(− β2|s + r|2

)|s|

ds

The last integral can be evaluated by noting that since gβ(r) is radiallysymmetric, so is ΦGauss(r), and therefore we can take r = (0, 0, r) andwrite

|s + r|2 = s2 + 2rs cos(θ) + r2,

where θ is the angle between s and the z-axis.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 13 / 38

Page 14: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Transforming to spherical coordinates (s, θ, φ) gives

ΦGauss(r) =

=

(β√π

)3 ∫ ∞0

s2ds

∫ π

0sin(θ)dθ

∫ 2π

0dφ

1

se−β

2(s2+2rs cos(θ)+r2)

= 2π

(β√π

)3

e−β2r2∫ ∞

0se−β

2s2ds

∫ π

0sin(θ)e−2β2rs cos(θ)dθ

= 2π

(β√π

)3

e−β2r2∫ ∞

0se−β

2s2ds

∫ 1

−1e−2β2rsudu

β2

(β√π

)3 1

re−β

2r2∫ ∞

0e−β

2s2(e−2β2rs − e2β2rs

)ds

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 14 / 38

Page 15: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

=β√π

1

re−β

2r2∫ ∞

0

(e−β

2(s2+2rs) − e−β2(s2+2rs)

)ds

=β√π

1

r

∫ ∞0

(e−β

2(s+r)2 − e−β2(s−r)2

)ds

=β√π

1

r

(∫ ∞r

e−β2s2

ds −∫ ∞−r

e−β2s2

ds

)=

2β√π

1

r

∫ r

0e−β

2s2ds =

2√π

1

r

∫ βr

0e−t2

dt.

Thus, the potential induced by a Gaussian charge distribution is just

ΦGauss(r) =1

rerf (βr),

where erf (x) denotes the error function.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 15 / 38

Page 16: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Potential of a Single Screened Charge

Since the potential induced at r by a point charge at 0 is 1r , it follows that

the combined potential of a point charge and its screening Gaussian is

Φdir (r) =1

r− 1

rerf (βr) ≡ 1

rerfc(βr)

where erfc(x) = 2π

∫∞x e−t2

dt is the complementary error function. Inparticular, this function decays exponentially as r →∞:

Φdir (r) <1

βr2√π

e−β2r2.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 16 / 38

Page 17: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Direct Potential Energy

To compute the total potential energy of the point charges in the presenceof the screened point charges, we calculate

Vdir =1

2

N∑i=1

qi

′∑n

N∑j=1

qjΦdir (n + rj − ri )

=1

2

′∑n

N∑i ,j=1

qiqj

(erfc(β|rij + n|)|rij + n|

).

Because erfc(r) decays exponentially, this infinite sum converges rapidly.Furthermore, by choosing β sufficiently large, we can compute the sumto any degree of accuracy using only order O(N) terms.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 17 / 38

Page 18: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Compensatory Potential

Since the compensatory charge distribution consists of a superposition ofGaussian distributions, each of which has potential erf (βr)/r , the totalpotential energy of the point charges caused by the canceling charges is

Vcomp =1

2

N∑i=1

qi

′∑n

N∑j=1

qjΦgauss(ri − (rj + n))

=1

2

′∑n

N∑i ,j=1

qiqjerf (β|rij + n|)|rij + n|

.

However, since erf (r) tends to 1 as r →∞, this sum is slowly converging.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 18 / 38

Page 19: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Poisson Summation

The key step in the Ewald method is that Vcomp can be converted to arapidly converging sum by using the Poisson summation formula:

F (x) ≡∑n∈Λ

f (x + n) =1

V

∑k∈Λ′

f (k)e2πix·k

where

F is the periodic summation of a function f : Rd → R.

Λ is a lattice in Rd with cell volume V and dual lattice Λ′.

f is the Fourier transform of f :

f (k) =

∫Rd

f (x)e−2πik·xdx.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 19 / 38

Page 20: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Poisson Summation of the Compensatory Potential

To evaluate the compensatory potential, we take

f (r) =1

2

N∑i ,j=1

qiqj

(erf (β|rij + r|)|rij + r|

)≡ 1

2

N∑i ,j=1

qiqjφ(rij + r)

and set

Vrecip =∑n∈Λ

f (n) =1

V

∑k∈Λ′

f (k).

Note: To use Poisson summation, we need to remove the restriction inVcomp on the sum over i , j when n = 0. We will correct for this later.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 20 / 38

Page 21: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Evaluating f

Notice that the Fourier transform of f can be expressed as

f (k) =N∑

i ,j=1

qiqj φ(k)e2πk·(ri−rj ),

where

φ(k) =

∫R3

1

|r|erf (β|r|)e−2πik·rdr.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 21 / 38

Page 22: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Although φ can be calculated directly from the integral, Poisson’sequation provides an easier route:

∇2φ(r) = −4πgβ(r).

Expanding φ and gβ in Fourier series and substituting into Poisson’sequation gives:

∇2

(∑k

φ(k)e−2πik·r

)= −4π2

∑k

|k|2φ(k)e−2πik·r

= −4π∑

k

gβ(k)e−2πik·r

which implies that

φ(k) =1

π|k|2gβ(k).

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 22 / 38

Page 23: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Since the Fourier transform of gβ is

gβ(k) =

∫R3

(β√π

)3

e−β2|r|2e2πik·rdr = e−π

2|k|2/β2,

the equality on the previous slide gives

φ(k) =1

π|k|2e−π

2|k|2/β2

and then

f (k) =e−π

2|k|2/β2

π|k|2N∑

i ,j=1

qiqje2πk·(ri−rj ) ≡ e−π

2|k|2/β2

2π|k|2|S(k)|2.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 23 / 38

Page 24: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Structure Factor

In crystallography, the function S is known as the charge-weightedstructure factor:

S(k) =N∑

j=1

qje2πk·rj .

S is the Fourier transform of the discrete charge density within thecell located at the origin.

It takes order O(N) computations to evaluate S(k) at eachwavelength k.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 24 / 38

Page 25: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

A Rapidly Converging Series for the Reciprocal Sum

Substituting the Fourier transform of f back into the Poisson summationformula gives the series

Vrecip =1

2πV

∑k

e−π2|k|2/β2

|k |2|S(k)|2,

which is rapidly converging since S(·) is bounded and thus the termsdecay exponentially as the wave number k increases.

The Fourier series converges rapidly because the functionφ(z) = erf (βz)/z is smooth (in fact, entire) when β <∞.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 25 / 38

Page 26: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Self-Interaction Term

Recall that the reciprocal sum includes some terms not present in Vcomp:

Vcomp =1

2

′∑n

N∑i ,j=1

qiqjerf (β|rij + n|)|rij + n|

Vrecip =1

2

∑n

N∑i ,j=1

qiqjerf (β|rij + n|)|rij + n|

.

Since the extra terms correspond to non-physical self-interactions betweenthe point charges and the compensatory Gaussian charge distribution, theyneed to be subtracted when calculating the total energy.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 26 / 38

Page 27: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Self-Interaction Term

Since

limr→0

1

|r|erf (β|r|) = lim

r→0

2

|r|√π

∫ β|r|

0e−t2

dt =2β√π,

the correction for the self-interaction energy is

Vself ≡ Vcomp − Vrecip =−β√π

N∑i=1

q2i .

Notice that this sum contains O(N) terms and does not depend on thelocations of the nuclei.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 27 / 38

Page 28: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

The Ewald Representation

Putting everything together, we obtain the following decomposition of thelattice electrostatic potential

Vel = Vdir + Vrecip − Vself

=1

2

′∑n

N∑i ,j=1

qiqj

(erfc(β|rij + n|)|rij + n|

)

+1

2πV

∑k

e−π2|k|2/β2

|k |2|S(k)|2

− β√π

N∑i=1

q2i ,

where both infinite sums are rapidly converging.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 28 / 38

Page 29: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Finite-Dielectric Correction

A fourth term must be added to the electrostatic energy whenever thedipole moment of a unit cell is non-zero:

Vcell =2π

3L3ε

∣∣∣∣∣∣N∑

j=1

qj rj

∣∣∣∣∣∣2

.

The vector quantity inside the modulus is the dipole moment of a unitcell. This sum can be evaluated in order N steps.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 29 / 38

Page 30: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Optimization of β

Recall that β controls the variance of the Gaussian screening charges.

As β increases, the direct sum Vdir converges more rapidly and sofewer terms need to be summed to achieve a desired accuracy.

On the other hand, increasing β causes the reciprocal sum Vrecip toconverge more slowly, requiring more terms to be summed.

The self-interaction term contains N terms and is independent of β.

These observations suggest that β should be chosen neither too large nortoo small to minimize the total work needed to estimate Vel to somespecified degree of accuracy.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 30 / 38

Page 31: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Optimization of β

Perram et al. (1988) gave the following heuristic for choosing β:

Let δ denote the acceptable relative error.

If β is chosen so that only charges within some distance b areincluded in the direct sum, then to satisfy the error condition we need:

β ∼√− ln(δ)/b.

If td is the time required to compute one term in the direct sum, thenthe total amount of time required for this sum will be roughly

Td ≈ Cd td · N · (b3 · N/V ) ≈ C1N2β−3.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 31 / 38

Page 32: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Optimization of β

Similarly, the time required to compute the indirect sum can be estimated.

If K denotes the maximum magnitude of the wave numbers that areincluded in the sum, then to achieve a relative error of δ, we need

K ∼ β√− ln(δ).

If tr is the time required to compute one term in the reciprocal sum,then the total amount of time required for this sum will be roughly

Tr ≈ Cr trK3N ≈ C2Nβ

3.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 32 / 38

Page 33: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Ewald summation

Optimization of β

The total time required to sum Vdir and Vrecip to the desired accuracy isthen

T = Tdir + Trec = C1N2β−3 + C2Nβ

3.

To find the value of β that minimizes T , we set dTdβ3 = 0, which gives

βopt ∼ (C1N/C2)1/6 and

Tmin ≈ C4N2N−1/2 + C5NN1/2 ≈ CN3/2.

Thus, by choosing β appropriately, Ewald summation can be completed inorder O(N3/2) time.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 33 / 38

Page 34: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Particle Mesh Ewald Methods

Fourier Transforms are a bottleneck in Ewald summation.

The time required to calculate Vrecip is determined by two factors:

Order O(β3) terms must be included in this sum to achieveacceptable levels of accuracy.

Each evaluation of the structure function S(k) requires orderO(N) time.

If the Fast Fourier transform (FFT) could be used, then we could reducethis time to order O(β3 log(β3)). The obstacle is that, apart from crystals,the charges are not located on a lattice within each cell.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 34 / 38

Page 35: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Particle Mesh Ewald Methods

Mesh Interpolation

Particle-Mesh Ewald (PME) methods address this problem by meshinterpolation:

Interpolate the charge distribution onto a periodic lattice (particlemesh) containing K points.

Use the FFT to calculate the structure function at all K reciprocalwave numbers. This can be done in order O(K log(K )) time.

Of course, K must be taken sufficiently large that the interpolated chargedistribution is a good approximation to the true distribution. Because theinterpolation can be done locally, K ∼ O(N) suffices.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 35 / 38

Page 36: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Particle Mesh Ewald Methods

Particle-Mesh Ewald Methods

PME can be implemented in O(N log(N)) time:

β can be chosen large enough to reduce Vdir to an order O(N)calculation.

Order O(N) points are then needed in the mesh.

The discrete charge density can be interpolated to the mesh in O(N)time.

The first formulation of PME used Lagrange interpolation (Darden etal., 1993).Essmann et al. (1995) reformulated PME using B-spline interpolation,which leads to improved accuracy and smooth gradients.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 36 / 38

Page 37: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions Particle Mesh Ewald Methods

Time Comparison

The table shows the times required to complete one energy and onegradient calculation for a solvated BPTI molecule (14275 atoms) usingdifferent methods to calculate the electrostatic potential.

Method Time (s)

12 A switch 3.1PME 8.5All non-bonded 54.8

Source: Schlick (2006).

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 37 / 38

Page 38: Computation of the Non-Bonded Potentialjtaylor/teaching/Fall2010/APM... · 2010. 9. 13. · Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 1 / 38. Non-bonded Interactions Spherical

Non-bonded Interactions References

References

Darden, T., York, D. and Pedersen, L. (1993) Particle mesh Ewald:An N · log(N) method for Ewald sums in large systems. J. Chem.Phys. 98: 10089-10092.

Essmann, U. et al. (1995) A smooth particle mesh Ewald method. J.Chem. Phys. 103: 8577-8593.

Frenkel, D. and Smit, B. (2002) Understanding Molecular Simulation:From Algorithms to Applications. Second Edition, Academic Press.

Perram, J., Petersen, J. and De Leeuw, S. (1988) An algorithm forthe simulation of condensed matter which grows as the 3/2 power ofthe number of particles. Mol. Phys. 65: 875-893.

Schlick, T. (2006) Molecular Modeling and Simulation. Springer.

Jay Taylor (ASU) APM 530 - Lecture 5 Fall 2010 38 / 38