• Keine Ergebnisse gefunden

Parameter tuning for the nonuniform FFT and applications

N/A
N/A
Protected

Academic year: 2022

Aktie "Parameter tuning for the nonuniform FFT and applications"

Copied!
56
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Parameter tuning for the nonuniform FFT and applications

Parameter tuning for the nonuniform FFT and applications

Franziska Nestler Chemnitz University of Technology

Faculty of Mathematics

Mecklenburg Workshop

Approximation Methods and Fast Algorithms September 10 – 14, 2018, Hasenwinkel

(2)

Parameter tuning for the nonuniform FFT and applications Overview

Overview

1 Parameter tuning for the NFFT

Introduction to NFFT

Error in theL2-norm

Parameter choice and comparison of window functions

2 Application: interactions in particle systems

Coulomb problem and Ewald summation

A fast NFFT based algorithm

Errors and parameter choice

(3)

Parameter tuning for the nonuniform FFT and applications Introduction to NFFT

FFT for nonequispaced data – NFFT

Trig. polynomial: f(x) := X

k∈IM

ke2πik>x x∈Td

Notation: SetIM :={−M/2, . . . ,M/2−1}d⊂ZdfürM ∈2N.

TorusT:=R/Z'[−1/2,1/2).

(inverse) FFT: fj := X

k∈IM

ke2πik>j/M j∈IM

, N :=|IM|=Md

NFFT: f(xj) := X

k∈IM

ke2πik>xj xj∈Td, j= 1, . . . , N

adjoint NFFT: h(k) :=

N

X

j=1

fje−2πik>xj xj∈Td,k∈ IM

Complexity:O(|IM|log|IM|

+N

)

[Dutt, Rokhlin 1993] [Beylkin 1995] [Potts, Steidl, Tasche 2001] [Greengard, Lee 2004]

(4)

Parameter tuning for the nonuniform FFT and applications Introduction to NFFT

FFT for nonequispaced data – NFFT

Trig. polynomial: f(x) := X

k∈IM

ke2πik>x x∈Td

Notation: SetIM :={−M/2, . . . ,M/2−1}d⊂ZdfürM ∈2N.

TorusT:=R/Z'[−1/2,1/2).

(inverse) FFT: fj := X

k∈IM

ke2πik>j/M j∈ IM, N :=|IM|=Md

NFFT: f(xj) := X

k∈IM

ke2πik>xj xj∈Td, j= 1, . . . , N

adjoint NFFT: h(k) :=

N

X

j=1

fje−2πik>xj xj∈Td,k∈ IM

Complexity:O(|IM|log|IM|+N)

[Dutt, Rokhlin 1993] [Beylkin 1995]

[Potts, Steidl, Tasche 2001] [Greengard, Lee 2004]

(5)

Parameter tuning for the nonuniform FFT and applications Introduction to NFFT

FFT for nonequispaced data – NFFT

Trig. polynomial: f(x) := X

k∈IM

ke2πik>x x∈Td

Notation: SetIM :={−M/2, . . . ,M/2−1}d⊂ZdfürM ∈2N.

TorusT:=R/Z'[−1/2,1/2).

(inverse) FFT: fj := X

k∈IM

ke2πik>j/M j∈ IM, N :=|IM|=Md

NFFT: f(xj) := X

k∈IM

ke2πik>xj xj∈Td, j= 1, . . . , N

adjoint NFFT: h(k) :=

N

X

j=1

fje−2πik>xj xj∈Td,k∈ IM

Complexity:O(|IM|log|IM|+N)

[Dutt, Rokhlin 1993] [Beylkin 1995]

[Potts, Steidl, Tasche 2001] [Greengard, Lee 2004]

(6)

Parameter tuning for the nonuniform FFT and applications Introduction to NFFT

Idea

Trace problem back to equidistant case via convolution with awindow function.

iFFT:

gl:= 1 Md

X

k∈IM

1 ck( ˜ϕ)

ke2πik>l/M (l∈ IM)

Convolution with window:

f(xj)≈

X

l∈IM

glϕ˜ xjMl

=:f(xj)

12

1

0 2 1

M

mM,Mm

˜ ϕ(x)

12

1

0 2

Higher accuracy: enlarge support parameterm∈N,oversampling factorσ≥1

