1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE 591-009 Prof. C. Heath Turner...

Post on 13-Dec-2015

213 views 0 download

Tags:

Transcript of 1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE 591-009 Prof. C. Heath Turner...

1

Statistical Mechanics and Multi-Scale Simulation Methods

ChBE 591-009

Prof. C. Heath Turner

Lecture 24

• Some materials adapted from Prof. Keith E. Gubbins: http://gubbins.ncsu.edu

• Some materials adapted from Prof. David Kofke: http://www.cbe.buffalo.edu/kofke.htm

2

Histogram Reweighting Method to combine results taken at different state conditions Microcanonical ensemble

Canonical ensemble

The big idea:• Combine simulation data at different temperatures to improve quality of all data via

their mutual relation to (E)

( , , ) 1microstates

E V N

1( , )N N Ee

Q r p Probability of a microstate

( ; ) ( )( )

EeE E

Q

Probability of an energy

Number of microstates having this energy

Probability of each microstate

3

In-class Problem 1. Consider three energy levels

What are Q, distribution of states and <E> at = 1?

0 0

1 1

2 2

1 0 ln1

100 2.3 ln10

1000 6.9 ln1000

E

E

E

4

In-class Problem 1A. Consider three energy levels

What are Q, distribution of states and <E> at = 1?

0 1 20 1 2

ln1 ln10 ln10001 100 1000

1 1 100 0.1 1000 0.001

12

E E EQ e e e

e e e

0

1

2

00

11

22

10.083

12

100.833

12

10.083

12

E

E

E

e

Q

e

Q

e

Q

0 0

1 1

2 2

1 0 ln1

100 2.3 ln10

1000 6.9 ln1000

E

E

E

3 07.3

9.633.0

3.233.0

033.0

ii EE

3

1

5

In-class Problem 1A. Consider three energy levels

What are Q, distribution of states and <E> at = 1?

And at = 3?

3

10 1 2

0 1 2

ln1 ln10 ln10001 100 1000

1 1 100 0.1 1000 0.001

12

E E EQ e e e

e e e

0

1

2

00

11

22

10.083

12

100.833

12

10.083

12

E

E

E

e

Q

e

Q

e

Q

0 0

1 1

2 2

1 0 ln1

100 2.3 ln10

1000 6.9 ln1000

E

E

E

3ln1 3ln10 3ln1000

3

1 100 1000

1 1 100 0.001 1000 1000

1.1

Q e e e

0

1

2

10.91

1.11

0.091.10.0

0.001.1

3

10 1 2

0 1 2

ln1 ln10 ln10001 100 1000

1 1 100 0.1 1000 0.001

12

E E EQ e e e

e e e

0

1

2

00

11

22

10.083

12

100.833

12

10.083

12

E

E

E

e

Q

e

Q

e

Q

3

07.3

9.633.0

3.233.0

033.0

ii EE

1.01

1.01

1.01

1.01

0.99

0.01

023.0

9.60.0

3.201.0

099.0

ii EE

3

1

6

Histogram Reweighting Approach Knowledge of (E) can be used to obtain averages at any temperature

Simulations at different temperatures probe different parts of (E) But simulations at each temperature provides information over a range of

values of (E) Combine simulation data taken at different temperatures to obtain better

information for each temperature

E

(E)1 2 3

7

In-class Problem 2. Consider simulation data from a system having three energy

levels• M = 100 samples taken at = 0.5

• mi times observed in level i

What is (E)?

0 0

1 1

2 2

4 0 ln1

46 2.3 ln100

50 9.2 ln10000

m E

m E

m E

8

In-class Problem 2. Consider simulation data from a system having three energy

levels• M = 100 samples taken at = 0.5

• mi times observed in level i

What is (E)?

0 0

1 1

2 2

4 0 ln1

46 2.3 ln100

50 9.2 ln10000

m E

m E

m E

( ) ( )( )

EeE E

Q

Reminder

9

In-class Problem 2. Consider simulation data from a system having three energy

levels• M = 100 samples taken at = 0.5

• mi times observed in level i

What is (E)?

0 0

1 1

2 2

4 0 ln1

46 2.3 ln100

50 9.2 ln10000

m E

m E

m E

( )( )

( )EE

E eQ

HintCan get only relative values!

10

In-class Problem 2A. Consider simulation data from a system having three energy

levels• M = 100 samples taken at = 0.5

• mi times observed in level i

What is (E)?

0 0

1 1

2 2

4 0 ln1

46 2.3 ln100

50 9.2 ln10000

