A Computational Viewpoint on Classical Density Functional Theory

advertisement
A Computational Viewpoint on Classical Density
Functional Theory
Matthew Knepley
Computation Institute
University of Chicago
Numerical Analysis Seminar
Texas A&M University
College Station, TX December 3, 2014
M. Knepley (UC)
DFT
TAMU
1 / 36
Collaborators
BIBEE
Researchers
Jaydeep Bardhan
Classical DFT
Researchers
Dirk Gillespie
M. Knepley (UC)
DFT
Bob Eisenberg
TAMU
3 / 36
Biological Ion Channels
Ion channels, such as the
ryanodine receptor, control the flow
of ions across membranes. The
competition between energetic and
entropic effects determines ion
selectivity.
Classical DFT combined with
advanced electrostatics has
allowed prediction of I-V curves for
100+ solutions, including
polyvalent species.
The implementation is detailed in An Efficient Algorithm for Classical Density
Functional Theory in Three Dimensions: Ionic Solutions, JCP, 2012.
M. Knepley (UC)
DFT
TAMU
4 / 36
Biological Ion Channels
Ion channels, such as the
ryanodine receptor, control the flow
of ions across membranes. The
competition between energetic and
entropic effects determines ion
selectivity.
Classical DFT combined with
advanced electrostatics has
allowed prediction of I-V curves for
100+ solutions, including
polyvalent species.
The implementation is detailed in An Efficient Algorithm for Classical Density
Functional Theory in Three Dimensions: Ionic Solutions, JCP, 2012.
M. Knepley (UC)
DFT
TAMU
4 / 36
Biological Ion Channels
Ion channels, such as the
ryanodine receptor, control the flow
of ions across membranes. The
competition between energetic and
entropic effects determines ion
selectivity.
Classical DFT combined with
advanced electrostatics has
allowed prediction of I-V curves for
100+ solutions, including
polyvalent species.
The implementation is detailed in An Efficient Algorithm for Classical Density
Functional Theory in Three Dimensions: Ionic Solutions, JCP, 2012.
M. Knepley (UC)
DFT
TAMU
4 / 36
CDFT Intro
Outline
1
CDFT Intro
2
Model
3
Verification
M. Knepley (UC)
DFT
TAMU
5 / 36
CDFT Intro
What is CDFT?
A fast, accurate theoretical tool
to understand the fundamental
physics of inhomogeneous fluids
M. Knepley (UC)
DFT
TAMU
6 / 36
CDFT Intro
What is CDFT?
For concentration ρi (~x ) of species i,
solve
min Ω[{ρi (~x )}]
ρi (~x )
where Ω is the free energy.
Thermal Properties of the Inhomogeneous Electron Gas,
N. David Mermin, Phys. Rev., 1965
M. Knepley (UC)
DFT
TAMU
6 / 36
CDFT Intro
What is CDFT?
For concentration ρi (~x ) of species i,
solve
δΩ
=0
δρi (~x )
which are the Euler-Lagrange
equations.
M. Knepley (UC)
DFT
TAMU
6 / 36
CDFT Intro
What is CDFT?
DFT
Computes ensemble-averaged quantities directly
Can have physical resolution in time (µs) and space (Å)
Requires an accurate Ω
Requires sophisticated solver technology
Can predict experimental results!
For example,
D. Gillespie, L. Xu, Y. Wang, and G. Meissner,
J. Phys. Chem. B 109, 15598, 2005
M. Knepley (UC)
DFT
TAMU
6 / 36
Model
Outline
1
CDFT Intro
2
Model
Hard Sphere Repulsion
Bulk Fluid Electrostatics
Reference Fluid Density Electrostatics
3
Verification
M. Knepley (UC)
DFT
TAMU
7 / 36
Model
Equilibrium
In equilibrium, the Euler-Lagrange equations reduce to,
∇µi = 0
M. Knepley (UC)
DFT
TAMU
8 / 36
Model
Equilibrium
or equivalently,
µi = µbath
.
i
M. Knepley (UC)
DFT
TAMU
8 / 36
Model
Equilibrium
We can divide the chemical potential into parts,
ideal
bath
µext
+ µex
i + µi
i = µi
M. Knepley (UC)
DFT
TAMU
8 / 36
Model
Equilibrium
We can divide the chemical potential into parts,
ex
bath
µext
i + kT log ρi + µi = µi
M. Knepley (UC)
DFT
TAMU
8 / 36
Model
Equilibrium
which, upon rearrangement, gives
bath
µi − µext
(~x ) − µex
(~x )
i
i
ρi (~x ) = exp
kT
where
HS ~
ES ~
~
µex
i (x ) = µi (x ) + µi (x )
SC ~
~
~
= µHS
i (x ) + µi (x ) + zi eφ(x )
and
−∆φ(~x ) = e
X
ρi (~x )
i
M. Knepley (UC)
DFT
TAMU
8 / 36
Model
Details
The theory and implementation are detailed in
Knepley, Karpeev, Davidovits, Eisenberg, Gillespie,
An Efficient Algorithm for Classical Density Functional
Theory in Three Dimensions: Ionic Solutions,
JCP, 2012.
M. Knepley (UC)
DFT
TAMU
9 / 36
Model
Hard Sphere Repulsion
Outline
2
Model
Hard Sphere Repulsion
Bulk Fluid Electrostatics
Reference Fluid Density Electrostatics
M. Knepley (UC)
DFT
TAMU
10 / 36
Model
Hard Sphere Repulsion
Hard Spheres (Rosenfeld)
~
µHS
i (x )
X Z ∂ΦHS
= kT
(nα (~x 0 ))ωiα (~x − ~x 0 ) d 3 x 0
∂n
α
α
where
n1 n2 − ~nV 1 · ~nV 2
1 − n3
!3
~nV 2 · ~nV 2
1−
n22
ΦHS (nα (~x 0 )) = −n0 ln(1 − n3 ) +
+
M. Knepley (UC)
n23
24π(1 − n3 )2
DFT
TAMU
11 / 36
Model
Hard Sphere Repulsion
Hard Sphere Basis
nα (~x ) =
XZ
ρi (~x 0 )ωiα (~x − ~x 0 ) d 3 x 0
i
where
ωi0 (~r ) =
ωi2 (~r )
4πRi2
ωi1 (~r ) =
ωi2 (~r ) = δ(|~r | − Ri )
ω
~ iV 1 (~r ) =
M. Knepley (UC)
ωi2 (~r )
4πRi
ωi3 (~r ) = θ(|~r | − Ri )
ω
~ iV 2 (~r )
4πRi
ω
~ iV 2 (~r ) =
DFT
~r
δ(|~r | − Ri )
~
|r |
TAMU
12 / 36
Model
Hard Sphere Repulsion
Hard Sphere Basis
All nα integrals may be cast as convolutions:
XZ
~
ρi (~x 0 )ωiα (~x 0 − ~x )d 3 x 0
nα (x ) =
i
=
X
=
X
F −1 (F (ρi ) · F (ωiα ))
i
F −1 ρ̂i · ωˆiα
i
and similarly
~
µHS
i (x ) = kT
X
F −1
α
M. Knepley (UC)
DFT
∂ΦˆHS ˆα
· ωi
∂nα
!
TAMU
13 / 36
Model
Hard Sphere Repulsion
Hard Sphere Basis
Spectral Quadrature
There is a fly in the ointment:
standard quadrature for ω α is very inaccurate (O(1) errors),
and destroys conservation properties, e.g. total mass
We can use spectral quadrature for accurate evaluation,
combining FFT of density, ρ̂i ,
with analytic FT of weight functions.
M. Knepley (UC)
DFT
TAMU
14 / 36
Model
Hard Sphere Repulsion
Hard Sphere Basis
Spectral Quadrature
There is a fly in the ointment:
standard quadrature for ω α is very inaccurate (O(1) errors),
and destroys conservation properties, e.g. total mass
We can use spectral quadrature for accurate evaluation,
combining FFT of density, ρ̂i ,
with analytic FT of weight functions.
M. Knepley (UC)
DFT
TAMU
14 / 36
Model
Hard Sphere Repulsion
Hard Sphere Basis
Spectral Quadrature
ω̂i0 (~k ) =
ω̂i2 (~k )
4πRi2
4πRi sin(Ri |~k |)
ω̂i2 (~k ) =
|~k |
ω̂ V 2 (~k )
ω̂iV 1 (~k ) = i
4πRi
M. Knepley (UC)
ω̂i2 (~k )
4πRi
4π sin(Ri |~k |) − Ri |~k | cos(Ri |~k |)
ω̂i3 (~k ) =
|~k |3
−4πı ω̂iV 2 (~k ) =
sin(Ri |~k |) − Ri |~k | cos(Ri |~k |)
|~k |2
ω̂i1 (~k ) =
DFT
TAMU
15 / 36
Model
Hard Sphere Repulsion
Hard Sphere Basis
Numerical Stability
Recall that
n23
ΦHS (nα (~x 0 )) = . . . +
24π(1 − n3 )2
~nV 2 · ~nV 2
1−
n22
!3
and note that we have analytically
V 2 2
n (x)
≤ 1.
n2 (x)2
However, discretization errors in ρi near sharp geometric features can
produce large values for this term, which prevent convergence of the
nonlinear solver. Thus we explicitly enforce this bound.
M. Knepley (UC)
DFT
TAMU
16 / 36
Model
Bulk Fluid Electrostatics
Outline
2
Model
Hard Sphere Repulsion
Bulk Fluid Electrostatics
Reference Fluid Density Electrostatics
M. Knepley (UC)
DFT
TAMU
17 / 36
Model
Bulk Fluid Electrostatics
Bulk Fluid (BF) Electrostatics
µSC
i
=
µiES,bath
−
XZ
j
|~x −~x 0 |≤Rij
(2)
cij (~x , ~x 0 ) + ψij (~x , ~x 0 ) ∆ρj (~x 0 ) d 3 x 0
1
Using λk = Rk + 2Γ
, where Γ is the MSA screening parameter, we have
(2)
cij
z z e2
~x , ~x 0 + ψij ~x , ~x 0 = i j
8π
M. Knepley (UC)
DFT
|~x − ~x 0 | λi + λj
−
+
2λi λj
λi λj
!!
2
λi − λj
1
+2
2λi λj
|~x − ~x 0 |
TAMU
18 / 36
Model
Bulk Fluid Electrostatics
Bulk Fluid (BF) Electrostatics
µSC
i
=
µiES,bath
−
XZ
j
|~x −~x 0 |≤Rij
(2)
cij (~x , ~x 0 ) + ψij (~x , ~x 0 ) ∆ρj (~x 0 ) d 3 x 0
It’s a convolution too!
M. Knepley (UC)
DFT
TAMU
18 / 36
Model
Bulk Fluid Electrostatics
Bulk Fluid (BF) Electrostatics
µSC
i
=
µiES,bath
−
XZ
j
|~x −~x 0 |≤Rij
(2)
cij (~x , ~x 0 ) + ψij (~x , ~x 0 ) ∆ρj (~x 0 ) d 3 x 0
F ∆ρj = F ρj − ρbath = F ρj − F (ρbath )
F ρj was already calculated
F (ρbath ) is constant
(2)
F cij ~x , ~x 0 + ψij ~x , ~x 0 is constant
so we only calculate the inverse transform on each iteration.
M. Knepley (UC)
DFT
TAMU
18 / 36
Model
Bulk Fluid Electrostatics
Bulk Fluid (BF) Electrostatics
µSC
i
=
µiES,bath
−
XZ
j
|~x −~x 0 |≤Rij
(2)
cij (~x , ~x 0 ) + ψij (~x , ~x 0 ) ∆ρj (~x 0 ) d 3 x 0
FFT is also inaccurate!
M. Knepley (UC)
DFT
TAMU
18 / 36
Model
Bulk Fluid Electrostatics
Bulk Fluid (BF) Electrostatics
µSC
i
=
µiES,bath
−
XZ
j
(2)
ĉij
zi zj e2
+ ψ̂ij =
|~k |
|~x −~x 0 |≤Rij
(2)
cij (~x , ~x 0 ) + ψij (~x , ~x 0 ) ∆ρj (~x 0 ) d 3 x 0
λi + λj
1
I1 −
I0 +
2λi λj
λi λj
λi − λj
2λi λj
2
!
!
+ 2 I−1
where
I−1 =
1 1 − cos(|~k |R)
|~k |
R
1
cos(|~k |R) +
sin(|~k |R)
~
~
|k |
|k |2
R2
R
2 I1 = −
cos(|~k |R) + 2
sin(|~k |R) −
1 − cos(|~k |R)
|~k |
|~k |2
|~k |3
I0 = −
M. Knepley (UC)
DFT
TAMU
18 / 36
Model
Reference Fluid Density Electrostatics
Outline
2
Model
Hard Sphere Repulsion
Bulk Fluid Electrostatics
Reference Fluid Density Electrostatics
M. Knepley (UC)
DFT
TAMU
19 / 36
Model
Reference Fluid Density Electrostatics
Reference Fluid Density (RFD) Electrostatics
~x , an inhomogeneous reference density profile:
Expand around ρref
i
µSC
i
ref ≈ µSC
ρk ~y
ρk ~y
i
X Z (1) ~y ; ~x ∆ρi ~x d 3 x
− kT
ci
ρref
k
i
ZZ
kT X
(2) ref
−
cij
ρk ~y ; ~x , ~x 0 ∆ρi ~x ∆ρj ~x 0 d 3 x d 3 x 0
2
i,j
with
~x
∆ρi ~x = ρi ~x − ρref
i
M. Knepley (UC)
DFT
TAMU
20 / 36
Model
Reference Fluid Density Electrostatics
Reference Fluid Density (RFD) Electrostatics
ρref
i
ρk ~x 0
; ~x =
Z
3
3
~x
4πRSC
|~x 0 −~x |≤RSC (~x )
αi ~x 0 ρi ~x 0 d 3 x 0
Choose αi so that the reference density is
charge neutral, and
has the same ionic strength as ρi
This can model gradient flow
M. Knepley (UC)
DFT
TAMU
21 / 36
Model
Reference Fluid Density Electrostatics
Reference Fluid Density (RFD) Electrostatics
ρref
i
ρk ~x 0
; ~x =
Z
3
3
~x
4πRSC
|~x 0 −~x |≤RSC (~x )
αi ~x 0 ρi ~x 0 d 3 x 0
Choose αi so that the reference density is
charge neutral, and
has the same ionic strength as ρi
This can model gradient flow
M. Knepley (UC)
DFT
TAMU
21 / 36
Model
Reference Fluid Density Electrostatics
Reference Fluid Density (RFD) Electrostatics
ρref
i
ρk ~x 0
; ~x =
Z
3
3
~x
4πRSC
|~x 0 −~x |≤RSC (~x )
αi ~x 0 ρi ~x 0 d 3 x 0
Choose αi so that the reference density is
charge neutral, and
has the same ionic strength as ρi
This can model gradient flow
M. Knepley (UC)
DFT
TAMU
21 / 36
Model
Reference Fluid Density Electrostatics
Reference Fluid Density (RFD) Electrostatics
We can rewrite this expression as an averaging operation:
Z
θ |~x 0 − ~x | − RSC (~x )
ref ~
0
ρ (x ) = ρ(~x )
dx 0
4π 3 ~
R
x
)
(
3 SC
where
P
ρ̃i (~x )Ri
1
+
RSC (~x ) = Pi
~
~x )
ρ̃
(
x
)
2Γ(
i i
We close the system using
ΓSC [ρ] (~x ) = ΓMSA ρref (ρ) (~x ).
M. Knepley (UC)
DFT
TAMU
22 / 36
Model
Reference Fluid Density Electrostatics
Reference Fluid Density (RFD) Electrostatics
We can rewrite this expression as an averaging operation:
Z
θ |~x 0 − ~x | − RSC (~x )
ref ~
0
ρ (x ) = ρ(~x )
dx 0
4π 3 ~
R
x
)
(
3 SC
where
P
ρ̃i (~x )Ri
1
+
RSC (~x ) = Pi
~
~x )
ρ̃
(
x
)
2Γ(
i i
We close the system using
ΓSC [ρ] (~x ) = ΓMSA ρref (ρ) (~x ).
M. Knepley (UC)
DFT
TAMU
22 / 36
Model
Reference Fluid Density Electrostatics
Reference Fluid Density (RFD) Electrostatics
Efficient Evaluation:
Full integral O(N 2 ) with vectorization
Accurate Evaluation of Local Averages on GPGPUs, Karpeev,
Knepley, Brune, LNESS, 2013
FFT + Interpolation
Fast Numerical Methods and Biological Problems, Brune, 2011
Complexity in
O(NR N log N)
using
NR ≤
log Rmax − log Rmin
q
log 1 + Rmax ||∇ρ||82 +10||ρ||2
where we have used Young’s inequality to produce the denominator
from the interpolation estimate.
M. Knepley (UC)
DFT
TAMU
23 / 36
Model
Reference Fluid Density Electrostatics
Reference Fluid Density (RFD) Electrostatics
Efficient Evaluation:
Full integral O(N 2 ) with vectorization
Accurate Evaluation of Local Averages on GPGPUs, Karpeev,
Knepley, Brune, LNESS, 2013
FFT + Interpolation
Fast Numerical Methods and Biological Problems, Brune, 2011
Complexity in
O(NR N log N)
using
NR ≤
log Rmax − log Rmin
q
log 1 + Rmax ||∇ρ||82 +10||ρ||2
where we have used Young’s inequality to produce the denominator
from the interpolation estimate.
M. Knepley (UC)
DFT
TAMU
23 / 36
Verification
Outline
1
CDFT Intro
2
Model
3
Verification
M. Knepley (UC)
DFT
TAMU
24 / 36
Verification
Consistency checks
Check nα of constant density against analytics
Check that n3 is the combined volume fraction
Check that wall solution has only 1D variation
M. Knepley (UC)
DFT
TAMU
25 / 36
Verification
Sum Rule Verification
Hard Spheres
HS
βPbath
=
X
ρi (Ri )
i
where
HS
Pbath
6kT
=
π
ξ0 3ξ1 ξ2 3ξ23
+
+ 3
∆
∆2
∆
!
using auxiliary variables
ξn =
π X bath n
ρj σj
6
n ∈ {0, . . . , 3}
j
∆ = 1 − ξ3
M. Knepley (UC)
DFT
TAMU
26 / 36
Verification
Sum Rule Verification
Hard Spheres
Relative accuracy and Simulation time for R = 0.1nm
M. Knepley (UC)
DFT
TAMU
27 / 36
Verification
Sum Rule Verification
Hard Spheres
Volume fraction ranges from 10−5 to 0.4 (very difficult for MC/MD)
M. Knepley (UC)
DFT
TAMU
27 / 36
Verification
Ionic Fluid Verification
Charged Hard Spheres
Rcation
Ranion
Concentration
Domain
Uncharged hard wall
Grid
M. Knepley (UC)
0.1nm
0.2125nm
1M
2 × 2 × 6 nm3 and periodic
z=0
21 × 21 × 161
DFT
TAMU
28 / 36
Verification
Ionic Fluid Verification
Charged Hard Spheres
Rcation
Ranion
Concentration
Domain
Uncharged hard wall
Grid
M. Knepley (UC)
0.1nm
0.2125nm
1M
2 × 2 × 6 nm3 and periodic
z=0
21 × 21 × 161
DFT
TAMU
28 / 36
Verification
Ionic Fluid Verification
Charged Hard Spheres
Cation Concentrations for 1M concentration
M. Knepley (UC)
DFT
TAMU
29 / 36
Verification
Ionic Fluid Verification
Charged Hard Spheres
Anion Concentrations for 1M concentration
M. Knepley (UC)
DFT
TAMU
30 / 36
Verification
Ionic Fluid Verification
Charged Hard Spheres
Mean Electrostatic Potential for 1M concentration
M. Knepley (UC)
DFT
TAMU
31 / 36
Verification
Ionic Fluid Verification
Charged Hard Spheres
These results were first reported in 1D in
Density functional theory of the electrical double
layer: the RFD functional,
J. Phys.: Condens. Matter 17, 6609, 2005.
M. Knepley (UC)
DFT
TAMU
32 / 36
Verification
Main Points
Real Space vs. Fourier Space
O(N 2 ) vs. O(N lg N)
Accurate quadrature only available in Fourier space
Electrostatics
Bulk Fluid (BF) model can be qualitatively wrong
Reference Fluid Density (RFD) model demands complex algorithm
Solver convergence
Picard was more robust
Newton rarely entered the quadratic regime
Still no multilevel alternative (interpolation?)
M. Knepley (UC)
DFT
TAMU
33 / 36
Verification
Main Points
Real Space vs. Fourier Space
O(N 2 ) vs. O(N lg N)
Accurate quadrature only available in Fourier space
Electrostatics
Bulk Fluid (BF) model can be qualitatively wrong
Reference Fluid Density (RFD) model demands complex algorithm
Solver convergence
Picard was more robust
Newton rarely entered the quadratic regime
Still no multilevel alternative (interpolation?)
M. Knepley (UC)
DFT
TAMU
33 / 36
Verification
Main Points
Real Space vs. Fourier Space
O(N 2 ) vs. O(N lg N)
Accurate quadrature only available in Fourier space
Electrostatics
Bulk Fluid (BF) model can be qualitatively wrong
Reference Fluid Density (RFD) model demands complex algorithm
Solver convergence
Picard was more robust
Newton rarely entered the quadratic regime
Still no multilevel alternative (interpolation?)
M. Knepley (UC)
DFT
TAMU
33 / 36
Verification
Conclusion
The theory and implementation are detailed in
An Efficient Algorithm for Classical Density Functional Theory in Three
Dimensions: Ionic Solutions, JCP, 2012.
M. Knepley (UC)
DFT
TAMU
34 / 36
Verification
Conclusion
The theory and implementation are detailed in
An Efficient Algorithm for Classical Density Functional Theory in Three
Dimensions: Ionic Solutions, JCP, 2012.
M. Knepley (UC)
DFT
TAMU
34 / 36
Verification
Hydrodynamics
Recall that for electrostatics, we have
XZ
(2)
ES,bath
SC
µi = µi
−
cij (~x , ~x 0 ) + ψij (~x , ~x 0 ) ∆ρj (~x 0 ) d 3 x 0
j
|~x −~x 0 |≤Rij
where
(2)
cij
z z e2
~x , ~x 0 + ψij ~x , ~x 0 = i j
8π
|~x − ~x 0 | λi + λj
−
+
2λi λj
λi λj
!!
2
λi − λj
1
+2
2λi λj
|~x − ~x 0 |
for the interaction kernel
1
|~x − ~x 0 |
M. Knepley (UC)
DFT
TAMU
35 / 36
Verification
Hydrodynamics
A similar expression for hydrodynamics would have the same form
XZ
(2)
HD,bath
HSC
µi
= µi
−
cij (~x , ~x 0 ) + ψij (~x , ~x 0 ) ∆ρj (~x 0 ) d 3 x 0
|~x −~x 0 |≤Rij
j
where now
(2)
cij
1 X Ck (~x , ~x 0 )
~x , ~x 0 + ψij ~x , ~x 0 =
8π
|~x − ~x 0 |k
k
for the interaction kernel
1
|~x − ~x 0 |
M. Knepley (UC)
1+
DFT
~x ~x 0
|~x − ~x 0 |2
TAMU
36 / 36
Download