next up previous
Next: Importance Sampling. Metropolis Algorithm Up: Importance Sampling. Monte Carlo Previous: Importance Sampling. Monte Carlo

Ensemble Averages (flashback).

Classical System:
Phase Space $\{\mathbf{p},\mathbf{q}\}$[*]
Distribution function for the NVT-ensemble:

\begin{displaymath}
\rho(\{\mathbf{p},\mathbf{q}\})=\frac{1}{Z}\exp(-\beta U(\{\mathbf{p},\mathbf{q}\}))d\{\mathbf{p},\mathbf{q}\}\end{displaymath}

Ensemble Average for the quantity $f(\{\mathbf{p},\mathbf{q}\})$:
 
 \begin{displaymath}
\begin{split}
\langle f(\{\mathbf{p},\mathbf{q}\})\rangle &=...
 ...athbf{q}\} \exp(-\beta U(\{\mathbf{p},\mathbf{q}\}))\end{split}\end{displaymath} (1)
Unless explicitly stated, below we always assume, that kinetic energy is separable, and therefore, we care about the configurational $\{\mathbf{q}\}$ 3N-dimensional space. The contribution from the momentum part is trivial, and can be taken into account a posteriori.

Brute Force Approach:
We can try to calculate the integrals in (1) directly. It works for simple systems, like the Harmonic oscillator for instance.
\begin{multline*}
U({\mathbf{p},\mathbf{q}}) =\frac{ kq^2}{2} + \frac{p^2}{2m} \...
 ...hbf{p},\mathbf{q}}) \rho({\mathbf{p},\mathbf{q}}) \ = \beta^{-1}\end{multline*}
Or we can calculate it numerically using e.g. Simpson's rule, if the energy function is more complex.

But if it's a system of the N particles, integrals are over the 6N dimensional space and we would have to evaluate the function at the grid of $\approx 100^{6N}$ points!!!!

Monte Carlo method for calculating integrals:
An integral of a function f(x) on the interval [a,b] can be represented as:

\begin{displaymath}
\int_a^bf(x)dx = (b-a)\langle f(x)\rangle\end{displaymath}

This is a key to the Monte Carlo method for calculating integrals:
1.
throw n points at random positions xi within the interval (or region for the multi-dimensional case)
2.
calculate the average

\begin{displaymath}
\langle f(x)\rangle =\frac{1}{n} \sum_{i=1}^n f(x_i)\end{displaymath}

3.
accuracy of the average is estimated by calculating the deviation:

\begin{displaymath}
(\delta \langle f(x)\rangle)^2 \approx \frac{1}{n} \sum_{i=1}^n
 (f(x_i)-\langle f(x)\rangle)^2 
 \end{displaymath}

Fortran code Example 1 :
Here is an example of the Fortran code to calculate integral of the x2 from to 1 by Monte Carlo method[*]. Code.

next up previous
Next: Importance Sampling. Metropolis Algorithm Up: Importance Sampling. Monte Carlo Previous: Importance Sampling. Monte Carlo

© 1997 Boris Veytsman and Michael Kotelyanskii
Tue Nov 4 23:48:52 EST 1997