Microscopic states (microstates) or microscopic configurations under external constraints (N or , V...
-
Upload
ethan-walters -
Category
Documents
-
view
217 -
download
0
Transcript of Microscopic states (microstates) or microscopic configurations under external constraints (N or , V...
microscopic states (microstates)or microscopic configurationsunder external
constraints (N or , V or P, T or E,
etc.) Ensemble (micro-canonical,
canonical, grand canonical, etc.)
Average over a collection
of microstates
Macroscopic quantities (properties, observables)• thermodynamic – or N, E or T, P or V, Cv, Cp, H, S,
G, etc.• structural – pair correlation function g(r), etc.• dynamical – diffusion, etc.
These are what are measured in true experiments.
they’re generated naturally from thermal fluctuation
In a real-space experiment
In a virtual-space simulation
How do we mimic the Mother Nature in a virtual space to realize lots of microstates, all of which correspond to
a given macroscopic state? By MC or MD method!
it is us who needs to generate them by MC or MD methods.
t1 t2 t3~1023
particles
Beyond 1D integrals: A system of N particles in a container
of a volume V in contact with a thermostat T (constant NVT)
(=1/kT) or for discrete microstates
for discrete microstates
• Particles interact with each other through a potential energy U(rN) (~ pair potential).
• U(rN) is the potential energy of a microstate {rN} = {x1, y1, z1, …, xN, yN, zN}.
• (rN) is the probability to find a microstate {rN} under the constant-NVT constraint.• Partition function Z (required for normalization) = the weighted sum of
all the microstates compatible with the constant-NVT condition
• Average of an observable O, <O>, over all the microstates compatible with constant NVT
or for discrete microstates
ensemble average
“canonical ensemble”
external constraint
3N-dimension integration
3N-dimension
• 1885 – Johann Balmer – Line spectrum of hydrogen
• 1886 – Heinrich Hertz – Photoelectric effect experiment
• 1897 – J. J. Thomson – Discovery of electrons from cathode rays experiment
• 1900 – Max Planck – Quantum theory of blackbody radiation
• 1905 – Albert Einstein– Quantum theory of photoelectric effect
• 1910 – Ernest Rutherford – Scattering experiment with -particles
• 1913 – Niels Bohr – Quantum theory of hydrogen spectra
• 1923 – Arthur Compton – Scattering experiment of photons off electrons
• 1924 – Wolfgang Pauli – Exclusion principle – Ch. 10
• 1924 – Louis de Broglie – Matter waves
• 1925 – Davisson and Germer – Diffraction experiment on wave properties of
electrons
• 1926 – Erwin Schrodinger – Wave equation – Ch. 2
• 1927 – Werner Heisenberg – Uncertainty principle – Ch. 6
• 1927 – Max Born – Interpretation of wave function – Ch. 3
Ludwig Boltzmann in the Maxwell-Boltzmann distribution
Boltzmann
a pioneer in atomic theory
was used in the derivation of
Can we use Monte Carlo to compute Z? (even for a very simple, minimum-size, discrete case)
• Consider a model of spins on a 2D lattice (idealized magnetic model). ⇒ a discrete system
• Each of N spins can take 2 states: up (↑) and down (↓). ⇒ 2N microstates
• Each spin interacts only with its nearest neighbors (nn). ⇒ 4 neighbors for a 2D square lattice
• Suppose that it takes 10-6 (or 10-15) s to compute the interaction of a spin with its neighbors. ⇒ Time to calculate the energy Ei of a microstate i = N x 10-6 (or N x 10-15) s
• For N = 100 spins:
- 2100 ~ 1030 microstates - 10-3 (or 10-12) s to calculate the energy of a microstate
⇒ 1027 (or 1018) s to estimate Z! (~ age of the universe ~ 13.8 billion years ~ 4 x 1017 s)
• The situation gets worse with a real (continuous, larger, with beyond-nn interaction) system!
a microstate
⇒ We cannot compute Z (and the absolute free energy kT ln Z) for real systems! (However, we can compute a relative free energy between two states.)
• What contributes to <O> the most? Instantaneous values {Oi} of microstates with high probability
(= with large Boltzmann weight = with low energy)
• We just showed that we cannot compute all the microstates.• Let’s take a subset, for example, 106 states for the spin system in the previous example.• How do we choose these states?
a) Brute force Monte Carlo (hit & miss, sample mean by uniform sampling)
Randomly pick a microstate i (i.e. the orientation of each spin). → Too high probability that the subset doesn’t contribute to the average → The situation is the worst for a continuous dense system!
b) Importance samplingPick a microstate i with high probability (i.e. large i). Sample according to i.
→ We need to use a normalized distribution {i}. → The normalization requires Z, and we showed that we cannot compute Z!
c) Metropolis importance samplingPick a microstate i with large i without calculating the normalization.
→ biased random walk in the phase space
Can we use Monte Carlo to compute <O>?
Hard sphere1/10260
Importance sampling for ensemble averages- Biased random walk
Frenkel and Smit, Understanding Molecular Simulations
quickdepth info: yesarea info: no
depth info: yesarea info: yesslow~impossible
Finished?
Yes
No
Give the particle a randomdisplacement. Calculate thenew energy. ')'( UrU
Accept the move with
'exp
1min)'(
UUrr
Select a particle at random.Calculate the energy. UrU )(
1
)(
tottot
tottot rAAA
Calculate the ensemble Average.
tot
totAA
Initialize the positions 0 ;0 tottotA
Biased random walk in configuration space:Metropolic Monte Carlo method
Kristen A. Fichthorn, Penn. State U.
Stochastic process is a movement through a series of well-defined microstates (or configurations or states in short) in a way that involves some element of randomness.
Markov process is a stochastic process that has no memory.Selection of next state depends only on the current state, not on prior states.A process is fully defined by a set of transition probabilities ij.
Transition probability (ij) or ij is the probability to go from the state i to j.- Non-negative, not greater than unity (0 1)- Probability of staying in present state may be non-zero.
Transition probability matrix collects all ij.
- sum of each row = 1- (example) system with three states
Markov process & Transition probability
11 12 13
21 22 23
31 32 33
0.1 0.5 0.4
0.9 0.1 0.0
0.3 0.3 0.4
If in state 1, it will move to state 3 with probability 0.4
If in state 1, it will stay in state 1 with probability 0.1.
It never go from state 2 to state 3.
),( trP
= Probability to be at state at time tr
= Transition probability per unit time from to'r
r
r
'r
The master equation for Markov processes
)'( rr
''
)'(),'()'(),(),(
rr
rrtrPrrtrPdt
trdP
)(),( rrtrP
)'(),( rrtrP
Detailed balance (or Microscopic reversibility) criterion at equilibrium: key of Metropolis
algorithm
)'(),'( );(),( rrPrrP
After a long time, the system reaches equilibrium. The transition probabilities should satisfy the condition that they do not destroy the equilibrium distribution once it is reached. Thus, at equilibrium, we have a stationary Markov provess:
)'()'()'()( rrrrrr
One way to satisfy this would be a (more stringent) detailed balance condition.
)(
)'(
)'(
)'(
r
r
rr
rr
''
)'(),'()'(),(0),(
rr
rrrPrrrPdt
rdP
''
)'()'()'()(rr
rrrrrr
StationaryMarkov:Average population does not change with time (i.e., MC steps).
Choices of Metropolis
)'()'()'( rraccrrrr
1. The transition probability can be divided into two parts:(1)Choosing a new configuration with a probability .(2)Accepting or rejecting this new configuration with an acceptance probability acc.
where = probability to choose a particular move, acc = probability to accept the move
N. Metropolis et al. J. Chem. Phys. 21, 1087 (1953)
Then, the detailed balance condition becomes:
)'()'()'()'()'()( rraccrrrrraccrrr
)(
)(
)(
)'(
)'(
)'(
rr
rr
r
r
rracc
rracc
Choices of Metropolis for canonical ensemblesN. Metropolis et al. J. Chem. Phys. 21, 1087 (1953)
1. Detailed balance condition
Z
errrP
Z
errrP
rU
NVT
rU
NVT
)()(
)'()(),'( ;)()(),(
)(
)(
)(
)'(
)'(
)'(
rr
rr
r
r
rracc
rracc
2.Symmetric :
3.Limiting probability distribution for canonical ensemble = Boltzmann
Transition probability & acceptance probability acc should satisfy:
4. Define the acceptance probability as:
Nrrrr /1)'()'(
UrUrU
rU
rU
eeZe
Ze
)()(
)(
)'(
/
/
)()'( i.e., ,0 if , 1
)()'( i.e., ,0 if , )()(
rUrUU
rUrUUee UrUrU
)(
)'(
)(
)'(
)(
)'(
r
r
rracc
rracc
rr
rr
NVT
NVT
)'( rracc
Accept all
the downhill moves.
Accept uphill moves only whennot too uphill.
naturally satisfies this condition.
Choice of Metropolis: Metropolis MC algorithmN. Metropolis et al. J. Chem. Phys. 21, 1087 (1953)
)'(exp1
1
min
if , )'(exp1
if , 1
)'(
UUN
N
UUUUN
rUUrUUNrr
Finished?
Yes
No
Give the particle a randomdisplacement. Calculate thenew energy. ')'( UrU
Accept the move with
'exp
1min)'(
UUrr
Select a particle at random.Calculate the energy. UrU )(
1
)(
tottot
tottot rAAA
Calculate the ensemble Average.
tot
totAA
Initialize the positions 0 ;0 tottotA
Biased random walk in configuration space:Metropolic Monte Carlo method
Kristen A. Fichthorn, Penn. State U.
Almost always involves a Markov processMove to a new configuration from an existing one according to a well-defined transition probability
Simulation procedure
1. Generate a new “trial” configuration by making a perturbation to the present configuration
2. Accept the new configuration based on the ratio of the probabilities for the new and old configurations, according to the Metropolis algorithm
3. If the trial is rejected, the present configuration is taken as the next one in the Markov chain
4. Repeat this many times, accumulating sums for averages
new
old
U
U
e
e
state k
state k+1
Metropolis Monte Carlo Molecular Simulation
David A. Kofke, SUNY Buffalo
For a new configuration of the same volume V and number of molecules N,displace a randomly selected atom to a point chosen with uniform probability inside a cubic volume of edge 2 centered on the current position of the atom.
Examine underlying transition
probability to formulate the acceptance
criterion
Displacement trial move. 1. Specification
?
Select an atom at random.
Consider a region centered
at it.
Move atom to a point chosen
uniformly in region.
Consider acceptance of
new configuration.
2
Step 1 Step 2 Step 3 Step 4
general hitherto
David A. Kofke, SUNY Buffalo
Detailed specification of trial move and transition probability
Event[reverse event]
Probability[reverse probability]
Select molecule k[select molecule k]
1/N[1/N]
Move to rnew
[move back to rold]1/v
[1/v]
Accept move[accept move]
min(1,)[min(1,1/)]
Forward-step transition probability
(2)d
1 1min(1, )
N v
Reverse-step transition probability
11 1min(1, )
N v
is formulated to satisfy the detailed balance condition.
Displacement trial move. 2. Analysis of transition probabilities
David A. Kofke, SUNY Buffalo
Detailed balance
Forward-step transition probability
1 1min(1, )
N v
Reverse-step transition probability
11 1min(1, )
N v
i ij j ji=
Limiting distributionof canonical ensemble
( )1( )
NN N U N
Nd e d
Z rr r r
Displacement trial move. 3. Analysis of detailed balance
David A. Kofke, SUNY Buffalo
Detailed balance
Forward-step transition probability
1 1min(1, )
N v
Reverse-step transition probability
11 1min(1, )
N v
i ij j ji
old newU Ue e
=
( )new oldU Ue Acceptance probability for canonical ensemble
11 1 1 1min(1, ) min(1, )
old newU N U N
N N
e d e d
Z N v Z N v
r r
Displacement trial move. 3. Analysis of detailed balance
David A. Kofke, SUNY Buffalo
public void thisTrial(Phase phase) { double uOld, uNew; if(phase.atomCount==0) {return;} //no atoms to move
int i = (int)(rand.nextDouble()*phase.atomCount); //pick a random number from 1 to N Atom a = phase.firstAtom(); for(int j=i; --j>=0; ) {a = a.nextAtom();} //get ith atom in list
uOld = phase.potentialEnergy.currentValue(a); //calculate its contribution to the energy a.displaceWithin(stepSize); //move it within a local volume phase.boundary().centralImage(a.coordinate.position()); //apply PBC uNew = phase.potentialEnergy.currentValue(a); //calculate its new contribution to energy
if(uNew < uOld) { //accept if energy decreased nAccept++; return; } if(uNew >= Double.MAX_VALUE || //reject if energy is huge or doesn’t pass test Math.exp(-(uNew-uOld)/parentIntegrator.temperature) < rand.nextDouble()) { a.replace(); //...put it back in its original position return; } nAccept++; //if reached here, move is accepted }
Displacement trial move. 4. Code example (Java)
David A. Kofke, SUNY Buffalo
Displacement trial move. 4. Pseudo Code (Louis)
Initialization
Reset block sums
Compute block average
Compute final results
“cycle” or “sweep”
“block”
Move each atom once (on average) 100’s or 1000’s
of cycles
Independent “measurement”
moves per cycle
cycles per block
Add to block sum
blocks per simulation
New configuration
New configuration
Entire SimulationMonte Carlo Move
Select type of trial moveeach type of move has fixed probability of being selected
Perform selected trial move
Decide to accept trial configuration, or keep original
David A. Kofke, SUNY Buffalo
Displacement trial move. 5. Implementation
Rule of thumb: Size of the step is adjusted to reach a target acceptance rate of displacement trials, which is typically 50%.
Large step leads to less acceptance but bigger moves.
Small step leads to less movement but more acceptance.
Displacement trial move. 6. Step size tuning