(7)

Parameter tuning for the nonuniform FFT and applications Introduction to NFFT

Idea

Trace problem back to equidistant case via convolution with awindow function.

iFFT:

gl:= 1 Md

X

k∈IM

1 ck( ˜ϕ)

ke2πik>l/M (l∈ IM)

Convolution with window:

f(xj)≈ X

l∈IM

glϕ˜ xjMl

=:f(xj)

12

1

0 2 1

M

mM,Mm

˜ ϕ(x)

12

1

0 2

Higher accuracy: enlarge support parameterm∈N,oversampling factorσ≥1

(8)

Parameter tuning for the nonuniform FFT and applications Introduction to NFFT

Idea

Trace problem back to equidistant case via convolution with awindow function.

iFFT:

gl:= 1 Md

X

k∈IM

1 ck( ˜ϕ)

ke2πik>l/M (l∈ IM)

Convolution with window:

f(xj)≈ X

l∈IM

glϕ˜ xjMl

=:f(xj)

12

1

0 2 1

M

mM,Mm

˜ ϕ(x)

12

1

0 2

Higher accuracy: enlarge support parameterm∈N

,oversampling factorσ≥1

(9)

Parameter tuning for the nonuniform FFT and applications Introduction to NFFT

Idea

Trace problem back to equidistant case via convolution with awindow function.

iFFT:

gl:= 1 σdMd

X

k∈IM

1 ck( ˜ϕ)

ke2πik>l/σM (l∈ IσM)

Convolution with window:

f(xj)≈ X

l∈IσM

glϕ˜ xjσMl

=:f(xj)

12

1

0 2 1

σM

σMm ,σMm

˜ ϕ(x)

12

1

0 2

Higher accuracy: enlarge support parameterm∈N,oversampling factorσ≥1

(10)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Error in the L

2

-norm

In the following we consider the cased:= 1.

Letϕbe a rapidly decreasing function. Commonly, we choose

˜

ϕ(x) :=X

n∈Z

ϕ(x+n).

Forcompactly supportedfunctionsϕwe have

kf−fk2L2= X

k∈IM

|fˆk|2 X

r∈Z3

c2k+rσM( ˜ϕ) c2k( ˜ϕ) .

Strongly depends on:

window functionϕwith support[−m/σM,m/σM]

support parameterm

oversampling factorσ

Fourier coefficientsfˆk

(11)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Error in the L

2

-norm

In the following we consider the cased:= 1.

Letϕbe a rapidly decreasing function. Commonly, we choose

˜

ϕ(x) :=X

n∈Z

ϕ(x+n).

Forcompactly supportedfunctionsϕwe have

kf−fk2L2= X

k∈IM

|fˆk|2 X

r∈Z3

c2k+rσM( ˜ϕ) c2k( ˜ϕ) .

Strongly depends on:

window functionϕwith support[−m/σM,m/σM]

support parameterm

oversampling factorσ

Fourier coefficientsfˆk

(12)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Compactly supported window functions

Centered cardinal B-spline: with support[−σMm,σMm ]

ϕ(x) =B2m(σM x), ck( ˜ϕ) = 1 σMsinc2m

πk σM

Kaiser-Bessel (Bessel-I0): with ashape parameterb >0 ϕ(x) = 12I0(bp

m2−σ2M2x2)·χ[−m σM,σMm ]

ck( ˜ϕ) = 1 σM

sinh(b

2k2/(σ2M2)−m2)

b2−4π2k2/(σ2M2) :|k| ≤ σMb msinc(mp

2k2/(σ2M2)−b2) :else

Truncated Gaussian: with ashape parameterb >0 ϕ(x) = 1

πbe−σ2M2x2/b·χ[−σMm ,σMm ]

ck( ˜ϕ) = e−bπ2k2/(σ2M2)

σM Re

" erf m

√b+ iπk√ b σM

!#

(13)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Compactly supported window functions

Centered cardinal B-spline: with support[−σMm,σMm ]

ϕ(x) =B2m(σM x), ck( ˜ϕ) = 1 σMsinc2m

πk σM

Kaiser-Bessel (Bessel-I0): with ashape parameterb >0 ϕ(x) = 12I0(bp

m2−σ2M2x2)·χ[−m σM,σMm]

