QTPIE and water (Part 2)

Post on 27-Jan-2015

107 views 1 download

Tags:

description

Slides for group meeting presentation, Spring 2008.

Transcript of QTPIE and water (Part 2)

QTPIE and waterJiahao Chen2008-05-20

"We can't solve problems by using the same kind of thinking we used when we created them." - attributed to Albert Einstein

Since last time...

• QTPIE has become much faster

• We now know why dipole moments and polarizabilities previously weren’t translationally invariant, and why they aren’t size extensive.

• We have (some) parameters for a new water model

• We’ve shown that QTPIE gets the correct direction of intermolecular charge transfer

What is QTPIE: a scientific POV

• A way to model polarization and intermolecular charge transfer in molecular mechanics

• One of the simplest electronic structure methods, except without electrons

• Give me a geometry, and I will give you a charge distribution

• Give me a geometry, and I will give you a charge distribution

• Minimize the quadratic form

• subject to the constraint

What is QTPIE? A numerical POV

E(q1, . . . , qN ;R) =!

i

qivi(R) +12

!

ij

qiqjJij(R)

f : R =!

!R1, . . . , !RN

"! (q1, . . . , qN )

!

i

qi = 0

How to make QTPIE faster

• Using GTOs in place of STOs

• Integral prescreening

• Sparse matrix data structure for overlap matrix

• Conjugate gradients to solve linear problem (vs GMRES)

• Initial guess from previous solution

• Fast multipole methods (future work)

Optimizing GTOs for STOs

Unlike GTOs, STOs are really, really nasty to work with.

dK2

dR= !2m + 1

R2+

2m

RK2 +

(2!R)2m

(2m)!!2m (1 + 2m! 2!R) A2m!1 (2!R) + (1 + 2m) e!2!R

"

!"!2m+1R2m

2n (2m)!

2n!1#

"=0

2n! # ! 1#!

("R)"2m+"#

p=0

D2m!1,"+1p Bp (R (!! "))A2m+"!p (R (! + "))

+!2m+1R2m

2n (2m)!

2n#

"=0

2n! #

#!("R)"

2m!1+"#

p=0

D2m!1,"p "

[(!! ")Bp+1 (R (!! "))A2m+"!1!p (R (! + ")) + (! + ") Bp (R (!! "))A2m+"!p (R (! + "))]

K2 (!,", m, n, R) =1R

+(2!)2m R2m!1

(2m)!!(2!R! 2m) A2m!1 (2!R)! e!2!R

"

!!2m+1R2m

2n (2m)!

2n#

"=0

2n! #

#!("R)"

2m!1+"#

p=0

D2m!1,"p Bp (R (!! "))A2m+"!1!p (R (! + "))

An (!) =n!e!!

!n+1

n!

"=0

!"

"!

Bn (!) =n!e!!

!n+1

n!

"=0

(!!)" ! !"

"!

Dmnp =

!

k

(!1)k"

mp! k

# "nk

#

p =!

ab

a + bdK2

dR=

2p

R!

!e!p2R2

" erf (pR)R2

STO-nG orbitals were defined by fitting an orbital of n contracted Gaussian primitives to an STO to reproduce

the orbital in a least-squares sense. The conventional wisdom is n > 2 for some kind of useful, reasonable fit.

STO-1Gs suck when used in QEq/QTPIE.

However, there is a way to get accurate results with just primitive Gaussians...

Instead of maximizing overlap in a least-squares sense, minimize the deviation in the Coulomb integrals.

min!

!!JSTO ! JGTO (!)!!

! !

0

"JGTO (R;!)! JSTO (R)

# 1"!"

e"!R2= 0

which is minimized by the exponent such that

!JGTO " JSTO!22 =

!JGTO, JGTO

"" 2

!JGTO, JSTO

"+

!JSTO, JSTO

"

=!JGTO,

#JGTO " 2JSTO

$"+

!JSTO, JSTO

"

This is equivalent to minimizing

0 =!

!"

!JGTO (") ,

"JGTO (")! 2JSTO

#$

=%

!

!"JGTO (") ,

"JGTO (")! 2JSTO

#&+

%JGTO (") ,

!

!"JGTO (")

