diff --git a/index.html b/index.html index d7f44f1..db29ff8 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Quantum Monte Carlo @@ -329,153 +329,153 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Introduction

+
+

1 Introduction

This website contains the QMC tutorial of the 2021 LTTC winter school @@ -515,8 +515,8 @@ coordinates, etc).

-
-

1.1 Energy and local energy

+
+

1.1 Energy and local energy

For a given system with Hamiltonian \(\hat{H}\) and wave function \(\Psi\), we define the local energy as @@ -599,8 +599,8 @@ energy computed over these configurations:

-
-

2 Numerical evaluation of the energy of the hydrogen atom

+
+

2 Numerical evaluation of the energy of the hydrogen atom

In this section, we consider the hydrogen atom with the following @@ -629,8 +629,8 @@ To do that, we will compute the local energy and check whether it is constant.

-
-

2.1 Local energy

+
+

2.1 Local energy

You will now program all quantities needed to compute the local energy of the H atom for the given wave function. @@ -657,8 +657,8 @@ to catch the error.

-
-

2.1.1 Exercise 1

+
+

2.1.1 Exercise 1

@@ -703,8 +703,8 @@ and returns the potential.

-
-
2.1.1.1 Solution   solution
+
+
2.1.1.1 Solution   solution

Python @@ -745,8 +745,8 @@ and returns the potential.

-
-

2.1.2 Exercise 2

+
+

2.1.2 Exercise 2

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

-
-
2.1.2.1 Solution   solution
+
+
2.1.2.1 Solution   solution

Python @@ -809,8 +809,8 @@ input arguments, and returns a scalar.

-
-

2.1.3 Exercise 3

+
+

2.1.3 Exercise 3

@@ -891,8 +891,8 @@ Therefore, the local kinetic energy is

-
-
2.1.3.1 Solution   solution
+
+
2.1.3.1 Solution   solution

Python @@ -933,8 +933,8 @@ Therefore, the local kinetic energy is

-
-

2.1.4 Exercise 4

+
+

2.1.4 Exercise 4

@@ -993,8 +993,8 @@ are calling is yours.

-
-
2.1.4.1 Solution   solution
+
+
2.1.4.1 Solution   solution

Python @@ -1025,8 +1025,8 @@ are calling is yours.

-
-

2.1.5 Exercise 5

+
+

2.1.5 Exercise 5

@@ -1036,8 +1036,8 @@ Find the theoretical value of \(a\) for which \(\Psi\) is an eigenfunction of \(

-
-
2.1.5.1 Solution   solution
+
+
2.1.5.1 Solution   solution
\begin{eqnarray*} E &=& \frac{\hat{H} \Psi}{\Psi} = - \frac{1}{2} \frac{\Delta \Psi}{\Psi} - @@ -1057,8 +1057,8 @@ equal to -0.5 atomic units.
-
-

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

+
+

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

The program you will write in this section will be written in @@ -1089,8 +1089,8 @@ In Fortran, you will need to compile all the source files together:

-
-

2.2.1 Exercise

+
+

2.2.1 Exercise

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

-
-
2.2.1.1 Solution   solution
+
+
2.2.1.1 Solution   solution

Python @@ -1262,8 +1262,8 @@ plt.savefig("plot_py.png")

-
-

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\) @@ -1293,8 +1293,8 @@ The energy is biased because:

-
-

2.3.1 Exercise

+
+

2.3.1 Exercise

@@ -1365,8 +1365,8 @@ To compile the Fortran and run it:

-
-
2.3.1.1 Solution   solution
+
+
2.3.1.1 Solution   solution

Python @@ -1483,8 +1483,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\) @@ -1511,8 +1511,8 @@ energy can be used as a measure of the quality of a wave function.

-
-

2.4.1 Exercise (optional)

+
+

2.4.1 Exercise (optional)

@@ -1523,8 +1523,8 @@ Prove that :

-
-
2.4.1.1 Solution   solution
+
+
2.4.1.1 Solution   solution

\(\bar{E} = \langle E \rangle\) is a constant, so \(\langle \bar{E} @@ -1543,8 +1543,8 @@ Prove that :

-
-

2.4.2 Exercise

+
+

2.4.2 Exercise

@@ -1620,8 +1620,8 @@ To compile and run:

-
-
2.4.2.1 Solution   solution
+
+
2.4.2.1 Solution   solution

Python @@ -1760,8 +1760,8 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002 s2 = 1.8068814

-
-

3 Variational Monte Carlo

+
+

3 Variational Monte Carlo

Numerical integration with deterministic methods is very efficient @@ -1777,8 +1777,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\) @@ -1818,8 +1818,8 @@ And the confidence interval is given by

-
-

3.1.1 Exercise

+
+

3.1.1 Exercise

@@ -1859,8 +1859,8 @@ input array.

-
-
3.1.1.1 Solution   solution
+
+
3.1.1.1 Solution   solution

Python @@ -1921,8 +1921,8 @@ input array.

-
-

3.2 Uniform sampling in the box

