1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-12-22 04:15:01 +01:00
This commit is contained in:
scemama 2021-02-04 14:21:15 +00:00
parent dab9e9f1df
commit 8eb79749e8

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-02-04 Thu 12:16 -->
<!-- 2021-02-04 Thu 14:21 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Quantum Monte Carlo</title>
@ -329,116 +329,124 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org2d4858b">1. Introduction</a>
<li><a href="#org929911c">1. Introduction</a>
<ul>
<li><a href="#org2bb99d9">1.1. Energy and local energy</a></li>
<li><a href="#orga2abb91">1.1. Energy and local energy</a></li>
</ul>
</li>
<li><a href="#orgaf2b706">2. Numerical evaluation of the energy of the hydrogen atom</a>
<li><a href="#org1fb2fcb">2. Numerical evaluation of the energy of the hydrogen atom</a>
<ul>
<li><a href="#org310de57">2.1. Local energy</a>
<li><a href="#org389532d">2.1. Local energy</a>
<ul>
<li><a href="#orge3bd6ee">2.1.1. Exercise 1</a>
<li><a href="#org0472b89">2.1.1. Exercise 1</a>
<ul>
<li><a href="#org92133ae">2.1.1.1. Solution</a></li>
<li><a href="#org3bafbca">2.1.1.1. Solution</a></li>
</ul>
</li>
<li><a href="#org1004424">2.1.2. Exercise 2</a>
<li><a href="#orgad48d97">2.1.2. Exercise 2</a>
<ul>
<li><a href="#org406365a">2.1.2.1. Solution</a></li>
<li><a href="#orgf449f06">2.1.2.1. Solution</a></li>
</ul>
</li>
<li><a href="#orgb5ed9f3">2.1.3. Exercise 3</a>
<li><a href="#org965213c">2.1.3. Exercise 3</a>
<ul>
<li><a href="#org40a88e9">2.1.3.1. Solution</a></li>
<li><a href="#org0fe7a9a">2.1.3.1. Solution</a></li>
</ul>
</li>
<li><a href="#orgca98128">2.1.4. Exercise 4</a>
<li><a href="#org8ed5b25">2.1.4. Exercise 4</a>
<ul>
<li><a href="#org9a2dcf7">2.1.4.1. Solution</a></li>
<li><a href="#org1b60e83">2.1.4.1. Solution</a></li>
</ul>
</li>
<li><a href="#org20bf73f">2.1.5. Exercise 5</a>
<li><a href="#orgbfd6da2">2.1.5. Exercise 5</a>
<ul>
<li><a href="#org7156177">2.1.5.1. Solution</a></li>
<li><a href="#org4320ea5">2.1.5.1. Solution</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org621729f">2.2. Plot of the local energy along the \(x\) axis</a>
<li><a href="#org44b3c40">2.2. Plot of the local energy along the \(x\) axis</a>
<ul>
<li><a href="#orgc954334">2.2.1. Exercise</a>
<li><a href="#org838197e">2.2.1. Exercise</a>
<ul>
<li><a href="#org7355b57">2.2.1.1. Solution</a></li>
<li><a href="#org9ce92e4">2.2.1.1. Solution</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orgce31f42">2.3. Numerical estimation of the energy</a>
<li><a href="#org9586528">2.3. Numerical estimation of the energy</a>
<ul>
<li><a href="#org8532bb3">2.3.1. Exercise</a></li>
</ul>
</li>
<li><a href="#orge5403aa">2.4. Variance of the local energy</a>
<li><a href="#org1ac15c2">2.3.1. Exercise</a>
<ul>
<li><a href="#org3fe24c5">2.4.1. Exercise (optional)</a></li>
<li><a href="#org28c25ff">2.4.2. Exercise</a></li>
<li><a href="#orga479ac3">2.3.1.1. Solution</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org0995ab7">3. Variational Monte Carlo</a>
<li><a href="#orgacf6fc5">2.4. Variance of the local energy</a>
<ul>
<li><a href="#org0fda64a">3.1. Computation of the statistical error</a>
<li><a href="#org58436be">2.4.1. Exercise (optional)</a>
<ul>
<li><a href="#orgcef569f">3.1.1. Exercise</a></li>
<li><a href="#org0d03637">2.4.1.1. <span class="done DONE">DONE</span> Solution</a></li>
</ul>
</li>
<li><a href="#org19b1f9f">3.2. Uniform sampling in the box</a>
<li><a href="#orged3345c">2.4.2. Exercise</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org95501a9">3. Variational Monte Carlo</a>
<ul>
<li><a href="#org30badc4">3.2.1. Exercise</a></li>
</ul>
</li>
<li><a href="#org9d355a6">3.3. Metropolis sampling with \(\Psi^2\)</a>
<li><a href="#org1225c45">3.1. Computation of the statistical error</a>
<ul>
<li><a href="#org18230a6">3.3.1. Optimal step size</a></li>
<li><a href="#org2305990">3.3.2. Exercise</a></li>
<li><a href="#org6dbe18d">3.1.1. Exercise</a></li>
</ul>
</li>
<li><a href="#org4709cd2">3.4. Generalized Metropolis algorithm</a>
<li><a href="#orgf6d3040">3.2. Uniform sampling in the box</a>
<ul>
<li><a href="#orga5e3537">3.4.1. Gaussian random number generator</a></li>
<li><a href="#org81e4661">3.4.2. Exercise 1</a></li>
<li><a href="#org30def21">3.4.3. Exercise 2</a></li>
<li><a href="#org4cb0213">3.2.1. Exercise</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org5944aef">4. Diffusion Monte Carlo</a>
<li><a href="#org9992a5c">3.3. Metropolis sampling with \(\Psi^2\)</a>
<ul>
<li><a href="#orgb4b77bc">4.1. Schrödinger equation in imaginary time</a></li>
<li><a href="#orgf635600">4.2. Relation to diffusion</a></li>
<li><a href="#orgfef2607">4.3. Importance sampling</a>
<li><a href="#orga67f9ac">3.3.1. Optimal step size</a></li>
<li><a href="#org5ba7d14">3.3.2. Exercise</a></li>
</ul>
</li>
<li><a href="#org111a1e5">3.4. Generalized Metropolis algorithm</a>
<ul>
<li><a href="#orgc806ce3">4.3.1. Appendix : Details of the Derivation</a></li>
<li><a href="#org40cf0d9">3.4.1. Gaussian random number generator</a></li>
<li><a href="#org360cef1">3.4.2. Exercise 1</a></li>
<li><a href="#orga909007">3.4.3. Exercise 2</a></li>
</ul>
</li>
<li><a href="#org492e1fb">4.4. Pure Diffusion Monte Carlo</a></li>
<li><a href="#org8182495">4.5. Hydrogen atom</a>
</ul>
</li>
<li><a href="#orgb2f6f52">4. Diffusion Monte Carlo</a>
<ul>
<li><a href="#org7e4bd2a">4.5.1. Exercise</a></li>
<li><a href="#org1cc4b9f">4.1. Schrödinger equation in imaginary time</a></li>
<li><a href="#org837b4d0">4.2. Relation to diffusion</a></li>
<li><a href="#org14723a7">4.3. Importance sampling</a>
<ul>
<li><a href="#orgdfdce4c">4.3.1. Appendix : Details of the Derivation</a></li>
</ul>
</li>
<li><a href="#org132ba01">4.4. Pure Diffusion Monte Carlo</a></li>
<li><a href="#orgefdaa89">4.5. Hydrogen atom</a>
<ul>
<li><a href="#org678058c">4.5.1. Exercise</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org6886501">5. Project</a></li>
<li><a href="#org63c3d61">6. Acknowledgments</a></li>
<li><a href="#orgb44f3af">5. Project</a></li>
<li><a href="#orgaa62257">6. Acknowledgments</a></li>
</ul>
</div>
</div>
<div id="outline-container-org2d4858b" class="outline-2">
<h2 id="org2d4858b"><span class="section-number-2">1</span> Introduction</h2>
<div id="outline-container-org929911c" class="outline-2">
<h2 id="org929911c"><span class="section-number-2">1</span> Introduction</h2>
<div class="outline-text-2" id="text-1">
<p>
This website contains the QMC tutorial of the 2021 LTTC winter school
@ -478,8 +486,8 @@ coordinates, etc).
</p>
</div>
<div id="outline-container-org2bb99d9" class="outline-3">
<h3 id="org2bb99d9"><span class="section-number-3">1.1</span> Energy and local energy</h3>
<div id="outline-container-orga2abb91" class="outline-3">
<h3 id="orga2abb91"><span class="section-number-3">1.1</span> Energy and local energy</h3>
<div class="outline-text-3" id="text-1-1">
<p>
For a given system with Hamiltonian \(\hat{H}\) and wave function \(\Psi\), we define the local energy as
@ -562,8 +570,8 @@ energy computed over these configurations:
</div>
</div>
<div id="outline-container-orgaf2b706" class="outline-2">
<h2 id="orgaf2b706"><span class="section-number-2">2</span> Numerical evaluation of the energy of the hydrogen atom</h2>
<div id="outline-container-org1fb2fcb" class="outline-2">
<h2 id="org1fb2fcb"><span class="section-number-2">2</span> Numerical evaluation of the energy of the hydrogen atom</h2>
<div class="outline-text-2" id="text-2">
<p>
In this section, we consider the hydrogen atom with the following
@ -592,8 +600,8 @@ To do that, we will compute the local energy and check whether it is constant.
</p>
</div>
<div id="outline-container-org310de57" class="outline-3">
<h3 id="org310de57"><span class="section-number-3">2.1</span> Local energy</h3>
<div id="outline-container-org389532d" class="outline-3">
<h3 id="org389532d"><span class="section-number-3">2.1</span> Local energy</h3>
<div class="outline-text-3" id="text-2-1">
<p>
You will now program all quantities needed to compute the local energy of the H atom for the given wave function.
@ -620,8 +628,8 @@ to catch the error.
</div>
</div>
<div id="outline-container-orge3bd6ee" class="outline-4">
<h4 id="orge3bd6ee"><span class="section-number-4">2.1.1</span> Exercise 1</h4>
<div id="outline-container-org0472b89" class="outline-4">
<h4 id="org0472b89"><span class="section-number-4">2.1.1</span> Exercise 1</h4>
<div class="outline-text-4" id="text-2-1-1">
<div class="exercise">
<p>
@ -666,8 +674,8 @@ and returns the potential.
</div>
</div>
<div id="outline-container-org92133ae" class="outline-5">
<h5 id="org92133ae"><span class="section-number-5">2.1.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div id="outline-container-org3bafbca" class="outline-5">
<h5 id="org3bafbca"><span class="section-number-5">2.1.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div class="outline-text-5" id="text-2-1-1-1">
<p>
<b>Python</b>
@ -708,8 +716,8 @@ and returns the potential.
</div>
</div>
<div id="outline-container-org1004424" class="outline-4">
<h4 id="org1004424"><span class="section-number-4">2.1.2</span> Exercise 2</h4>
<div id="outline-container-orgad48d97" class="outline-4">
<h4 id="orgad48d97"><span class="section-number-4">2.1.2</span> Exercise 2</h4>
<div class="outline-text-4" id="text-2-1-2">
<div class="exercise">
<p>
@ -744,8 +752,8 @@ input arguments, and returns a scalar.
</div>
</div>
<div id="outline-container-org406365a" class="outline-5">
<h5 id="org406365a"><span class="section-number-5">2.1.2.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div id="outline-container-orgf449f06" class="outline-5">
<h5 id="orgf449f06"><span class="section-number-5">2.1.2.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div class="outline-text-5" id="text-2-1-2-1">
<p>
<b>Python</b>
@ -772,8 +780,8 @@ input arguments, and returns a scalar.
</div>
</div>
<div id="outline-container-orgb5ed9f3" class="outline-4">
<h4 id="orgb5ed9f3"><span class="section-number-4">2.1.3</span> Exercise 3</h4>
<div id="outline-container-org965213c" class="outline-4">
<h4 id="org965213c"><span class="section-number-4">2.1.3</span> Exercise 3</h4>
<div class="outline-text-4" id="text-2-1-3">
<div class="exercise">
<p>
@ -854,8 +862,8 @@ Therefore, the local kinetic energy is
</div>
</div>
<div id="outline-container-org40a88e9" class="outline-5">
<h5 id="org40a88e9"><span class="section-number-5">2.1.3.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div id="outline-container-org0fe7a9a" class="outline-5">
<h5 id="org0fe7a9a"><span class="section-number-5">2.1.3.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div class="outline-text-5" id="text-2-1-3-1">
<p>
<b>Python</b>
@ -896,8 +904,8 @@ Therefore, the local kinetic energy is
</div>
</div>
<div id="outline-container-orgca98128" class="outline-4">
<h4 id="orgca98128"><span class="section-number-4">2.1.4</span> Exercise 4</h4>
<div id="outline-container-org8ed5b25" class="outline-4">
<h4 id="org8ed5b25"><span class="section-number-4">2.1.4</span> Exercise 4</h4>
<div class="outline-text-4" id="text-2-1-4">
<div class="exercise">
<p>
@ -956,8 +964,8 @@ are calling is yours.
</div>
</div>
<div id="outline-container-org9a2dcf7" class="outline-5">
<h5 id="org9a2dcf7"><span class="section-number-5">2.1.4.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div id="outline-container-org1b60e83" class="outline-5">
<h5 id="org1b60e83"><span class="section-number-5">2.1.4.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div class="outline-text-5" id="text-2-1-4-1">
<p>
<b>Python</b>
@ -988,8 +996,8 @@ are calling is yours.
</div>
</div>
<div id="outline-container-org20bf73f" class="outline-4">
<h4 id="org20bf73f"><span class="section-number-4">2.1.5</span> Exercise 5</h4>
<div id="outline-container-orgbfd6da2" class="outline-4">
<h4 id="orgbfd6da2"><span class="section-number-4">2.1.5</span> Exercise 5</h4>
<div class="outline-text-4" id="text-2-1-5">
<div class="exercise">
<p>
@ -999,8 +1007,8 @@ Find the theoretical value of \(a\) for which \(\Psi\) is an eigenfunction of \(
</div>
</div>
<div id="outline-container-org7156177" class="outline-5">
<h5 id="org7156177"><span class="section-number-5">2.1.5.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div id="outline-container-org4320ea5" class="outline-5">
<h5 id="org4320ea5"><span class="section-number-5">2.1.5.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div class="outline-text-5" id="text-2-1-5-1">
\begin{eqnarray*}
E &=& \frac{\hat{H} \Psi}{\Psi} = - \frac{1}{2} \frac{\Delta \Psi}{\Psi} -
@ -1020,8 +1028,8 @@ equal to -0.5 atomic units.
</div>
</div>
<div id="outline-container-org621729f" class="outline-3">
<h3 id="org621729f"><span class="section-number-3">2.2</span> Plot of the local energy along the \(x\) axis</h3>
<div id="outline-container-org44b3c40" class="outline-3">
<h3 id="org44b3c40"><span class="section-number-3">2.2</span> Plot of the local energy along the \(x\) axis</h3>
<div class="outline-text-3" id="text-2-2">
<p>
The program you will write in this section will be written in
@ -1052,8 +1060,8 @@ In Fortran, you will need to compile all the source files together:
</div>
</div>
<div id="outline-container-orgc954334" class="outline-4">
<h4 id="orgc954334"><span class="section-number-4">2.2.1</span> Exercise</h4>
<div id="outline-container-org838197e" class="outline-4">
<h4 id="org838197e"><span class="section-number-4">2.2.1</span> Exercise</h4>
<div class="outline-text-4" id="text-2-2-1">
<div class="exercise">
<p>
@ -1147,8 +1155,8 @@ plot './data' index 0 using 1:2 with lines title 'a=0.1', \
</div>
</div>
<div id="outline-container-org7355b57" class="outline-5">
<h5 id="org7355b57"><span class="section-number-5">2.2.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div id="outline-container-org9ce92e4" class="outline-5">
<h5 id="org9ce92e4"><span class="section-number-5">2.2.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div class="outline-text-5" id="text-2-2-1-1">
<p>
<b>Python</b>
@ -1225,8 +1233,8 @@ plt.savefig(<span style="color: #8b2252;">"plot_py.png"</span>)
</div>
</div>
<div id="outline-container-orgce31f42" class="outline-3">
<h3 id="orgce31f42"><span class="section-number-3">2.3</span> Numerical estimation of the energy</h3>
<div id="outline-container-org9586528" class="outline-3">
<h3 id="org9586528"><span class="section-number-3">2.3</span> Numerical estimation of the energy</h3>
<div class="outline-text-3" id="text-2-3">
<p>
If the space is discretized in small volume elements \(\mathbf{r}_i\)
@ -1256,8 +1264,8 @@ The energy is biased because:
</div>
<div id="outline-container-org8532bb3" class="outline-4">
<h4 id="org8532bb3"><span class="section-number-4">2.3.1</span> Exercise</h4>
<div id="outline-container-org1ac15c2" class="outline-4">
<h4 id="org1ac15c2"><span class="section-number-4">2.3.1</span> Exercise</h4>
<div class="outline-text-4" id="text-2-3-1">
<div class="exercise">
<p>
@ -1324,14 +1332,130 @@ To compile the Fortran and run it:
<div class="org-src-container">
<pre class="src src-sh">gfortran hydrogen.f90 energy_hydrogen.f90 -o energy_hydrogen
./energy_hydrogen
</pre>
</div>
</div>
<div id="outline-container-orga479ac3" class="outline-5">
<h5 id="orga479ac3"><span class="section-number-5">2.3.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div class="outline-text-5" id="text-2-3-1-1">
<p>
<b>Python</b>
</p>
<div class="org-src-container">
<pre class="src src-python">#<span style="color: #b22222;">!/usr/bin/env python3</span>
<span style="color: #a020f0;">import</span> numpy <span style="color: #a020f0;">as</span> np
<span style="color: #a020f0;">from</span> hydrogen <span style="color: #a020f0;">import</span> e_loc, psi
<span style="color: #a0522d;">interval</span> = np.linspace(-5,5,num=50)
<span style="color: #a0522d;">delta</span> = (interval[1]-interval[0])**3
<span style="color: #a0522d;">r</span> = np.array([0.,0.,0.])
<span style="color: #a020f0;">for</span> a <span style="color: #a020f0;">in</span> [0.1, 0.2, 0.5, 0.9, 1., 1.5, 2.]:
<span style="color: #a0522d;">E</span> = 0.
<span style="color: #a0522d;">norm</span> = 0.
<span style="color: #a020f0;">for</span> x <span style="color: #a020f0;">in</span> interval:
<span style="color: #a0522d;">r</span>[0] = x
<span style="color: #a020f0;">for</span> y <span style="color: #a020f0;">in</span> interval:
<span style="color: #a0522d;">r</span>[1] = y
<span style="color: #a020f0;">for</span> z <span style="color: #a020f0;">in</span> interval:
<span style="color: #a0522d;">r</span>[2] = z
<span style="color: #a0522d;">w</span> = psi(a,r)
<span style="color: #a0522d;">w</span> = w * w * delta
<span style="color: #a0522d;">E</span> += w * e_loc(a,r)
<span style="color: #a0522d;">norm</span> += w
<span style="color: #a0522d;">E</span> = E / norm
<span style="color: #a020f0;">print</span>(f<span style="color: #8b2252;">"a = {a} \t E = {E}"</span>)
</pre>
</div>
<pre class="example">
a = 0.1 E = -0.24518438948809218
a = 0.2 E = -0.26966057967803525
a = 0.5 E = -0.3856357612517407
a = 0.9 E = -0.49435709786716214
a = 1.0 E = -0.5
a = 1.5 E = -0.39242967082602226
a = 2.0 E = -0.08086980667844901
</pre>
<p>
<b>Fortran</b>
</p>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">program</span> <span style="color: #0000ff;">energy_hydrogen</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">external</span> ::<span style="color: #a0522d;"> e_loc, psi</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x(50), w, delta, energy, dx, r(3), a(6), norm</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> i, k, l, j</span>
a = (/ 0.1d0, 0.2d0, 0.5d0, 1.d0, 1.5d0, 2.d0 /)
dx = 10.d0/(<span style="color: #a020f0;">size</span>(x)-1)
<span style="color: #a020f0;">do</span> i=1,<span style="color: #a020f0;">size</span>(x)
x(i) = -5.d0 + (i-1)*dx
<span style="color: #a020f0;">end do</span>
delta = dx**3
r(:) = 0.d0
<span style="color: #a020f0;">do</span> j=1,<span style="color: #a020f0;">size</span>(a)
energy = 0.d0
norm = 0.d0
<span style="color: #a020f0;">do</span> i=1,<span style="color: #a020f0;">size</span>(x)
r(1) = x(i)
<span style="color: #a020f0;">do</span> k=1,<span style="color: #a020f0;">size</span>(x)
r(2) = x(k)
<span style="color: #a020f0;">do</span> l=1,<span style="color: #a020f0;">size</span>(x)
r(3) = x(l)
w = psi(a(j),r)
w = w * w * delta
energy = energy + w * e_loc(a(j), r)
norm = norm + w
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
energy = energy / norm
<span style="color: #a020f0;">print</span> *, <span style="color: #8b2252;">'a = '</span>, a(j), <span style="color: #8b2252;">' E = '</span>, energy
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end program</span> <span style="color: #0000ff;">energy_hydrogen</span>
</pre>
</div>
<pre class="example">
a = 0.10000000000000001 E = -0.24518438948809140
a = 0.20000000000000001 E = -0.26966057967803236
a = 0.50000000000000000 E = -0.38563576125173815
a = 1.0000000000000000 E = -0.50000000000000000
a = 1.5000000000000000 E = -0.39242967082602065
a = 2.0000000000000000 E = -8.0869806678448772E-002
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orge5403aa" class="outline-3">
<h3 id="orge5403aa"><span class="section-number-3">2.4</span> Variance of the local energy</h3>
<div id="outline-container-orgacf6fc5" class="outline-3">
<h3 id="orgacf6fc5"><span class="section-number-3">2.4</span> Variance of the local energy</h3>
<div class="outline-text-3" id="text-2-4">
<p>
The variance of the local energy is a functional of \(\Psi\)
@ -1358,8 +1482,8 @@ energy can be used as a measure of the quality of a wave function.
</p>
</div>
<div id="outline-container-org3fe24c5" class="outline-4">
<h4 id="org3fe24c5"><span class="section-number-4">2.4.1</span> Exercise (optional)</h4>
<div id="outline-container-org58436be" class="outline-4">
<h4 id="org58436be"><span class="section-number-4">2.4.1</span> Exercise (optional)</h4>
<div class="outline-text-4" id="text-2-4-1">
<div class="exercise">
<p>
@ -1369,9 +1493,29 @@ Prove that :
</div>
</div>
<div id="outline-container-org0d03637" class="outline-5">
<h5 id="org0d03637"><span class="section-number-5">2.4.1.1</span> <span class="done DONE">DONE</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution2">solution2</span></span></h5>
<div class="outline-text-5" id="text-2-4-1-1">
<p>
\(\bar{E} = \langle E \rangle\) is a constant, so \(\langle \bar{E}
\rangle = \bar{E}\) .
</p>
\begin{eqnarray*}
\langle (E - \bar{E})^2 \rangle & = &
\langle E^2 - 2 E \bar{E} + \bar{E}^2 \rangle \\
&=& \langle E^2 \rangle - 2 \langle E \bar{E} \rangle + \langle \bar{E}^2 \rangle \\
&=& \langle E^2 \rangle - 2 \langle E \rangle \bar{E} + \bar{E}^2 \\
&=& \langle E^2 \rangle - 2 \bar{E}^2 + \bar{E}^2 \\
&=& \langle E^2 \rangle - \bar{E}^2 \\
&=& \langle E^2 \rangle - \langle E \rangle^2 \\
\end{eqnarray*}
</div>
<div id="outline-container-org28c25ff" class="outline-4">
<h4 id="org28c25ff"><span class="section-number-4">2.4.2</span> Exercise</h4>
</div>
</div>
<div id="outline-container-orged3345c" class="outline-4">
<h4 id="orged3345c"><span class="section-number-4">2.4.2</span> Exercise</h4>
<div class="outline-text-4" id="text-2-4-2">
<div class="exercise">
<p>
@ -1450,8 +1594,8 @@ To compile and run:
</div>
</div>
<div id="outline-container-org0995ab7" class="outline-2">
<h2 id="org0995ab7"><span class="section-number-2">3</span> Variational Monte Carlo</h2>
<div id="outline-container-org95501a9" class="outline-2">
<h2 id="org95501a9"><span class="section-number-2">3</span> Variational Monte Carlo</h2>
<div class="outline-text-2" id="text-3">
<p>
Numerical integration with deterministic methods is very efficient
@ -1467,8 +1611,8 @@ interval.
</p>
</div>
<div id="outline-container-org0fda64a" class="outline-3">
<h3 id="org0fda64a"><span class="section-number-3">3.1</span> Computation of the statistical error</h3>
<div id="outline-container-org1225c45" class="outline-3">
<h3 id="org1225c45"><span class="section-number-3">3.1</span> Computation of the statistical error</h3>
<div class="outline-text-3" id="text-3-1">
<p>
To compute the statistical error, you need to perform \(M\)
@ -1508,8 +1652,8 @@ And the confidence interval is given by
</p>
</div>
<div id="outline-container-orgcef569f" class="outline-4">
<h4 id="orgcef569f"><span class="section-number-4">3.1.1</span> Exercise</h4>
<div id="outline-container-org6dbe18d" class="outline-4">
<h4 id="org6dbe18d"><span class="section-number-4">3.1.1</span> Exercise</h4>
<div class="outline-text-4" id="text-3-1-1">
<div class="exercise">
<p>
@ -1551,8 +1695,8 @@ input array.
</div>
</div>
<div id="outline-container-org19b1f9f" class="outline-3">
<h3 id="org19b1f9f"><span class="section-number-3">3.2</span> Uniform sampling in the box</h3>
<div id="outline-container-orgf6d3040" class="outline-3">
<h3 id="orgf6d3040"><span class="section-number-3">3.2</span> Uniform sampling in the box</h3>
<div class="outline-text-3" id="text-3-2">
<p>
We will now perform our first Monte Carlo calculation to compute the
@ -1613,8 +1757,8 @@ compute the statistical error.
</p>
</div>
<div id="outline-container-org30badc4" class="outline-4">
<h4 id="org30badc4"><span class="section-number-4">3.2.1</span> Exercise</h4>
<div id="outline-container-org4cb0213" class="outline-4">
<h4 id="org4cb0213"><span class="section-number-4">3.2.1</span> Exercise</h4>
<div class="outline-text-4" id="text-3-2-1">
<div class="exercise">
<p>
@ -1718,8 +1862,8 @@ well as the index of the current step.
</div>
</div>
<div id="outline-container-org9d355a6" class="outline-3">
<h3 id="org9d355a6"><span class="section-number-3">3.3</span> Metropolis sampling with \(\Psi^2\)</h3>
<div id="outline-container-org9992a5c" class="outline-3">
<h3 id="org9992a5c"><span class="section-number-3">3.3</span> Metropolis sampling with \(\Psi^2\)</h3>
<div class="outline-text-3" id="text-3-3">
<p>
We will now use the square of the wave function to sample random
@ -1838,8 +1982,8 @@ All samples should be kept, from both accepted <i>and</i> rejected moves.
</div>
<div id="outline-container-org18230a6" class="outline-4">
<h4 id="org18230a6"><span class="section-number-4">3.3.1</span> Optimal step size</h4>
<div id="outline-container-orga67f9ac" class="outline-4">
<h4 id="orga67f9ac"><span class="section-number-4">3.3.1</span> Optimal step size</h4>
<div class="outline-text-4" id="text-3-3-1">
<p>
If the box is infinitely small, the ratio will be very close
@ -1874,8 +2018,8 @@ the same variable later on to store a time step.
</div>
<div id="outline-container-org2305990" class="outline-4">
<h4 id="org2305990"><span class="section-number-4">3.3.2</span> Exercise</h4>
<div id="outline-container-org5ba7d14" class="outline-4">
<h4 id="org5ba7d14"><span class="section-number-4">3.3.2</span> Exercise</h4>
<div class="outline-text-4" id="text-3-3-2">
<div class="exercise">
<p>
@ -1986,8 +2130,8 @@ Can you observe a reduction in the statistical error?
</div>
</div>
<div id="outline-container-org4709cd2" class="outline-3">
<h3 id="org4709cd2"><span class="section-number-3">3.4</span> Generalized Metropolis algorithm</h3>
<div id="outline-container-org111a1e5" class="outline-3">
<h3 id="org111a1e5"><span class="section-number-3">3.4</span> Generalized Metropolis algorithm</h3>
<div class="outline-text-3" id="text-3-4">
<p>
One can use more efficient numerical schemes to move the electrons by choosing a smarter expression for the transition probability.
@ -2108,8 +2252,8 @@ The algorithm of the previous exercise is only slighlty modified as:
</ol>
</div>
<div id="outline-container-orga5e3537" class="outline-4">
<h4 id="orga5e3537"><span class="section-number-4">3.4.1</span> Gaussian random number generator</h4>
<div id="outline-container-org40cf0d9" class="outline-4">
<h4 id="org40cf0d9"><span class="section-number-4">3.4.1</span> Gaussian random number generator</h4>
<div class="outline-text-4" id="text-3-4-1">
<p>
To obtain Gaussian-distributed random numbers, you can apply the
@ -2173,8 +2317,8 @@ In Python, you can use the <a href="https://numpy.org/doc/stable/reference/rando
</div>
<div id="outline-container-org81e4661" class="outline-4">
<h4 id="org81e4661"><span class="section-number-4">3.4.2</span> Exercise 1</h4>
<div id="outline-container-org360cef1" class="outline-4">
<h4 id="org360cef1"><span class="section-number-4">3.4.2</span> Exercise 1</h4>
<div class="outline-text-4" id="text-3-4-2">
<div class="exercise">
<p>
@ -2217,8 +2361,8 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P
</div>
</div>
<div id="outline-container-org30def21" class="outline-4">
<h4 id="org30def21"><span class="section-number-4">3.4.3</span> Exercise 2</h4>
<div id="outline-container-orga909007" class="outline-4">
<h4 id="orga909007"><span class="section-number-4">3.4.3</span> Exercise 2</h4>
<div class="outline-text-4" id="text-3-4-3">
<div class="exercise">
<p>
@ -2317,8 +2461,8 @@ Modify the previous program to introduce the drift-diffusion scheme.
</div>
</div>
<div id="outline-container-org5944aef" class="outline-2">
<h2 id="org5944aef"><span class="section-number-2">4</span> Diffusion Monte Carlo</h2>
<div id="outline-container-orgb2f6f52" class="outline-2">
<h2 id="orgb2f6f52"><span class="section-number-2">4</span> Diffusion Monte Carlo</h2>
<div class="outline-text-2" id="text-4">
<p>
As we have seen, Variational Monte Carlo is a powerful method to
@ -2335,8 +2479,8 @@ finding a near-exact numerical solution to the Schrödinger equation.
</p>
</div>
<div id="outline-container-orgb4b77bc" class="outline-3">
<h3 id="orgb4b77bc"><span class="section-number-3">4.1</span> Schrödinger equation in imaginary time</h3>
<div id="outline-container-org1cc4b9f" class="outline-3">
<h3 id="org1cc4b9f"><span class="section-number-3">4.1</span> Schrödinger equation in imaginary time</h3>
<div class="outline-text-3" id="text-4-1">
<p>
Consider the time-dependent Schrödinger equation:
@ -2404,8 +2548,8 @@ system.
</div>
</div>
<div id="outline-container-orgf635600" class="outline-3">
<h3 id="orgf635600"><span class="section-number-3">4.2</span> Relation to diffusion</h3>
<div id="outline-container-org837b4d0" class="outline-3">
<h3 id="org837b4d0"><span class="section-number-3">4.2</span> Relation to diffusion</h3>
<div class="outline-text-3" id="text-4-2">
<p>
The <a href="https://en.wikipedia.org/wiki/Diffusion_equation">diffusion equation</a> of particles is given by
@ -2485,8 +2629,8 @@ Therefore, in both cases, you are dealing with a "Bosonic" ground state.
</div>
</div>
<div id="outline-container-orgfef2607" class="outline-3">
<h3 id="orgfef2607"><span class="section-number-3">4.3</span> Importance sampling</h3>
<div id="outline-container-org14723a7" class="outline-3">
<h3 id="org14723a7"><span class="section-number-3">4.3</span> Importance sampling</h3>
<div class="outline-text-3" id="text-4-3">
<p>
In a molecular system, the potential is far from being constant
@ -2584,8 +2728,8 @@ energies computed with the trial wave function.
</p>
</div>
<div id="outline-container-orgc806ce3" class="outline-4">
<h4 id="orgc806ce3"><span class="section-number-4">4.3.1</span> Appendix : Details of the Derivation</h4>
<div id="outline-container-orgdfdce4c" class="outline-4">
<h4 id="orgdfdce4c"><span class="section-number-4">4.3.1</span> Appendix : Details of the Derivation</h4>
<div class="outline-text-4" id="text-4-3-1">
<p>
\[
@ -2646,8 +2790,8 @@ Defining \(\Pi(\mathbf{r},t) = \psi(\mathbf{r},\tau)
</div>
</div>
<div id="outline-container-org492e1fb" class="outline-3">
<h3 id="org492e1fb"><span class="section-number-3">4.4</span> Pure Diffusion Monte Carlo</h3>
<div id="outline-container-org132ba01" class="outline-3">
<h3 id="org132ba01"><span class="section-number-3">4.4</span> Pure Diffusion Monte Carlo</h3>
<div class="outline-text-3" id="text-4-4">
<p>
Instead of having a variable number of particles to simulate the
@ -2736,13 +2880,13 @@ the DMC algorithm. However, its use reduces significantly the time-step error.</
</div>
<div id="outline-container-org8182495" class="outline-3">
<h3 id="org8182495"><span class="section-number-3">4.5</span> Hydrogen atom</h3>
<div id="outline-container-orgefdaa89" class="outline-3">
<h3 id="orgefdaa89"><span class="section-number-3">4.5</span> Hydrogen atom</h3>
<div class="outline-text-3" id="text-4-5">
</div>
<div id="outline-container-org7e4bd2a" class="outline-4">
<h4 id="org7e4bd2a"><span class="section-number-4">4.5.1</span> Exercise</h4>
<div id="outline-container-org678058c" class="outline-4">
<h4 id="org678058c"><span class="section-number-4">4.5.1</span> Exercise</h4>
<div class="outline-text-4" id="text-4-5-1">
<div class="exercise">
<p>
@ -2849,8 +2993,8 @@ time \(\tau\) =100 a.u.
<div id="outline-container-org6886501" class="outline-2">
<h2 id="org6886501"><span class="section-number-2">5</span> Project</h2>
<div id="outline-container-orgb44f3af" class="outline-2">
<h2 id="orgb44f3af"><span class="section-number-2">5</span> Project</h2>
<div class="outline-text-2" id="text-5">
<p>
Change your PDMC code for one of the following:
@ -2867,8 +3011,8 @@ And compute the ground state energy.
</div>
<div id="outline-container-org63c3d61" class="outline-2">
<h2 id="org63c3d61"><span class="section-number-2">6</span> Acknowledgments</h2>
<div id="outline-container-orgaa62257" class="outline-2">
<h2 id="orgaa62257"><span class="section-number-2">6</span> Acknowledgments</h2>
<div class="outline-text-2" id="text-6">
<div class="figure">
@ -2888,7 +3032,7 @@ Union is not responsible for any use that might be made of such content.
</div>
<div id="postamble" class="status">
<p class="author">Author: Anthony Scemama, Claudia Filippi</p>
<p class="date">Created: 2021-02-04 Thu 12:16</p>
<p class="date">Created: 2021-02-04 Thu 14:21</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>