ck( ˜ϕ) = 1 σM

sinh(b

2k2/(σ2M2)−m2)

b2−4π2k2/(σ2M2) :|k| ≤ σMb msinc(mp

2k2/(σ2M2)−b2) :else

Truncated Gaussian: with ashape parameterb >0 ϕ(x) = 1

πbe−σ2M2x2/b·χ[−σMm ,σMm ]

ck( ˜ϕ) = e−bπ2k2/(σ2M2)

σM Re

" erf m

√b+ iπk√ b σM

!#

(14)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Compactly supported window functions

Centered cardinal B-spline: with support[−σMm,σMm ]

ϕ(x) =B2m(σM x), ck( ˜ϕ) = 1 σMsinc2m

πk σM

Kaiser-Bessel (Bessel-I0): with ashape parameterb >0 ϕ(x) = 12I0(bp

m2−σ2M2x2)·χ[−m σM,σMm]

ck( ˜ϕ) = 1 σM

sinh(b

2k2/(σ2M2)−m2)

b2−4π2k2/(σ2M2) :|k| ≤ σMb msinc(mp

2k2/(σ2M2)−b2) :else

Truncated Gaussian: with ashape parameterb >0 ϕ(x) = 1

πbe−σ2M2x2/b·χ[−σMm ,σMm ]

ck( ˜ϕ) = e−bπ2k2/(σ2M2)

σM Re

"

erf m

√b+ iπk√ b σM

!#

(15)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Estimates for certain window functions

kf−fk2L2= X

k∈IM

|fˆk|2 X

r∈Z3

c2k+rσM( ˜ϕ) c2k( ˜ϕ)

| {z }

≤s(k)

≤ X

k∈IM

|fˆk|2s(k).

B-Spline[Steidl 1998]:

s(k) = 8m 4m−1

|k| σM

|k| σM −1

!4m

Bessel[N. 2016]: ForRk> σM|k| +b

s(k) = X

0<|r|≤Rk

c2k+rσM( ˜ϕ) c2k( ˜ϕ) + 1

c2k( ˜ϕ) ln

2π(|k|/σM−Rk)−b 2π(|k|/σM−Rk)+b

+ ln

2π(|k|/σM+Rk)+b 2π(|k|/σM+Rk)−b

4πbσ2M2

(16)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Estimates for certain window functions

kf−fk2L2= X

k∈IM

|fˆk|2 X

r∈Z3

c2k+rσM( ˜ϕ) c2k( ˜ϕ)

| {z }

≤s(k)

≤ X

k∈IM

|fˆk|2s(k).

B-Spline[Steidl 1998]:

s(k) = 8m 4m−1

|k|

σM

|k|

σM −1

!4m

Bessel[N. 2016]: ForRk> σM|k| +b

s(k) = X

0<|r|≤Rk

c2k+rσM( ˜ϕ) c2k( ˜ϕ) + 1

c2k( ˜ϕ) ln

2π(|k|/σM−Rk)−b 2π(|k|/σM−Rk)+b

+ ln

2π(|k|/σM+Rk)+b 2π(|k|/σM+Rk)−b

4πbσ2M2

(17)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Estimates for certain window functions

kf−fk2L2= X

k∈IM

|fˆk|2 X

r∈Z3

c2k+rσM( ˜ϕ) c2k( ˜ϕ)

| {z }

≤s(k)

≤ X

k∈IM

|fˆk|2s(k).

B-Spline[Steidl 1998]:

s(k) = 8m 4m−1

|k|

σM

|k|

σM −1

!4m

Bessel[N. 2016]: ForRk>σM|k| +b

s(k) = X

0<|r|≤Rk

c2k+rσM( ˜ϕ) c2k( ˜ϕ) + 1

c2k( ˜ϕ) ln

2π(|k|/σM−Rk)−b 2π(|k|/σM−Rk)+b

+ ln

2π(|k|/σM+Rk)+b 2π(|k|/σM+Rk)−b

4πbσ2M2

(18)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Parameter choice

Error estimate:

kf−fk2L2 ≤ X

k∈IM

|fˆk|2s(k). (1)

Questions:

How large to choosem,σin order to reach a certain accuracyε?