&

=%"

2JGTO (")! 2JSTO#,

!

!"JGTO (")

&

i.e.

Element Best Coulomb Least-squaresH 0.5343 0.3101Li 0.1668 0.0440C 0.2069 0.1853N 0.2214 0.2088O 0.2240 0.2400F 0.2312 0.2142

Na 0.0959 0.0399Si 0.1032 0.1256P 0.1085 0.1430S 0.1156 0.1584Cl 0.1137 0.1758K 0.0602 0.0361Br 0.0701 0.1850Rb 0.0420 0.0402I 0.0469 0.1735

Cs 0.0307 0.0374

Summary

• STOs are really, really nasty to work with

• GTOs fit to STOs by reproducing the Coulomb self-repulsion integrals yield excellent approximations

• Use in QEq and QTPIE result in very little error (< 0.00001e)

• There is very little basis to the claim that STOs can be used “for extra accuracy”

Sparse matrices in QTPIE

!

"1.0 0.4 0.00.4 1.0 0.00.0 0.0 1.0

#

$do i = 1, N do j = 1, N u(i) = M(i, j) * v(j) end doend do

1.0 0.4 0.0 0.4 1.0 0.0 0.0 0.0 1.0

In (linear) memory, matrix data structure looks like this:

Matrix-vector multiplication in computer memory

M(:)

k = 0do i = 1, N do j = 1, N k = k + 1 u(i) = M(k) * v(j) end doend do

1 2 1 2 31.0 0.4 0.4 1.0 1.0

1 3 5 6

columndata

row start

!

"1.0 0.4 0.00.4 1.0 0.00.0 0.0 1.0

#

$

k = 0do i = 1, N do j = 1, N k = k + 1 u(i) = M(k) * v(j) end doend do

do i = 1, N do k=M%r(i),M%r(i+1)-1 j = M%c(k) u(i) = M%d(k) * v(j) end doend do

Fewer operations and lower memory latency, so faster!

1.0 0.4 0.0 0.4 1.0 0.0 0.0 0.0 1.0

Compressed sparse row (CSR) data structure

Conventional matrix data structure

• In QTPIE, minimize

• The linear coefficients are given by

• The main costs are matrix-vector multiplication and memory latency

Calculating the linear coefficients in QTPIE

vi =!

j(!i ! !j)Sij!j! Sij!

E(q1, . . . , qN ;R) =!

i

qivi(R) +12

!

ij

qiqjJij(R)

Using conjugate gradients for

constrained problems

• In matrix notation,

• Solving QTPIE with a Lagrange multiplier,

• J is positive definite but this constrained problem is not (the constraint introduces a negative eigenvalue). Conjugate gradients can (and does) fail by going uphill, thinking it’s going downhill.

QTPIE is a saddle-point problem

!J 11T 0

" !qµ

"=

!!v0

"

minq: q·1=0

!qT v +

12qT Jq

"

However...

Solving the saddle-point problem

• There exists a block inversion formula1 for 2 x 2 structured matrices

• The analytic solution is given by

!J 11T 0

"!1

=!

J!1 + J!11S1T J!1 !J!11S!S1T J!1 S

"

1. e.g. P.-O. Löwdin, Linear algebra for quantum mechanics

!qµ

"=

!J 11T 0

"!1 !!v0

"=

!!J!1 (v ! µ1)#

1T J!1v$S

"

S = ! 11T J!11

Solving the saddle-point problem with CG

• Analytic solution can be solved numerically with two symmetric, positive definite problems (CG is guaranteed to work)

S = ! 11T J!11

!qµ

"=

!!J!1 (v ! µ1)#

1T J!1v$S

"

µ = !w · v

w · 1

Jw = 1

Jy = !v

q = y ! µw

II. Fixing the translational invariance of dipole moments and

polarizabilities

Dipoles and polarizabilities in QEq• The regular story: the charge model is

solved by

• The energy is therefore minimized by

• Want to calculate dipole moments and polarizabilities

q = !J!1v

E = !12vT J!1v

d! =!

i

!E

!Ri!!!" =

!

j

"d!

"Rj"

How to calculate dipoles and polarizabilities

