From 756995e5cd8d74e69a67eb3d1a9f3dc3689c1d28 Mon Sep 17 00:00:00 2001 From: filippi-claudia Date: Sun, 31 Jan 2021 18:17:27 +0000 Subject: [PATCH] deploy: 31ea0f71f336e4a5a036043268a955cd99ab83e7 --- index.html | 381 +++++++++++++++++++++++++++++------------------------ 1 file changed, 208 insertions(+), 173 deletions(-) diff --git a/index.html b/index.html index 8a30474..2c435d2 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,152 +329,152 @@ 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 @@ -514,8 +514,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 @@ -593,8 +593,8 @@ $$ E ≈ \frac{1}{N\rm MC} ∑i=1N\rm MC

-
-

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 @@ -623,8 +623,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. @@ -651,8 +651,8 @@ to catch the error.

-
-

2.1.1 Exercise 1

+
+

2.1.1 Exercise 1

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

-
-
2.1.1.1 Solution   solution
+
+
2.1.1.1 Solution   solution

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

-
-

2.1.2 Exercise 2

+
+

2.1.2 Exercise 2

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

-
-
2.1.2.1 Solution   solution
+
+
2.1.2.1 Solution   solution

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

-
-

2.1.3 Exercise 3

+
+

2.1.3 Exercise 3

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

-
-
2.1.3.1 Solution   solution
+
+
2.1.3.1 Solution   solution

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

-
-

2.1.4 Exercise 4

+
+

2.1.4 Exercise 4

@@ -969,8 +969,8 @@ local kinetic energy.

-
-
2.1.4.1 Solution   solution
+
+
2.1.4.1 Solution   solution

Python @@ -1000,8 +1000,8 @@ local kinetic energy.

-
-

2.1.5 Exercise 5

+
+

2.1.5 Exercise 5

@@ -1011,8 +1011,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} - @@ -1032,8 +1032,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

@@ -1044,8 +1044,8 @@ choose a grid which does not contain the origin.

-
-

2.2.1 Exercise

+
+

2.2.1 Exercise

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

-
-

2.3.1 Exercise

+
+

2.3.1 Exercise

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

-
-
2.3.1.1 Solution   solution
+
+
2.3.1.1 Solution   solution

Python @@ -1421,8 +1421,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\) @@ -1449,8 +1449,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)

@@ -1461,8 +1461,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} @@ -1481,8 +1481,8 @@ Prove that :

-
-

2.4.2 Exercise

+
+

2.4.2 Exercise

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

-
-
2.4.2.1 Solution   solution
+
+
2.4.2.1 Solution   solution

Python @@ -1694,8 +1694,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 @@ -1711,8 +1711,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\) @@ -1752,8 +1752,8 @@ And the confidence interval is given by

-
-

3.1.1 Exercise

+
+

3.1.1 Exercise

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

-
-
3.1.1.1 Solution   solution
+
+
3.1.1.1 Solution   solution

Python @@ -1851,8 +1851,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 @@ -1913,8 +1913,8 @@ compute the statistical error.

-
-

3.2.1 Exercise

+
+

3.2.1 Exercise

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

-
-
3.2.1.1 Solution   solution
+
+
3.2.1.1 Solution   solution

Python @@ -2129,8 +2129,8 @@ E = -0.49518773675598715 +/- 5.2391494923686175E-004

-
-

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 @@ -2261,11 +2261,16 @@ accepted steps over the total number of steps. Adjusting the time step such that the acceptance rate is close to 0.5 is a good compromise for the current problem.

+ +

+NOTE: below, we use the symbol dt for dL for reasons which will +become clear later. +

-
-

3.3.1 Exercise

+
+

3.3.1 Exercise

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

-
-
3.3.1.1 Solution   solution
+
+
3.3.1.1 Solution   solution

Python @@ -2518,8 +2523,8 @@ A = 0.51695266666666673 +/- 4.0445505648997396E-004

-
-

3.4 Gaussian random number generator

+
+

3.4 Gaussian random number generator

To obtain Gaussian-distributed random numbers, you can apply the @@ -2582,8 +2587,8 @@ In Python, you can use the -

3.5 Generalized Metropolis algorithm

+
+

3.5 Generalized Metropolis algorithm

One can use more efficient numerical schemes to move the electrons by choosing a smarter expression for the transition probability. @@ -2715,8 +2720,8 @@ Evaluate \(\Psi\) and \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\) at th

-
-

3.5.1 Exercise 1

+
+

3.5.1 Exercise 1

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

-
-
3.5.1.1 Solution   solution
+
+
3.5.1.1 Solution   solution

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

-
-

3.5.2 Exercise 2

+
+

3.5.2 Exercise 2

@@ -2879,8 +2884,8 @@ Modify the previous program to introduce the drift-diffusion scheme.

-
-
3.5.2.1 Solution   solution
+
+
3.5.2.1 Solution   solution

Python @@ -3066,12 +3071,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: @@ -3079,13 +3084,17 @@ Consider the time-dependent Schrödinger equation:

\[ - i\frac{\partial \Psi(\mathbf{r},t)}{\partial t} = \hat{H} \Psi(\mathbf{r},t)\,. + i\frac{\partial \Psi(\mathbf{r},t)}{\partial t} = (\hat{H} -E_T) \Psi(\mathbf{r},t)\,. \]

+