m E

m E

m E

0 0

1 1

2 2

0.50

0.51

0.52

0.04 1 .04

0.46 100 4.6

0.50 10000 50

m UA AM

m UA AM

m UA AM

e Q Q Q

e Q Q Q

e Q Q Q

( 0.5)AQ Q

11

In-class Problem 3. Consider simulation data from a system having three energy

levels• M = 100 samples taken at = 0.5

• mi times observed in level i

What is (E)?

Here’s some more data, taken at = 1• what is (E)?

0 0

1 1

2 2

4 0 ln1

46 2.3 ln100

50 9.2 ln10000

m E

m E

m E

( 0.5)AQ Q

0 1 250 48 2m m m

0 0

1 1

2 2

0.50

0.51

0.52

0.04 1 .04

0.46 100 4.6

0.50 10000 50

m UA A AM

m UA A AM

m UA A AM

e Q Q Q

e Q Q Q

e Q Q Q

12

In-class Problem 3. Consider simulation data from a system having three energy

levels• M = 100 samples taken at = 0.5

• mi times observed in level i

What is (E)?

Here’s some more data, taken at = 1• what is (E)?

0 0

1 1

2 2

4 0 ln1

46 2.3 ln100

50 9.2 ln10000

m E

m E

m E

0 0

1 1

2 2

0.50

0.51

0.52

0.04 1 .04

0.46 100 4.6

0.50 10000 50

m UA A AM

m UA A AM

m UA A AM

e Q Q Q

e Q Q Q

e Q Q Q

( 0.5)AQ Q

0 1 250 48 2m m m

0

1

2

0.50 1 .50

0.48 100 48

0.02 10000 200

B B

B B

B B

Q Q

Q Q

Q Q

( 1.0)BQ Q

13

Reconciling the Data

We have two data sets

Questions of interest• what is the ratio QA/QB? (which then gives us A)

• what is the best value of 1/0, 2/0?

• what is the average energy at = 2?

In-class Problem 4• make an attempt to answer these questions

0

1

2

.04

4.6

50

A

A

A

Q

Q

Q

0

1

2

.50

48

200

B

B

B

Q

Q

Q

14

In-class Problem 4A. We have two data sets

What is the ratio QA/QB? (which then gives us A)

• Consider values from each energy level

What is the best value of 1/0, 2/0?

• Consider values from each temperature

What to do?

0

1

2

.04

4.6

50

A

A

A

Q

Q

Q

0

1

2

.50

48

200

B

B

B

Q

Q

Q

0 1 2

0 1 2

0.04 4.6 500.50 48 200

0.50 48 2000.04 4.6 50

12.5 10.4 4

A A A

B B B

A A A

B B B

Q Q QQ Q Q

Q Q QQ Q Q

1 2

0 0

1 2

0 0

4.6 500.04 0.04

48 2000.05 0.5

0.5 115 1250

1 96 400

A A

A A

B B

B B

Q QQ Q

Q QQ Q

15

Accounting for Data Quality

Remember the number of samples that went into each value

• We expect the A-state data to be good for levels 1 and 2

• …while the B-state data are good for levels 0 and 1

Write each as an average of all values, weighted by quality of result

0

1

2

0

1

2

.04

4.6

5

6

00

4

4

5

A

A

A

m

m

m

Q

Q

Q

0

2

0

1

2

1

.50

48

20

50

48

20

B

B

B

m

m

Q

Q

Q m

0, 0,0 0

0 0, 0,

A BA B

A B

est est estA A B B

m mU UA A B BM M

w w

w e Q w e Q

( ) ( )( )

EeE E

Q

16

Histogram Variance

Estimate confidence in each simulation result

Assume each histogram follows a Poisson distribution• probability P to observe any given instance of distribution

• the variance for each bin is

0

1

2

0

1

2

.04

4.6

5

6

00

4

4

5

A

A

A

m

m

m

Q

Q

Q

0

2

0

1

2

1

.50

48

20

50

48

20

B

B

B

m

m

Q

Q

Q m

31 21 2 3

1 2 31 2 3

[{ }] !!

[{ , , }] !! ! !

imi

ii

mm m

P m Mm

P m m m Mm m m

u1 u2 u3

piInstance

2im i im M

17

Variance in Estimate of Formula for estimate of

Variance

0, 0,0 00

A BA B

A B

m mE EestA A B BM M

w e Q w e Q

0 02 20, 0,0

0 02 2

0 00 00 0

0 0

2 22 2 2 2 2 2 21 1