• Dipole coupling prescription

• The external field shifts the voltages on each atom by an external potential

• Now calculate dipole moments and polarizabilities

E(q1, . . . , qN ;R,!") =!

i

qivi(R) +12

!

ij

qiqjJij(R)!!

i

qi!Ri · !"

E(q1, . . . , qN ;R,!") =!

i

qi

"vi(R)! !Ri · !"

#+

12

!

ij

qiqjJij(R)

d! =!E

!"!!!" =

"2E

"#!"#"

Physically, the universe is translationally invariant.Therefore, electrostatic properties (mostly) don’t

depend on the choice of origin.

!x !" !x + !"

!d !" !d + !"Q!!!" !" !!"

The solution in the literature is to fix an origin arbitrarily, even though nobody has a good physical

reason why that should be the “correct” origin

This is not the case in QEq!

!d !" !d + !"!1T J!1v

"

!!" !" !!" # 1T J!1 · ("!R" + R!"")# "!""1T J!11

As it turns out, QEq and other fluctuating charge models do obey the correct translational

properties, as long as one works with the correct solution of the constrained minimization

q != "J!1v

q = !J!1 (v ! µ1) = !J!1v ! J!111T J!11

The second term actually generates counterterms under translation that kill all the pathological terms.

!µ! = ! (Rµ)T J!1R! !!1T J!1Rµ

" !1T J!1R!

"

1T J!11

dµ = ! (Rµ)T J!1v !!1T J!1v + Q

" 1T J!1Rµ

1T J!11

The analytic solutions for the dipole moment and polarizability in QTPIE

are given by

dµ !" # (Rµ + !µ1)T J!1v

#!1T J!1v + Q

" 1T J!1

1T J!11(Rµ + !µ1)

= # (Rµ)T J!1v +!1T J!1v + Q

" 1T J!1Rµ

1T J!11

#!µ1T J!1v + !µ!1T J!1v + Q

" 1T J!111T J!11

= dµ # !µ1T J!1v + !µ!1T J!1v + Q

"

= dµ + !µQ

!µ! !" # (Rµ + "µ1)T J!1 (R! + "!1)

#!1T J!1 (Rµ + "µ1)

" !1T J!1 (R! + "!1)

"

1T J!11= # (Rµ)T J!1R! # "µ"!1T J!11

#"µ1T J!1R! # "! (Rµ)T J!11

#!1T J!1Rµ

" !1T J!1R!

"

1T J!11

#"µ"!

!1T J!11

" !1T J!11

"

1T J!11

#"µ

!1T J!11

" !1T J!1R!

"

1T J!11

#"!

!1T J!1Rµ

" !1T J!11

"

1T J!11= !µ!

III. Fixing the size extensivity of dipole

moments and polarizabilities

Not size extensive!

= 24

Why?

limn!"

!"#$n

2n! "# $

Work it out analytically for N identical, noninteracting subsystems...

Rµ =

!

"""#

R̄µ

R̄µ + !µ1...

R̄µ + (N ! 1) !µ1

$

%%%&=

!

"""#

R̄µ

R̄µ

...R̄µ

$

%%%&+ !µ

!

"""#

01...

(N ! 1)1

$

%%%&

J =

!

""""#

J̄ 0 · · · 0

0 J̄. . .

......

. . . . . ....

0 · · · · · · J̄

$

%%%%&v =

!

"""#

v̄v̄...v̄

$

%%%&

dµ = ! (Rµ)T J!1

!v ! 1

1T J!11"1T J!1v + Q

#$

= !

%

&&&'

R̄µ

R̄µ + !µ1...

R̄µ + (N ! 1) !µ1

(

)))*·

%

&&&'

%

&&&'

J̄!1v̄J̄!1v̄

...J̄!1v̄

(

)))*! N1T J̄!1v̄ + Q

N1T J̄!11

%

&&&'

J̄!11J̄!11

...J̄!11

(

)))*

(

)))*

= !N

!"R̄µ

#T J̄!1v̄ ! 1T J!1v̄ + Q/N

1T J!11"R̄µ

#T J̄!11$

!!µN!1+

n=0

n

!1T J̄!1v̄ ! 1T J!1v̄ + Q/N

1T J!111T J̄!11

$

= Nd̄µ ! (N ! 1) (N ! 2)2

!µ"1T J̄!1v̄ ! 1T J!1v̄ !Q/N

#

= Nd̄µ ! (N ! 1) (N ! 2) Q

2N!µ

!µ! = ! (Rµ)T J!1R! +!1T J!1Rµ

" !1T J!1R!

"

1T J!11

= !

#

$$$%

R̄µ

R̄µ + !µ1...

R̄µ + (N ! 1) !µ1

&

'''(

T#

$$$$%

J̄!1 0 · · · 0

0 J̄!1 . . ....

.... . . . . .

...0 · · · · · · J̄!1

&

''''(

#

$$$%

R̄!

R̄! + !!1...

R̄! + (N ! 1) !!1

&

'''(

+

#

$$$%

1T J̄!1R̄µ

1T J̄!1!R̄µ + !µ1

"

...1T J̄!1

!R̄µ + (N ! 1) !µ1

"

&

'''(

#

$$$%

1T J̄!1R̄!

1T J̄!1!R̄! + !!1

"

...1T J̄!1

!R̄! + (N ! 1) !!1

"

&

'''(

N1T J̄!11

= !N!1)

n=0

*!R̄µ

"T J̄!1R̄! + n!!!R̄µ

"T J̄!11 + n!µ1J̄!1R̄! + n2!µ!!1T J̄!11+

+

*,N!1n=0

!R̄µ

"T J̄!11 + n!µ1T J̄!11+ *,N!1

n!=0

!R̄!

"T J̄!11 + n"!!1T J̄!11+

N1T J̄!11

= !N!R̄µ

"T J̄!1R̄! ! (N ! 1) (N ! 2)2

!!!R̄µ

"T J̄!11

! (N ! 1) (N ! 2)2

!µ1J̄!1R̄! ! (N ! 1) (N ! 2) (2N ! 3)6

!µ!!1T J̄!11

+N

*!R̄µ

"T J̄!11+ *!

R̄!"T J̄!11

+

1T J̄!11+

(N ! 1)2 (N ! 2)2

N!µ!!

!1T J̄!11

"

+(N ! 1) (N ! 2)

2

*!R̄µ

"T J̄!11!! +!R̄!

"T J̄!11!µ+

= N !̄µ! !(N ! 1) (N ! 2)

6N

!N2 ! 3N ! 6

"!µ!!1T J̄!11

Dipole moments have the correct translational properties because the terms and counterterms

cancel perfectly.

The terms in the polarizabilities cancel only to second order; the cubic terms do not cancel

perfectly, giving rise to anomalous cubic scaling.

Modified dipole couplingIn QEq, the external field shifts the electronegativities on

each atom by an external potential

vi(R) = !i !" !i # "Ri · "#

E(q1, . . . , qN ;R) =!

i

qivi(R) +12

!

ij

qiqjJij(R)

E(q1, . . . , qN ;R,!") =!

i

qi

"vi(R)! !Ri · !"

#+

12

!

ij

qiqjJij(R)

Modified dipole couplingWe propose to apply the same coupling in QTPIE, which

shifts the atomic voltages in a less trivial manner

E(q1, . . . , qN ;R) =!

i

qivi(R) +12

!

ij

qiqjJij(R)

!i !" !i # "Ri · "#

vi =!

j(!i ! !j)Sij!j! Sij!

vi(R) !" vi(R,!") =!

j (#i # #j)Sij!j! Sij!

# !" ·

!j

"!Ri # !Rj

#Sij

!j! Sij!

With this coupling, the dipole moments and polarizabilities become

dµ =!

i

"k Sik (Rµ

i !Rµk )"

l Sil

#J!1v

$i

!

#1T J!1v

$%

"i!

#1T J!1

$i!

Pk! S

i!k!

“Rµ

i!!Rµ

k!

Pl! S

i!l!

&

1T J!11

!µ! = !!

ij

"k Sik (Rµ

i !Rµk )

#J!1

$ij

"l Sjl

#R!

j !R!l

$"

k! Sik!"

l! Sjl!

+

%"i

#1T J!1

$i

Pk Sik(Rµ

i !Rµk)P

l Sil

& %"i!

#1T J!1

$i!

Pk! Si!k!(R!

i!!R!k!)P

l! Si!l!

&

1T J!11

More importantly, these expressions are still translationally invariant, but are now size-extensive

!J!1

"ij

#

l

Sjl

!R!

j !R!l

"=

$

%%%%&

J̄!1 0 · · · 0

0 J̄!1 . . ....

.... . . . . .

...0 · · · · · · J̄!1

'

(((()

ij

#

l

$

%%%%&

S̄ 0 · · · 0

0 S̄. . .

......

. . . . . ....

0 · · · · · · S̄

'

(((()

jl

"

$

%%%&

$

%%%&

R̄!

R̄! + !!1...

R̄! + (N ! 1) !!1

'

((()

j

!

$

%%%&

R̄!

R̄! + !!1...

R̄! + (N ! 1) !!1

'

((()

l

'

((()

=!J̄!1

"ij

#

l

S̄jl

!R̄!

j ! R̄!l

"

The key difference is that the overlap matrix attenuates any contributions across subsystems to terms of this form

! = N !̄

! !" !dµ !" dµ

dµ = N !dµ

-2.5e+10

-2e+10

-1.5e+10

-1e+10

-5e+09

0

5e+09

0 500 1000 1500 2000 2500 3000

Pola

rizab

ility

(boh

r^3)

Number of atoms

Planar water chains with z-spacing 10.00 Angstroms

zz-polarizabilitylinear fit (gradient = -5773165.409344, intercept = 1434581215.053739)

-900

-800

-700

-600

-500

-400

-300

-200

-100

0

0 500 1000 1500 2000 2500 3000

Pola

rizab

ility

(boh

r^3)

Number of atoms

Planar water chains with z-spacing 10.00 Angstroms

zz-polarizabilitylinear fit (gradient = -0.325919, intercept = 0.007088)

IV. Parameters for water

Strategy

• Aim: reproduce ab initio data (LCCSD(T)/aug-cc-pVTZ) with three-site water model

• First determine QTPIE parameters (4) by fitting to dipole moments

• Then fit other parameters (10) to energies (up to constant)

21

3

4

5

6

E = EOHB (R12) + EOH

B (R13) + EOHB (R45) + EOH

B (R46)+EHOH

A (R12, R13, R23) + EHOHA (R45, R46, R56)

+EOOvdW (R14)

+EOHvdW (R15) + EOH

vdW (R16) + EOHvdW (R42) + EOH

vdW (R43)+EHH

vdW (R25) + EHHvdW (R26) + EHH

vdW (R35) + EHHvdW (R36)

+EQTPIE (R)

EOHB (r) = kOH

!r ! rOH

0

"2

EHOHA (!) = "OH

!! ! !HOH

0

"2

EABvdW (r) = !AB

!""AB

r

#12!

""AB

r

#6$

Geometries• 1,230 water monomer

geometries generated by directly varying internal coordinates

• 890 water dimer geometries generated by classical MD sampling (TINKER, flexible SPC water model, 1000K)

• O-O distance constrained by varying vdW radius of O

• 10 ps equilibration then 10 geometries at 1ps intervals

Fitting method

• Weighted least-squares fitting with Boltzmann weight (β = 100)

• Fitting done with Neader-Mead downhill simplex algorithm in scipy

import scipy.optimizez0 = (8.741, 13.364, 4.528, 13.890)zopt = scipy.optimize.fmin(f, z0)print "Optimal parameters = ", zopt

f(!) =!

i

e!!Ei!

""{x,y,z}

(dab initioi" ! dQTPIE

i" (!))2

Best-fit parameters

Par./eV QEq New

χ(H) 4.5280 5.6841

η(H) 13.8904 12.4166

χ(O) 8.741 7.9173

η(O) 13.364 13.1643

Dipoles correlation

ab initio

QTPIE

Dipole moment per water / D

Number of water molecules

yy-polarizability per water / ų

Number of water molecules

zz-polarizability per water / ų

Number of water molecules

That’s all, folks!