general considerations monte carlo methods (i). averages x = (x 1, x 2, …, x n ) – vector of...
TRANSCRIPT
General considerations Monte Carlo methods (I)
11
1
N
N
xx
xx
dVf
dVfAA
X
X
X
XX
Averages
X = (x1, x2, …, xN) – vector of variablesP – probability density function
Random variables and their distributions
A random variable: a number assigned to an event
Distribuand:
Probability density:
Any function of a random variable is a random variable.
XYPXF
dX
XdPXf
Moments of a distribution
n
iii
n
iii
xxPxHH(x)E
xxPxE({x})
1
1
dxxfxHxHE
dxxxfx{x}E ˆ
Continuous variables:
If H(x)=(x-xc)n then E{H(X)} is called the nth moment of x with respect to c; if c= then E is the nth central moment, n({x}).
x̂
Some useful central moments
Variance
dxxfx̂xxx 22
2
Skewness
dxxfx̂xx
1
x
xx 3
32/32
3
Kurtosis
3dxxfx̂x
x
13
x
xx 4
422
4
For a set of points:
3
)1n(
x̂x
)1n(
x̂x
xxn1n
1x̂x
1n
1
xn
1x̂
4
n
1i
4i
3
n
1i
3i
2n
1ii
n
1i
2i
n
1i
2i
2
n
1ii
Some examples of central moments
Boltzmann distribution
E BB
NN
B
NN
B
NN
B
i
iB
ii
dETk
EEQdE
Tk
EE
QdEEP
ddTk
EQdd
Tk
E
QddP
Tk
EQ
Tk
E
QP
expexp1
,exp
,exp
1,
expexp1
pqpq
pqpq
pqpqq p
kB (Boltzmann constant) = 1.3810-23 J/K
NAkB = R (universal gas constant) = 8.3143 J/(molK)
q – positions; p – momenta; (E) – density of states with energy E
Thermodynamic quantities
VN
TTBV
B
BVN
Bi
iiB
TNB
i B
iiT
VNB
i B
iiT
T
UEETkC
QTkF
QkT
QTkPPTkS
V
QTk
TkVQpp
T
QTk
TkQEU
,
222
,
,
,
2
ln
lnln
ln
lnexp
1
lnexp
1
Ergodicity
AA
AN
A
dAt
A
N
ii
N
t
t
theoremergodic
ρ toacc.sampled
1
0
1lim
1lim
Trajectories in the phase space. For ergodic sampling, sub-trajectories should be part of a trajectory that passes through all points.
Monte Carlo methods: use of random-number generators to follows the evolution of a system according to a given probability-distribution function.
Beginnings: Antiquity (?); estimation of the results of dice game.
First documented use: G. Comte de Buffon (1777): estimation of the number p by throwing a needle on a sheet of paper with parallel lines and counting the number of hits.
First large-scale (wartime) application: J. von Neumann, S. Ulam, N. Metropolis, R.P. Feynman i in. (1940’s; the Manhattan project) calculations of neutron creation and scattering. For security, the calculations were disguised as ,,Monte Carlo” calculations.
Kinds of Monte Carlo methods
The von Neumann (rejection) sampling
The Metropolis (in general: Markov chain) sampling. Also known as „importance sampling”
Simple Monte Carlo averaging
N
iii xfxA
NA
1
1
x
f(x)
Sample a point on x from a uniform distribution
Compute f(xi)
Rejection or hit-and-miss sampling
x
f(x)
Sample a point on x from a uniform distrubution
Sample a point on f
accept
reject
acceptedi
iaccepted
xAN
A1
Algorithm
Generate a random point X in the
configurational space
Generate a random point y in [0,1]
P(X)>yAccept X
A:=A+A(X)Reject X
Application of the rejection sampling to compute the number
1
41
21 2
lim
totN
N
nS
S
Applications
• For one-dimensional integrals classical quadratures (Newton-Cotes, Gauss) are better than that.
• For multi-dimensional integrals sampling the integrations space is somewhat better; however most points have zero contributions.
• We cannot compute ensemble averages of molecular systems that way. The positions of atoms would have to generated at random, this usually leading to HUGE energies.
Illustration of the difference between the direct- and importance-sampling methods to measure the depth of the river of Nile
Von Neumann: all points are visited
Metropolis: The walker stays in the river
Perturb Xo: X1 = Xo + X
Compute the new energy (E1)
Configuration Xo, energy Eo
E1<Eo ?
Draw Y from U(0,1)
Compute W=exp[-(E1-Eo)/kT]
W>Y?
Xo=X1, Eo=E1
N
Y
Y
N
A:=A+A(Xo)
E0
E1
Accept with probability exp[-(E2-E1)/kBT]
E1
Accept
Space representation in MC simulations
• Lattice (discrete). The particles are on lattice nodes
• Continuous. The particles move in the 3D space.
On- and off-lattice representations
Application of Metropolis Monte Carlo
• Determination of mechanical and thermodynamic properties(density, average energy, heat capacity, conductivity, virial coefficients).
• Simulations of phase transitions. • Simulations of polymer properties.• Simulations of biopolymers.• Simulations of ligand-receptor binding.• Simulations of chemical reactions.
Computing averages with Metropolis Monte Carlo
N
iiAN
A1
1
It should be noted that all MC steps are considered, including those which resulted in the rejection of a new configuration. Therefore, if a configuration has a very low energy, it will be counted multiple times.
Detailed balance (Einstein’s theorem)
)()()()( onnnoo NN
old
new
In real life the detailed balance condition is rarely satisfied…
These gates at a Seoul subway station do not satisfy the detailed-balance condition: you can go through but you cannot go back…
A famous Russian proverb states: „A ruble to get in, ten rubles to get out”
I thought there was a way out….
I was sssoooo busy working for my Queen and Community….
Nature teaches us the hard way that detailed balance is not something to meet in the macro-world..
It is only too easy to violate the
detailed-balance conditions
Monte Carlo with minimization: energy is minimized after each move. Transition probability is proportional to basin size.
Little chance to get from C to B
A B C
pertubation
minim
ization
pertubation
Minim
ization
brings back to C
Translational perturbations (straightforward)
5.0():
5.0():
5.0():
1()int:
ranfozz
ranfoyy
ranfoxx
ranfNo
new
new
new
x[o]
Orientational perturbations
Euler angles. We rotate the system first about the z axis by so that the new x axis is axis w, then about the w axis by so that the new z axis is z’ and finally about the z’ axis by so that the new x axis is x’ and the new y axis is y’.
Uniform sampling the Euler angles would result in a serious bias.
Rotational perturbations: rigid linear molecules
Orientational perturbation
uu’
Genarate a random unit vector v
Compute t:=u+v
Compute u’:= t/||t||
Rigid non-linear molecules
Sample a unit vector on a 4D sphere (quaternion) (E. Veseley, J. Comp. Phys., 47:291-296, 1982), then compute the Euler angles from the following formulas:
2sin
2cos
2sin
2sin
2cos
2sin
2cos
2cos
1;,,,
3
2
1
0
23
22
21
203210
q
q
q
q
qqqqqqqqQ
Rotation matrix
rr
qqqqqqqqqqqq
qqqqqqqqqqqq
qqqqqqqqqqqq
R
R
'
23
22
21
2010322031
103223
22
21
203021
2031302123
22
21
20
22
22
22
Choosing the initial configuration and step size
• Generally: avoid clashes.
• For rigid liquids molecules start from a configuration on a lattice.
• For flexible molecules: build the chain to avoid overlap with the atoms already present.
MC step size
• Too small: high acceptance rate but poor ergodicity (can’t get out of a local minimum).
• Too large: low acceptance rate.
• Avoid accepting „good” advices that the acceptance rate should be 10/20/50%, etc. Do pre-production simulations to select optimal step size
• This can help:– Configurational-bias Monte Carlo,– Parallel tempering.
Reference algorithms for MC/MD simulations (Fortran 77)
M.P. Allen, D.J. Tildesley, „Computer Simulations of Liquids” , Oxford Science Publications, Clardenon Press, Oxford, 1987
http://www.ccp5.ac.uk/software/allen_tildersley.shtml
F11: Monte Carlo simulations of Lennard-Jones fluid.