How to choose the shape parameterb?

Which window function performs best?

kunkown→worst case error analysis fˆkknown→compute (1)

(19)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Parameter choice

Error estimate:

kf−fk2L2 ≤ X

k∈IM

|fˆk|2s(k). (1)

Questions:

How large to choosem,σin order to reach a certain accuracyε?

How to choose the shape parameterb?

Which window function performs best?

kunkown→worst case error analysis fˆkknown→compute (1)

(20)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

The optimal shape parameter

In case of theBessel window functiona worst case error analysis suggests[Potts, Steidl 2003]

b:= 2π 1−1

(3.14 :σ=1.0, 3.77 :σ=1.25. Example:Known Fourier coefficients.

2 4 6

10−13 10−8 10−3

shape parameterb kffk2 L2

k:= 1+k12, k∈I64

2 4 6

10−17 10−11 10−5

shape parameterb kffk2 L2

k:= e−0.2k2, k∈I64

Estimated (solid) and measured (dotted) errors. Parameters:m= 4,σ∈ {1.0,1.25}.

(21)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

The optimal shape parameter

In case of theBessel window functiona worst case error analysis suggests[Potts, Steidl 2003]

b:= 2π 1−1

(3.14 :σ=1.0, 3.77 :σ=1.25.

Example:Known Fourier coefficients.

2 4 6

10−13 10−8 10−3

shape parameterb kffk2 L2

k:= 1+k12, k∈I64

2 4 6

10−17 10−11 10−5

shape parameterb kffk2 L2

k:= e−0.2k2, k∈I64

Estimated (solid) and measured (dotted) errors. Parameters:m= 4,σ∈ {1.0,1.25}.

(22)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

The optimal shape parameter

In case of theBessel window functiona worst case error analysis suggests[Potts, Steidl 2003]

b:= 2π 1−1

(3.14 :σ=1.0, 3.77 :σ=1.25.

Example:Known Fourier coefficients.

2 4 6

10−13 10−8 10−3

shape parameterb kffk2 L2

k:= 1+k12, k∈I64

2 4 6

10−17 10−11 10−5

shape parameterb kffk2 L2

k:= e−0.2k2, k∈I64

Estimated (solid) and measured (dotted) errors. Parameters:m= 4,σ∈ {1.0,1.25}.

(23)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Modified B-spline window

Introduce a shape parameterb∈ 12Nand set ϕ(x) :=B2b

σM b m x

.

supp(ϕ) = [−σMm ,σMm ]

Estimate:

For someRk∈Nwe obtain the upper bound[N. 2016]

s(k) = X

0<|r|≤Rk

c2k+rσM( ˜ϕ)

c2k( ˜ϕ) + 1 sinc4b mπkσM b

k

σM +Rk1−4b

σMk −Rk1−4b πm

b

4b

(4b−1)

.

3 4 5 6

10−9 10−7 10−5

shape parameterb kffk2 L2

3 4 5 6

10−15 10−10 10−5

shape parameterb kffk2 L2

k:=1+k12 (left) andfˆk:= e−0.2k2(right),m= 4,σ∈ {1.0,1.25}

(24)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Modified B-spline window

Introduce a shape parameterb∈ 12Nand set ϕ(x) :=B2b

σM b m x

. Estimate: For someRk∈Nwe obtain the upper bound[N. 2016]

s(k) = X

0<|r|≤Rk

c2k+rσM( ˜ϕ)

c2k( ˜ϕ) + 1 sinc4b mπkσM b

k

σM +Rk1−4b

σMk −Rk1−4b πm

b

4b

(4b−1) .

3 4 5 6

10−9 10−7 10−5

shape parameterb kffk2 L2

3 4 5 6

10−15 10−10 10−5

shape parameterb kffk2 L2

k:=1+k12 (left) andfˆk:= e−0.2k2(right),m= 4,σ∈ {1.0,1.25}

(25)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Modified B-spline window

Introduce a shape parameterb∈ 12Nand set ϕ(x) :=B2b

σM b m x

. Estimate: For someRk∈Nwe obtain the upper bound[N. 2016]

s(k) = X

0<|r|≤Rk

c2k+rσM( ˜ϕ)

c2k( ˜ϕ) + 1 sinc4b mπkσM b

k

σM +Rk1−4b

σMk −Rk1−4b πm

b

4b

(4b−1) .

3 4 5 6

10−9 10−7 10−5

shape parameterb kffk2 L2

3 4 5 6

10−15 10−10 10−5

shape parameterb kffk2 L2

k:= 12(left) andfˆk:= e−0.2k2(right),m= 4,σ∈ {1.0,1.25}

(26)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Parameter tuning

(1) Choice of the shape parameter:

Input:Fourier coefficientsfˆk, support paramterm, oversampling factorσ.

Determine the optimalbbased on the error estimates and a simple binary search algorithm.

(2) Oversampling factorσ:

Input:Fourier coefficientsfˆk, support parameterm, required accuracyε.

Use a simple binary search algorithm to determine the minimal requiredσ.

→For each consideredσoptimizebbased on(1). (3) Minimal runtime:

Input:Fourier coefficientsfˆk, required accuracyε.

Consider different support parametersm.

Determine viable parameter combinations based on(1)and(2).

The runtime minimizing combination will depend on your implementation, software, hardware etc.

min

{m,σ,b}tmeasure

(27)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Parameter tuning

(1) Choice of the shape parameter:

Input:Fourier coefficientsfˆk, support paramterm, oversampling factorσ.

Determine the optimalbbased on the error estimates and a simple binary search algorithm.

(2) Oversampling factorσ:

Input:Fourier coefficientsfˆk, support parameterm, required accuracyε.

Use a simple binary search algorithm to determine the minimal requiredσ.

→For each consideredσoptimizebbased on(1).

(3) Minimal runtime:

Input:Fourier coefficientsfˆk, required accuracyε.

Consider different support parametersm.

Determine viable parameter combinations based on(1)and(2).

The runtime minimizing combination will depend on your implementation, software, hardware etc.

min

{m,σ,b}tmeasure

(28)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Parameter tuning

(1) Choice of the shape parameter:

Input:Fourier coefficientsfˆk, support paramterm, oversampling factorσ.

Determine the optimalbbased on the error estimates and a simple binary search algorithm.

(2) Oversampling factorσ:

Input:Fourier coefficientsfˆk, support parameterm, required accuracyε.

Use a simple binary search algorithm to determine the minimal requiredσ.

→For each consideredσoptimizebbased on(1).

(3) Minimal runtime:

Input:Fourier coefficientsfˆk, required accuracyε.

Consider different support parametersm.

Determine viable parameter combinations based on(1)and(2).

The runtime minimizing combination will depend on your implementation, software, hardware etc.

min

{m,σ,b}tmeasure

(29)

Parameter tuning for the nonuniform FFT and applications Error in theL2-norm and window functions

Comparison of different window functions

2 4 6 8

10−24 10−14 10−4

support parameterm kffk2 L2

2 4 6 8

10−35 10−19 10−3

support parameterm kffk2 L2

Estimated errorskf−fk2for different window functions:

*Bessel,oB-spline,+Gaussian (all with optimizedb)

k:=1+k12 (left) andfˆk:= e−0.2k2(right),m∈ {2, . . . ,8},σ={1.0,1.25}

(30)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

The Coulomb problem

Charged particle system: LetNchargesqj∈Rat positionsxj∈R3be given.

Are interested in the electrostatic potentials (xij:=xi−xj):

φ(j) :=

N

X

i=1 i6=j

qi

kxijk, j= 1, . . . , N. → O(N2)?

3d-periodic boundary conditions ChooseS:=Z3,xj∈[−L/2,L/2)3and set

φ(j) :=X

n∈S N

X

i=1 i6=jifn=0

qi

kxij+Lnk

→crystals, etc.

(31)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

The Coulomb problem

Charged particle system: LetNchargesqj∈Rat positionsxj∈R3be given.

Are interested in the electrostatic potentials (xij:=xi−xj):

φ(j) :=

N

X

i=1 i6=j

qi

kxijk, j= 1, . . . , N. → O(N2)?

3d-periodic boundary conditions ChooseS:=Z3,xj∈[−L/2,L/2)3and set

φ(j) :=X

n∈S N

X

i=1 i6=jifn=0

qi

kxij+Lnk

→crystals, etc.

L

(32)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

The Coulomb problem

Charged particle system: LetNchargesqj∈Rat positionsxj∈R3be given.

Are interested in the electrostatic potentials (xij:=xi−xj):

φ(j) :=

N

X

i=1 i6=j

qi

kxijk, j= 1, . . . , N. → O(N2)?

3d-periodic boundary conditions ChooseS:=Z3,xj∈[−L/2,L/2)3and set

φ(j) :=X

n∈S N

X

i=1 i6=jifn=0

qi

kxij+Lnk

→crystals, etc.

Franziska Nestler, TU Chemnitz, Faculty of Mathematics 13

(33)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

The Coulomb problem

Charged particle system: LetNchargesqj∈Rat positionsxj∈R3be given.

Are interested in the electrostatic potentials (xij:=xi−xj):

φ(j) :=

N

X

i=1 i6=j

qi

kxijk, j= 1, . . . , N. → O(N2)?

3d-periodic boundary conditions ChooseS:=Z3,xj∈[−L/2,L/2)3and set

φ(j) :=X

n∈S N

X

i=1 i6=jifn=0

qi

kxij+Lnk

→crystals, etc.

(34)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Ewald summation

φ(j) =X

n

X

i

qi

kxij+Lnk

Idea: Split kernel function into two parts[Ewald 1921]

1 r

= f(αr) r

| {z } long ranged, continuous

+ 1−f(αr) r

| {z } short ranged, singularity

0 0.2 0.4 0.6 0.8 1 0

2 4 6 8 10

φ(j) =X

n

X

i

qif(αkxij+Lnk) kxij+Lnk

| {z }

Fourier space

+X

n

X

i

qi

1−f(αkxij+Lnk) kxij+Lnk

| {z }

direct via truncation kxij+Lnk ≤rcut

(35)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Ewald summation

φ(j) =X

n

X

i

qi

kxij+Lnk

Idea: Split kernel function into two parts[Ewald 1921]

1

r = f(αr) r

| {z } long ranged, continuous

+ 1−f(αr) r

| {z } short ranged, singularity

0 0.2 0.4 0.6 0.8 1 0

2 4 6 8 10

φ(j) =X

n

X

i

qif(αkxij+Lnk) kxij+Lnk

| {z }

Fourier space

+X

n

X

i

qi

1−f(αkxij+Lnk) kxij+Lnk

| {z }

direct via truncation kxij+Lnk ≤rcut

(36)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Ewald summation

φ(j) =X

n

X

i

qi

kxij+Lnk

Idea: Split kernel function into two parts[Ewald 1921]

1

r = f(αr) r

| {z } long ranged, continuous

+ 1−f(αr) r

| {z } short ranged, singularity

0 0.2 0.4 0.6 0.8 1 0

2 4 6 8 10

φ(j) =X

n

X

i

qif(αkxij+Lnk) kxij+Lnk

| {z }

Fourier space

+X

n

X

i

qi

1−f(αkxij+Lnk) kxij+Lnk

| {z }

direct via truncation kxij+Lnk ≤rcut

(37)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Ewald summation

φ(j) =X

n

X

i

qi

kxij+Lnk

Idea: Split kernel function into two parts[Ewald 1921]

1

r = f(αr) r

| {z } long ranged, continuous

+ 1−f(αr) r

| {z } short ranged, singularity

0 0.2 0.4 0.6 0.8 1 0

2 4 6 8 10

φ(j) =X

n

X

i

qif(αkxij+Lnk) kxij+Lnk

| {z }

Fourier space

+X

n

X

i

qi

1−f(αkxij+Lnk) kxij+Lnk

| {z }

direct via truncation kxij+Lnk ≤rcut

(38)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Long range parts

Transformation into Fourier space yields[Ewald 1921]

φlong(j) = X

k∈Z3 N

X

i=1

qiψ(k)eˆ 2πik>xij/L.

Classical choice:f(αr) = erf(αr)

→ ψ(k) = (πL)ˆ −1kkk−2e−π2kkk2/(α2L2)

→ rapidly decreasing Fourier coefficients

→ good convergence, truncation of infinite sum

O(NlogN)Alg.P2NFFT [Pippig, Potts 2011]

φlong(j)≈ X

k∈IM

ψ(k)ˆ

N

X

i=1

qie2πik>xi/L

!

| {z }

adjoint NFFT

e−2πik>xj/L

| {z }

NFFT

.

Analogously: computeforcesF(j) =−qjxjφ(j) (qj·vector valued NFFT)

(39)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Long range parts

Transformation into Fourier space yields[Ewald 1921]

φlong(j) = X

k∈Z3 N

X

i=1

qiψ(k)eˆ 2πik>xij/L.

Classical choice:f(αr) = erf(αr)

→ ψ(k) = (πL)ˆ −1kkk−2e−π2kkk2/(α2L2)

→ rapidly decreasing Fourier coefficients

→ good convergence, truncation of infinite sum

O(NlogN)Alg.P2NFFT [Pippig, Potts 2011]

φlong(j)≈ X

k∈IM

ψ(k)ˆ

N

X

i=1

qie2πik>xi/L

!

| {z }

adjoint NFFT

e−2πik>xj/L

| {z }

NFFT

.

Analogously: computeforcesF(j) =−qjxjφ(j) (qj·vector valued NFFT)

(40)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Long range parts

Transformation into Fourier space yields[Ewald 1921]

φlong(j) = X

k∈Z3 N

X

i=1

qiψ(k)eˆ 2πik>xij/L.

Classical choice:f(αr) = erf(αr)

→ ψ(k) = (πL)ˆ −1kkk−2e−π2kkk2/(α2L2)

→ rapidly decreasing Fourier coefficients

→ good convergence,truncationof infinite sum O(NlogN)Alg.P2NFFT [Pippig, Potts 2011]

φlong(j)≈ X

k∈IM

ψ(k)ˆ

N

X

i=1

qie2πik>xi/L

!

| {z }

adjoint NFFT

e−2πik>xj/L

| {z }

NFFT

.

Analogously: computeforcesF(j) =−qjxjφ(j) (qj·vector valued NFFT)

(41)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Error analysis

In Applications: Interested in root mean square (rms) force error

∆F:=

v u u t 1 N

N

X

j=1

kF(j)−F(j)k2.

Two different types of errors:

1 Ewald truncation errors [Kolafa, Perram 1992]

→cutoff radiusrcut, splitting parameterα, cutoff parameterM(mesh size)

2 NFFT approximation errors (long range part)

→window functionϕ, support parameterm, oversampling factorσ, shape parameterb

∆FNFFT≈ v u u t 1 N

N

X

j=1

qj2 v u u u t

X

k∈IM

kkk2ψ(k)ˆ 2

 X

r∈Z3

c2k+rσM( ˜ϕ) c2k( ˜ϕ)

2

−1

k2(given analytically),error sums (as before, now 3d)

[Hockney, Eastwood 1988] [Pippig 2015] [N. 2016]

(42)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Error analysis

In Applications: Interested in root mean square (rms) force error

∆F:=

v u u t 1 N

N

X

j=1

kF(j)−F(j)k2.

Two different types of errors:

1 Ewald truncation errors [Kolafa, Perram 1992]

→cutoff radiusrcut, splitting parameterα, cutoff parameterM(mesh size)

2 NFFT approximation errors (long range part)

→window functionϕ, support parameterm, oversampling factorσ, shape parameterb

∆FNFFT≈ v u u t 1 N

N

X

j=1

qj2 v u u u t

X

k∈IM

kkk2ψ(k)ˆ 2

 X

r∈Z3

c2k+rσM( ˜ϕ) c2k( ˜ϕ)

2

−1

k2(given analytically),error sums (as before, now 3d)

[Hockney, Eastwood 1988] [Pippig 2015] [N. 2016]

(43)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Error analysis

In Applications: Interested in root mean square (rms) force error

∆F:=

v u u t 1 N

N

X

j=1

kF(j)−F(j)k2.

Two different types of errors:

1 Ewald truncation errors [Kolafa, Perram 1992]

→cutoff radiusrcut, splitting parameterα, cutoff parameterM(mesh size)

2 NFFT approximation errors (long range part)

→window functionϕ, support parameterm, oversampling factorσ, shape parameterb

∆FNFFT≈ v u u t 1 N

N

X

j=1

qj2 v u u u t

X

k∈IM

kkk2ψ(k)ˆ 2

 X

r∈Z3

c2k+rσM( ˜ϕ) c2k( ˜ϕ)

2

−1

k2(given analytically),error sums (as before, now 3d)

[Hockney, Eastwood 1988] [Pippig 2015] [N. 2016]

(44)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Parameter tuning approach

Accuracy tuning:

Input: Required level of accuracyε, near field cutoff radiusrcut.

1 Compute optimalαandMbased on

∆Fshort! ε and ∆Flong! ε.

2 Tune NFFT parameters: ∆FNFFT

! ε

For a set of possible support parametersmcompute the corresponding

required oversampling factorsσ,

optimal shape parametersb.

Output:α,Mand several combinations{m, σ, b}.

Runtime optimization:depending on implementation, software, hardware

{rcutmin,α,M} min

{m,σ,b}tmeasure

(45)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Parameter tuning approach

Accuracy tuning:

Input: Required level of accuracyε, near field cutoff radiusrcut.

1 Compute optimalαandMbased on

∆Fshort! ε and ∆Flong! ε.

2 Tune NFFT parameters: ∆FNFFT

! ε

For a set of possible support parametersmcompute the corresponding

required oversampling factorsσ,

optimal shape parametersb.

Output:α,Mand several combinations{m, σ, b}.

Runtime optimization:depending on implementation, software, hardware

{rcutmin,α,M} min

{m,σ,b}tmeasure

(46)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Parameter tuning approach

Accuracy tuning:

Input: Required level of accuracyε, near field cutoff radiusrcut.

1 Compute optimalαandMbased on

∆Fshort! ε and ∆Flong! ε.

2 Tune NFFT parameters: ∆FNFFT

! ε

For a set of possible support parametersmcompute the corresponding

required oversampling factorsσ,

optimal shape parametersb.

Output:α,Mand several combinations{m, σ, b}.

Runtime optimization:depending on implementation, software, hardware

{rcutmin,α,M} min

{m,σ,b}tmeasure

(47)

Parameter tuning for the nonuniform FFT and applications Application: interactions in particle systems

Results / examples

[N. 2016, 2018]

Spending some oversampling is oftentimes advantageous in terms of computational costs.

Bessel (with optimizedb) outperforms the B-spline window in most cases.

{rcutmin,α,M} min

{m,σ,b}tmeasure

B-spline

m σrequired runtime

3 1.72 0.125

4 1.23 0.077

5 1.08 0.069

6 1.02 0.074

7 1.00 0.079

Bessel

m σrequired runtime

3 1.28 0.074

4 1.00 0.056

5 1.00 0.062

6 1.00 0.069

7 1.00 0.078

Example:Possible combinations ofm,σand corresponding runtimes (for{rcut, α, M}andε= 10−5fixed).

min

{rcut,α,M} min

{m,σ,b}tmeasure

4 5 6 7

6·10−2 8·10−2 0.1

rcut

overallruntime

Example:Typical trend of runtime with respect to near field cutoffrcutfor fixedε(B-splinevs.Bessel).

Referenzen

ÄHNLICHE DOKUMENTE

For mixed periodic as well as open boundary conditions the Fourier coefficients are not known analytically, in contrast to the 3d-periodic case, and the contributions in the

At first, we must determine the appropriate Ewald splitting parameter α and a suitable grid size M. Therefore, we adopt the parameter tuning given in [35] such that it works with

Abstract—The efficient computation of interactions in charged particle systems is possible based on the well known Ewald summation formulas and the fast Fourier transform for

In the case of 3d-periodic boundary conditions the nonequispaced fast Fourier trans- form (NFFT) 30 can be directly applied to the Fourier space sum in order to achieve a

Abstract—Ewald summation has established as basic element of fast algorithms evaluating the Coulomb interaction energy of charged particle systems in three dimensions subject

NFFT based particle simulation for various types of periodic boundary conditions Introduction: What are we interested in?. Extension to systems with charges

Fast Ewald summation for electrostatic systems with charges and dipoles for various types of periodic boundary conditions.. Franziska Nestler Chemnitz University

Fast Ewald summation for charged particle systems Mixed periodic boundary conditions. Ewald summation with