+where we introduced a shift in the energy, \(E_T\), which will come useful below. +

+

We can expand a given starting wave function, \(\Psi(\mathbf{r},0)\), in the basis of the eigenstates -of the time-independent Hamiltonian: +of the time-independent Hamiltonian, \(\Phi_k\), with energies \(E_k\):

@@ -3100,7 +3109,7 @@ The solution of the Schrödinger equation at time \(t\) is

\[ - \Psi(\mathbf{r},t) = \sum_k a_k \exp \left( -i\, E_k\, t \right) \Phi_k(\mathbf{r}). + \Psi(\mathbf{r},t) = \sum_k a_k \exp \left( -i\, (E_k-E_T)\, t \right) \Phi_k(\mathbf{r}). \]

@@ -3111,30 +3120,50 @@ Now, if we replace the time variable \(t\) by an imaginary time variable

\[ - -\frac{\partial \psi(\mathbf{r}, \tau)}{\partial \tau} = \hat{H} \psi(\mathbf{r}, \tau) + -\frac{\partial \psi(\mathbf{r}, \tau)}{\partial \tau} = (\hat{H} -E_T) \psi(\mathbf{r}, \tau) \]

where \(\psi(\mathbf{r},\tau) = \Psi(\mathbf{r},-i\,)\) and -\[ - \psi(\mathbf{r},\tau) = \sum_k a_k \exp( -E_k\, \tau) \phi_k(\mathbf{r}). - \] +\begin{eqnarray*} +ψ(\mathbf{r},τ) &=& ∑k ak exp( -Ek\, τ) φk(\mathbf{r})
+ &=& exp(-(E0-ET)\, τ)∑k ak exp( -(Ek-E0)\, τ) φk(\mathbf{r})\,. +\begin{eqnarray*} +

+ +

For large positive values of \(\tau\), \(\psi\) is dominated by the -\(k=0\) term, namely the lowest eigenstate. -So we can expect that simulating the differetial equation in +\(k=0\) term, namely, the lowest eigenstate. If we adjust \(E_T\) to the running estimate of \(E_0\), +we can expect that simulating the differetial equation in imaginary time will converge to the exact ground state of the system.

-
-

4.2 Diffusion and branching

+
+

4.2 Diffusion and branching

-The diffusion equation of particles is given by +The imaginary-time Schrödinger equation can be explicitly written in terms of the kinetic and +potential energies as +

+ +

+\[ + \frac{\partial \psi(\mathbf{r}, \tau)}{\partial \tau} = \left(\frac{1}{2}\Delta - [V(\mathbf{r}) -E_T]\right) \psi(\mathbf{r}, \tau)\,. + \] +

+ +

+We can simulate this differential equation as a diffusion-branching process. +

+ + +

+To this this, recall that the diffusion equation of particles is given by

@@ -3144,7 +3173,7 @@ The diffusion equatio

-The rate of reaction \(v\) is the speed at which a chemical reaction +Furthermore, the rate of reaction \(v\) is the speed at which a chemical reaction takes place. In a solution, the rate is given as a function of the concentration \([A]\) by

@@ -3171,7 +3200,13 @@ kinetic energy, and

The diffusion equation can be simulated by a Brownian motion: +

+ +

\[ \mathbf{r}_{n+1} = \mathbf{r}_{n} + \sqrt{\delta t}\, \chi \] +

+ +

where \(\chi\) is a Gaussian random variable, and the rate equation can be simulated by creating or destroying particles over time (a so-called branching process). @@ -3185,11 +3220,11 @@ the combination of a diffusion process and a branching process.

-
-

4.3 Importance sampling

+
+

4.3 Importance sampling

-In a molecular system, the potential is far from being constant, +In a molecular system, the potential is far from being constant and diverges at inter-particle coalescence points. Hence, when the rate equation is simulated, it results in very large fluctuations in the numbers of particles, making the calculations impossible in @@ -3243,8 +3278,8 @@ error known as the fixed node error.

-
-

4.3.1 Appendix : Details of the Derivation

+
+

4.3.1 Appendix : Details of the Derivation

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

-
-

4.4 Fixed-node DMC energy

+
+

4.4 Fixed-node DMC energy

Now that we have a process to sample \(\Pi(\mathbf{r},\tau) = @@ -3359,8 +3394,8 @@ energies computed with the trial wave function.

-
-

4.5 Pure Diffusion Monte Carlo (PDMC)

+
+

4.5 Pure Diffusion Monte Carlo (PDMC)

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

-
-

4.6 Hydrogen atom

+
+

4.6 Hydrogen atom

-
-

4.6.1 Exercise

+
+

4.6.1 Exercise

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

-
-
4.6.1.1 Solution   solution
+
+
4.6.1.1 Solution   solution

Python @@ -3734,8 +3769,8 @@ A = 0.98788066666666663 +/- 7.2889356133441110E-005

-
-

4.7 TODO H2

+
+

4.7 TODO H2

We will now consider the H2 molecule in a minimal basis composed of the @@ -3756,8 +3791,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
  • @@ -3773,7 +3808,7 @@ the H\(_2\) molecule at $R$=1.4010 bohr. Answer: 0.17406 a.u.

Author: Anthony Scemama, Claudia Filippi

-

Created: 2021-01-31 Sun 16:02

+

Created: 2021-01-31 Sun 18:17

Validate