+
+

3.2 Uniform sampling in the box

We will now perform our first Monte Carlo calculation to compute the @@ -1983,8 +1983,8 @@ compute the statistical error.

-
-

3.2.1 Exercise

+
+

3.2.1 Exercise

@@ -2086,8 +2086,8 @@ well as the index of the current step.

-
-
3.2.1.1 Solution   solution
+
+
3.2.1.1 Solution   solution

Python @@ -2193,8 +2193,8 @@ E = -0.48084122147238995 +/- 2.4983775878329355E-003

-
-

3.3 Metropolis sampling with \(\Psi^2\)

+
+

3.3 Metropolis sampling with \(\Psi^2\)

We will now use the square of the wave function to sample random @@ -2290,13 +2290,13 @@ The algorithm is summarized as follows:

    -
  1. Compute \(\Psi\) at a new position \(\mathbf{r'} = \mathbf{r}_n + - \delta L\, \mathbf{u}\)
  2. +
  3. Evaluate the local energy at \(\mathbf{r}_n\) and accumulate it
  4. +
  5. Compute a new position \(\mathbf{r'} = \mathbf{r}_n + \delta L\, \mathbf{u}\)
  6. +
  7. Evaluate \(\Psi(\mathbf{r}')\) at the new position
  8. Compute the ratio \(A = \frac{\left|\Psi(\mathbf{r'})\right|^2}{\left|\Psi(\mathbf{r}_{n})\right|^2}\)
  9. Draw a uniform random number \(v \in [0,1]\)
  10. if \(v \le A\), accept the move : set \(\mathbf{r}_{n+1} = \mathbf{r'}\)
  11. else, reject the move : set \(\mathbf{r}_{n+1} = \mathbf{r}_n\)
  12. -
  13. evaluate the local energy at \(\mathbf{r}_{n+1}\)
@@ -2313,8 +2313,8 @@ All samples should be kept, from both accepted and rejected moves.
-
-

3.3.1 Optimal step size

+
+

3.3.1 Optimal step size

If the box is infinitely small, the ratio will be very close @@ -2349,8 +2349,8 @@ the same variable later on to store a time step.

-
-

3.3.2 Exercise

+
+

3.3.2 Exercise

@@ -2459,8 +2459,8 @@ Can you observe a reduction in the statistical error?

-
-
3.3.2.1 Solution   solution
+
+
3.3.2.1 Solution   solution

Python @@ -2607,8 +2607,8 @@ A = 0.50762633333333318 +/- 3.4601756760043725E-004

-
-

3.4 Generalized Metropolis algorithm

+
+

3.4 Generalized Metropolis algorithm

One can use more efficient numerical schemes to move the electrons by choosing a smarter expression for the transition probability. @@ -2667,7 +2667,7 @@ choose to draw Gaussian random numbers with zero mean and variance

Furthermore, to sample the density even better, we can "push" the electrons into in the regions of high probability, and "pull" them away from -the low-probability regions. This will ncrease the +the low-probability regions. This will increase the acceptance ratios and improve the sampling.

@@ -2696,7 +2696,7 @@ drifted diffusion with transition probability:

-The corrsponding move is proposed as +The corresponding move is proposed as

@@ -2718,24 +2718,19 @@ The algorithm of the previous exercise is only slighlty modified as:

    -
  1. -Compute a new position \(\mathbf{r'} = \mathbf{r}_n + - \delta t\, \frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})} + \chi\) -

    - -

    -Evaluate \(\Psi\) and \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\) at the new position -

  2. -
  3. Compute the ratio \(A = \frac{T(\mathbf{r}_{n+1} \rightarrow \mathbf{r}_{n}) P(\mathbf{r}_{n+1})}{T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) P(\mathbf{r}_{n})}\)
  4. +
  5. Evaluate the local energy at \(\mathbf{r}_{n}\) and accumulate it
  6. +
  7. Compute a new position \(\mathbf{r'} = \mathbf{r}_n + + \delta t\, \frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})} + \chi\)
  8. +
  9. Evaluate \(\Psi(\mathbf{r}')\) and \(\frac{\nabla \Psi(\mathbf{r'})}{\Psi(\mathbf{r'})}\) at the new position
  10. +
  11. Compute the ratio \(A = \frac{T(\mathbf{r}' \rightarrow \mathbf{r}_{n}) P(\mathbf{r}')}{T(\mathbf{r}_{n} \rightarrow \mathbf{r}') P(\mathbf{r}_{n})}\)
  12. Draw a uniform random number \(v \in [0,1]\)
  13. if \(v \le A\), accept the move : set \(\mathbf{r}_{n+1} = \mathbf{r'}\)
  14. else, reject the move : set \(\mathbf{r}_{n+1} = \mathbf{r}_n\)
  15. -
  16. evaluate the local energy at \(\mathbf{r}_{n+1}\)
-
-

3.4.1 Gaussian random number generator

+
+

3.4.1 Gaussian random number generator

To obtain Gaussian-distributed random numbers, you can apply the @@ -2799,9 +2794,17 @@ In Python, you can use the -

3.4.2 Exercise 1

+
+

3.4.2 Exercise 1

+
+

+If you use Fortran, copy/paste the random_gauss function in +a Fortran file. +

+ +
+

Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\). @@ -2834,8 +2837,8 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P

-
-
3.4.2.1 Solution   solution
+
+
3.4.2.1 Solution   solution

Python @@ -2868,8 +2871,8 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P

-
-

3.4.3 Exercise 2

+
+

3.4.3 Exercise 2

@@ -2965,8 +2968,8 @@ Modify the previous program to introduce the drift-diffusion scheme.

-
-
3.4.3.1 Solution   solution
+
+
3.4.3.1 Solution   solution

Python @@ -3013,13 +3016,13 @@ Modify the previous program to introduce the drift-diffusion scheme. d2_old = d2_new psi_old = psi_new - return energy/nmax, accep_rate/nmax + return energy/nmax, N_accep/nmax # Run simulation a = 1.2 nmax = 100000 -dt = 1.3 +dt = 1.0 X0 = [ MonteCarlo(a,nmax,dt) for i in range(30)] @@ -3035,12 +3038,6 @@ Modify the previous program to introduce the drift-diffusion scheme.

-
-E = -0.4951317910667116 +/- 0.00014045774335059988
-A = 0.7200673333333333 +/- 0.00045942791345632793
-
-
-

Fortran

@@ -3144,8 +3141,8 @@ A = 0.7200673333333333 +/- 0.00045942791345632793
-E =  -0.49497258331144794      +/-   1.0973395750688713E-004
-A =   0.78839866666666658      +/-   3.2503783452043152E-004
+E =  -0.47940635575542706      +/-   5.5613594433433764E-004
+A =   0.62037333333333333      +/-   4.8970160591451110E-004
 
 
@@ -3154,12 +3151,12 @@ A = 0.78839866666666658 +/- 3.2503783452043152E-004
-
-

4 Diffusion Monte Carlo   solution

+
+

4 Diffusion Monte Carlo   solution

-
-

4.1 Schrödinger equation in imaginary time

+
+

4.1 Schrödinger equation in imaginary time

Consider the time-dependent Schrödinger equation: @@ -3227,8 +3224,8 @@ system.

-
-

4.2 Diffusion and branching

+
+

4.2 Diffusion and branching

The imaginary-time Schrödinger equation can be explicitly written in terms of the kinetic and @@ -3325,8 +3322,8 @@ Therefore, in both cases, you are dealing with a "Bosonic" ground state.

-
-

4.3 Importance sampling

+
+

4.3 Importance sampling

In a molecular system, the potential is far from being constant @@ -3422,8 +3419,8 @@ energies computed with the trial wave function.

-
-

4.3.1 Appendix : Details of the Derivation

+
+

4.3.1 Appendix : Details of the Derivation

\[ @@ -3484,8 +3481,8 @@ Defining \(\Pi(\mathbf{r},t) = \psi(\mathbf{r},\tau)

-
-

4.4 Pure Diffusion Monte Carlo (PDMC)

+
+

4.4 Pure Diffusion Monte Carlo (PDMC)

Instead of having a variable number of particles to simulate the @@ -3566,13 +3563,13 @@ code, so this is what we will do in the next section.

-
-

4.5 Hydrogen atom

+
+

4.5 Hydrogen atom

-
-

4.5.1 Exercise

+
+

4.5.1 Exercise

@@ -3671,8 +3668,8 @@ energy of H for any value of \(a\).

-
-
4.5.1.1 Solution   solution
+
+
4.5.1.1 Solution   solution

Python @@ -3890,8 +3887,8 @@ A = 0.98788066666666663 +/- 7.2889356133441110E-005

-
-

4.6 TODO H2

+
+

4.6 TODO H2

We will now consider the H2 molecule in a minimal basis composed of the @@ -3912,8 +3909,8 @@ the nuclei.

-
-

5 TODO [0/3] Last things to do

+
+

5 TODO [0/3] Last things to do

  • [ ] Give some hints of how much time is required for each section
  • @@ -3927,8 +3924,8 @@ the H\(_2\) molecule at $R$=1.4010 bohr. Answer: 0.17406 a.u.
-
-

6 Schedule

+
+

6 Schedule

@@ -3980,6 +3977,11 @@ the H\(_2\) molecule at $R$=1.4010 bohr. Answer: 0.17406 a.u. + + + + +
<2021-02-04 Thu 14:30>–<2021-02-04 Thu 15:30> 3.3
<2021-02-04 Thu 15:30>–<2021-02-04 Thu 16:30>3.4
@@ -3987,7 +3989,7 @@ the H\(_2\) molecule at $R$=1.4010 bohr. Answer: 0.17406 a.u.

Author: Anthony Scemama, Claudia Filippi

-

Created: 2021-02-02 Tue 13:08

+

Created: 2021-02-02 Tue 13:25

Validate