2 22 2 2 21 10, 0,

2 22 2 2 21 1

2 21 10 0

A Best A B

A B

A B

A B

E EA BA B

A A B B

A B

A B

E EA A m B B mM M

E EA A A A B B B BM M

e eE EA A B BM Q M Q

E EA A B BM M

w e Q w e Q

w e Q M w e Q M

w e Q w e Q

w e Q w e Q

( ) ( )( )

EeE E

Q

18

Optimizing Weights Variance

Minimize with respect to weight, subject to normalization• In-class Problem 5

Do it!

0 0

0

2 2 21 10 0

A Best

A B

E EA A B BM M

w e Q w e Q

19

Optimizing Weights Variance

Minimize with respect to weight, subject to normalization• Lagrange multiplier

Equation for each weight is Rearrange

Normalize

0

2 1est aMin w

002 aa

a

QEa M

w e

( ) ( )( )

Eie m

E EQ M

0

0

12

Eaa

a

e Ma Q

w

0

0 0

/Eaa a

E EA Be M e MA BQ QA B

e M Qaw

0 0

0

2 2 21 10 0

A Best

A B

E EA A B BM M

w e Q w e Q

20

Optimal Estimate

Collect results

Combine

0

0 0

/Eaa a

E EA Be M e MA BQ QA B

e M Qaw

0, 0,0 00

A BA B

A B

m mE EestA A B BM M

w e Q w e Q

0 0 0 00, 0,0 0

0 0

1

0

1

0, 0,

E E E EA B A BA BA B A BA B

A B A A B B

E EA BA B

A B

m me M e M e M e ME EestA BQ Q Q M Q M

e M e MA BQ Q

e Q e Q

m m

21

Calculating Formula for

In-class Problem 6• explain why this formula cannot yet be used

0 01

0 0, 0,

E EA BA B

A B

e M e MestA BQ Q

m m

22

Calculating Formula for

We do not know the Q partition functions

One equation for each Each equation depends on all Requires iterative solution

0 01

0 0, 0,

E EA BA B

A B

e M e MestA BQ Q

m m

0 1 20 1 2

a a aE E EaQ e e e

0 0

0 01 2 1 20 1 2 0 1 2

1

0 0, 0,

E EA BA B

E EE E E EA BA A B B

e M e MestA B

e e e e e em m

23

In-class Problem 7 Write the equations for each using the example values

0 0

0 01 2 1 20 1 2 0 1 2

1

0 0, 0,

E EA BA B

E EE E E EA BA A B B

e M e MestA B

e e e e e em m

0

1

2

0.5

4

46

50

m

m

m

0

1

2

0 ln1

2.3 ln100

9.2 ln10000

E

E

E

0

1

2

1

50

48

2

m

m

m

100A BM M

24

In-class Problem 7 Write the equations for each using the example values

Solution

0

1

2

0.5

4

46

50

m

m

m

0

1

2

0 ln1

2.3 ln100

9.2 ln10000

E

E

E

0

1

2

1

50

48

2

m

m

m

100A BM M

0 1 2 0 1 2

10.1 100 0.01 100

1 1 0.1 0.01 1 0.01 0.000146 48est

0 1 2 0 1 2

11 100 1 100

0 1 0.1 0.01 1 0.01 0.00014 50est

0 1 2 0 1 2

10.01 100 0.0001 100

2 1 0.1 0.01 1 0.01 0.000150 2est

1 2

0 094.7 943.2

0 0

0 01 2 1 20 1 2 0 1 2

1

0 0, 0,

E EA BA B

E EE E E EA BA A B B

e M e MestA B

e e e e e em m

25

In-class Problem 7A. Solution

Compare

“Exact” solution

Free energy difference

1 2

0 094.7 943.2

1 2

0 0

1 2

0 0

4.6 500.04 0.04

48 2000.05 0.5

0.5 115 1250

1 96 400

A A

A A

B B

B B

Q QQ Q

Q QQ Q

0

1

2

0.5

4

46

50

m

m

m

0

1

2

1

50

48

2

m

m

m

1 2

0 0100 1000

0 1 2

0 1 2

1 0.1 0.019.74

1 0.01 0.0001A

B

Q

Q

“Design value” = 10

(?)

26

Extensions of Technique

Method is usually used in multidimensional form Useful to apply to grand-canonical ensemble

Can then be used to relate simulation data at different temperature and chemical potential

Many other variations are possible

31

!

( , , )

NN N N E

h NN

N E

N U

e d d e

U V N e e

r p