diff --git a/index.html b/index.html index cbc3560..97316a3 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Quantum Monte Carlo @@ -257,63 +257,64 @@ for the JavaScript code in this tag.

Table of Contents

@@ -321,8 +322,8 @@ for the JavaScript code in this tag.
-
-

1 Introduction

+
+

1 Introduction

We propose different exercises to understand quantum Monte Carlo (QMC) @@ -364,8 +365,8 @@ interpreted as a single precision value

-
-

2 Numerical evaluation of the energy

+
+

2 Numerical evaluation of the energy

In this section we consider the Hydrogen atom with the following @@ -439,13 +440,13 @@ E & = & \frac{\langle \Psi| \hat{H} | \Psi\rangle}{\langle \Psi |\Psi \rangle} \end{eqnarray*}

-
-

2.1 Local energy

+
+

2.1 Local energy

-
-

2.1.1 Exercise 1

+
+

2.1.1 Exercise 1

@@ -489,8 +490,8 @@ and returns the potential.

-
-

2.1.2 Exercise 2

+
+

2.1.2 Exercise 2

@@ -525,8 +526,8 @@ input arguments, and returns a scalar.

-
-

2.1.3 Exercise 3

+
+

2.1.3 Exercise 3

@@ -607,8 +608,8 @@ So the local kinetic energy is

-
-

2.1.4 Exercise 4

+
+

2.1.4 Exercise 4

@@ -651,14 +652,14 @@ local energy.

-
-

2.2 Plot of the local energy along the \(x\) axis

+
+

2.2 Plot of the local energy along the \(x\) axis

-
-

2.2.1 Exercise

+
+

2.2.1 Exercise

@@ -775,8 +776,8 @@ plot './data' index 0 using 1:2 with lines title 'a=0.1', \

-
-

2.3 Numerical estimation of the energy

+
+

2.3 Numerical estimation of the energy

If the space is discretized in small volume elements \(\mathbf{r}_i\) @@ -806,8 +807,8 @@ The energy is biased because:

-
-

2.3.1 Exercise

+
+

2.3.1 Exercise

@@ -917,8 +918,8 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002

-
-

2.4 Variance of the local energy

+
+

2.4 Variance of the local energy

The variance of the local energy is a functional of \(\Psi\) @@ -931,6 +932,11 @@ energy associated with \(\Psi\) around the average: \sigma^2(E_L) = \frac{\int \left[\Psi(\mathbf{r})\right]^2\, \left[ E_L(\mathbf{r}) - E \right]^2 \, d\mathbf{r}}{\int \left[\Psi(\mathbf{r}) \right]^2 d\mathbf{r}} \] +which can be simplified as +

+ +

+\[ \sigma^2(E_L) = \langle E^2 \rangle - \langle E \rangle^2 \]

@@ -940,12 +946,26 @@ energy can be used as a measure of the quality of a wave function.

-
-

2.4.1 Exercise

+
+

2.4.1 Exercise (optional)

-Compute a numerical estimate of the variance of the local energy +Prove that : +\[ \sigma^2(E_L) = \langle E^2 \rangle - \langle E \rangle^2 \] +

+ +
+
+
+ +
+

2.4.2 Exercise

+
+
+

+Add the calculation of the variance to the previous code, and +compute a numerical estimate of the variance of the local energy in a grid of \(50\times50\times50\) points in the range \((-5,-5,-5) \le \mathbf{r} \le (5,5,5)\) for different values of \(a\). @@ -967,6 +987,7 @@ in a grid of \(50\times50\times50\) points in the range for a in [0.1, 0.2, 0.5, 0.9, 1., 1.5, 2.]: E = 0. + E2 = 0. norm = 0. for x in interval: r[0] = x @@ -978,20 +999,11 @@ in a grid of \(50\times50\times50\) points in the range w = w * w * delta El = e_loc(a, r) E += w * El + E2 += w * El*El norm += w E = E / norm - s2 = 0. - for x in interval: - r[0] = x - for y in interval: - r[1] = y - for z in interval: - r[2] = z - w = psi(a, r) - w = w * w * delta - El = e_loc(a, r) - s2 += w * (El - E)**2 - s2 = s2 / norm + E2 = E2 / norm + s2 = E2 - E*E print(f"a = {a} \t E = {E:10.8f} \t \sigma^2 = {s2:10.8f}")

@@ -1083,8 +1095,8 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002 s2 = 1.806881
-
-

3 Variational Monte Carlo

+
+

3 Variational Monte Carlo

Numerical integration with deterministic methods is very efficient @@ -1100,8 +1112,8 @@ interval.

-
-

3.1 Computation of the statistical error

+
+

3.1 Computation of the statistical error

To compute the statistical error, you need to perform \(M\) @@ -1141,8 +1153,8 @@ And the confidence interval is given by

-
-

3.1.1 Exercise

+
+

3.1.1 Exercise

@@ -1191,8 +1203,8 @@ input array.

-
-

3.2 Uniform sampling in the box

+
+

3.2 Uniform sampling in the box

We will now do our first Monte Carlo calculation to compute the @@ -1226,8 +1238,8 @@ statistical error.

-
-

3.2.1 Exercise

+
+

3.2.1 Exercise

@@ -1337,8 +1349,8 @@ E = -0.49588321986667677 +/- 7.1758863546737969E-004

-
-

3.3 Gaussian sampling

+
+

3.3 Gaussian sampling

We will now improve the sampling and allow to sample in the whole @@ -1434,8 +1446,8 @@ average energy can be computed as

-
-

3.3.1 Exercise

+
+

3.3.1 Exercise

@@ -1546,8 +1558,8 @@ E = -0.49517104619091717 +/- 1.0685523607878961E-004

-
-

3.4 Sampling with \(\Psi^2\)

+
+

3.4 Sampling with \(\Psi^2\)

We will now use the square of the wave function to make the sampling: @@ -1572,8 +1584,8 @@ the local energies, each with a weight of 1.

-
-

3.4.1 Importance sampling

+
+

3.4.1 Importance sampling

To generate the probability density \(\Psi^2\), we consider a @@ -1686,7 +1698,7 @@ variance \(\tau\,2D\).

    -
  1. Exercise 1
    +
  2. Exercise 1

    @@ -1722,7 +1734,7 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P

  3. -
  4. TODO Exercise 2
    +
  5. TODO Exercise 2

    @@ -1834,8 +1846,8 @@ E = -0.48584030499187431 +/- 1.0411743995438257E-004

-
-

3.4.2 Metropolis algorithm

+
+

3.4.2 Metropolis algorithm

Discretizing the differential equation to generate the desired @@ -1896,7 +1908,7 @@ the simulation.

    -
  1. Exercise
    +
  2. Exercise

    @@ -2052,17 +2064,17 @@ A = 0.78861366666666655 +/- 3.5096729498002445E-004

    -
    -

    4 TODO Diffusion Monte Carlo

    +
    +

    4 TODO Diffusion Monte Carlo

    -
    -

    4.1 Hydrogen atom

    +
    +

    4.1 Hydrogen atom

      -
    1. Exercise
      +
    2. Exercise

      @@ -2221,8 +2233,8 @@ A = 0.78861366666666655 +/- 3.5096729498002445E-004

      -
      -

      4.2 Dihydrogen

      +
      +

      4.2 Dihydrogen

      We will now consider the H2 molecule in a minimal basis composed of the @@ -2244,7 +2256,7 @@ the nuclei.

      Author: Anthony Scemama, Claudia Filippi

      -

      Created: 2021-01-13 Wed 17:26

      +

      Created: 2021-01-19 Tue 09:46

      Validate