1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-12-22 20:36:15 +01:00
This commit is contained in:
filippi-claudia 2021-01-31 09:26:21 +00:00
parent e9af1da114
commit b2d4337e07

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head> <head>
<!-- 2021-01-31 Sun 08:40 --> <!-- 2021-01-31 Sun 09:26 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Quantum Monte Carlo</title> <title>Quantum Monte Carlo</title>
@ -329,152 +329,152 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2> <h2>Table of Contents</h2>
<div id="text-table-of-contents"> <div id="text-table-of-contents">
<ul> <ul>
<li><a href="#org0a42dc6">1. Introduction</a> <li><a href="#orgda3f50b">1. Introduction</a>
<ul> <ul>
<li><a href="#org6174a0a">1.1. Energy and local energy</a></li> <li><a href="#org036e966">1.1. Energy and local energy</a></li>
</ul> </ul>
</li> </li>
<li><a href="#orge35e3b0">2. Numerical evaluation of the energy of the hydrogen atom</a> <li><a href="#orgc590c55">2. Numerical evaluation of the energy of the hydrogen atom</a>
<ul> <ul>
<li><a href="#org536ab35">2.1. Local energy</a> <li><a href="#org18ff41d">2.1. Local energy</a>
<ul> <ul>
<li><a href="#orge1d3531">2.1.1. Exercise 1</a> <li><a href="#org683e4e2">2.1.1. Exercise 1</a>
<ul> <ul>
<li><a href="#orge29b2d5">2.1.1.1. Solution</a></li> <li><a href="#org3f5fc9d">2.1.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org0082181">2.1.2. Exercise 2</a> <li><a href="#orgc407b41">2.1.2. Exercise 2</a>
<ul> <ul>
<li><a href="#orgcb5ffb6">2.1.2.1. Solution</a></li> <li><a href="#org9104fc1">2.1.2.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org950428b">2.1.3. Exercise 3</a> <li><a href="#orgb70d960">2.1.3. Exercise 3</a>
<ul> <ul>
<li><a href="#orgb3b7bff">2.1.3.1. Solution</a></li> <li><a href="#org77aed71">2.1.3.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#orgd1768b7">2.1.4. Exercise 4</a> <li><a href="#org7ae5fd2">2.1.4. Exercise 4</a>
<ul> <ul>
<li><a href="#orgca62f3b">2.1.4.1. Solution</a></li> <li><a href="#orgc9c223c">2.1.4.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#orgd9f5f66">2.1.5. Exercise 5</a> <li><a href="#org9fad9d8">2.1.5. Exercise 5</a>
<ul> <ul>
<li><a href="#org1e5b04a">2.1.5.1. Solution</a></li> <li><a href="#org6035a20">2.1.5.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org8d93b3a">2.2. Plot of the local energy along the \(x\) axis</a> <li><a href="#org541ad7b">2.2. Plot of the local energy along the \(x\) axis</a>
<ul> <ul>
<li><a href="#org73c7953">2.2.1. Exercise</a> <li><a href="#org6fe4366">2.2.1. Exercise</a>
<ul> <ul>
<li><a href="#org0fcc683">2.2.1.1. Solution</a></li> <li><a href="#org3f1245c">2.2.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org997c814">2.3. Numerical estimation of the energy</a> <li><a href="#org887fd3f">2.3. Numerical estimation of the energy</a>
<ul> <ul>
<li><a href="#org7a24d0a">2.3.1. Exercise</a> <li><a href="#org9274039">2.3.1. Exercise</a>
<ul> <ul>
<li><a href="#org44d22a3">2.3.1.1. Solution</a></li> <li><a href="#org451ad90">2.3.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org361114f">2.4. Variance of the local energy</a> <li><a href="#org276e07e">2.4. Variance of the local energy</a>
<ul> <ul>
<li><a href="#org2c40196">2.4.1. Exercise (optional)</a> <li><a href="#org43e53cc">2.4.1. Exercise (optional)</a>
<ul> <ul>
<li><a href="#orgbecaeef">2.4.1.1. Solution</a></li> <li><a href="#org38d9972">2.4.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#orgf1e8e3d">2.4.2. Exercise</a> <li><a href="#org733ec8a">2.4.2. Exercise</a>
<ul> <ul>
<li><a href="#org8fc9a13">2.4.2.1. Solution</a></li> <li><a href="#org739fa49">2.4.2.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org7aa6a0a">3. Variational Monte Carlo</a> <li><a href="#org81347ce">3. Variational Monte Carlo</a>
<ul> <ul>
<li><a href="#org2087616">3.1. Computation of the statistical error</a> <li><a href="#orgd013ab9">3.1. Computation of the statistical error</a>
<ul> <ul>
<li><a href="#orgaeae4c2">3.1.1. Exercise</a> <li><a href="#org32ca3c3">3.1.1. Exercise</a>
<ul> <ul>
<li><a href="#orgdfc7b53">3.1.1.1. Solution</a></li> <li><a href="#orgebeb146">3.1.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#orge7d91c3">3.2. Uniform sampling in the box</a> <li><a href="#orgb2a9889">3.2. Uniform sampling in the box</a>
<ul> <ul>
<li><a href="#org96d1bb2">3.2.1. Exercise</a> <li><a href="#org4e6a1f7">3.2.1. Exercise</a>
<ul> <ul>
<li><a href="#orgc8c3acf">3.2.1.1. Solution</a></li> <li><a href="#orgbffcbab">3.2.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org0e66655">3.3. Metropolis sampling with \(\Psi^2\)</a> <li><a href="#org0733fed">3.3. Metropolis sampling with \(\Psi^2\)</a>
<ul> <ul>
<li><a href="#org9692143">3.3.1. Exercise</a> <li><a href="#org0c0af3c">3.3.1. Exercise</a>
<ul> <ul>
<li><a href="#org88f43cd">3.3.1.1. Solution</a></li> <li><a href="#org6c72dc3">3.3.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org6c65f73">3.4. Gaussian random number generator</a></li> <li><a href="#orga0b0b8d">3.4. Gaussian random number generator</a></li>
<li><a href="#org70ec84a">3.5. Generalized Metropolis algorithm</a> <li><a href="#org57a608a">3.5. Generalized Metropolis algorithm</a>
<ul> <ul>
<li><a href="#org6e34709">3.5.1. Exercise 1</a> <li><a href="#orgaa87988">3.5.1. Exercise 1</a>
<ul> <ul>
<li><a href="#orgcf485b0">3.5.1.1. Solution</a></li> <li><a href="#orgf391a29">3.5.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#orge3ee834">3.5.2. Exercise 2</a> <li><a href="#org6abfe47">3.5.2. Exercise 2</a>
<ul> <ul>
<li><a href="#org2d51c0d">3.5.2.1. Solution</a></li> <li><a href="#org53b5631">3.5.2.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org58ca27b">4. Diffusion Monte Carlo</a> <li><a href="#org5f1d81b">4. Diffusion Monte Carlo</a>
<ul> <ul>
<li><a href="#orgde86ff6">4.1. Schrödinger equation in imaginary time</a></li> <li><a href="#org95ab9cd">4.1. Schrödinger equation in imaginary time</a></li>
<li><a href="#org02ca0c2">4.2. Diffusion and branching</a></li> <li><a href="#org9fcbab9">4.2. Diffusion and branching</a></li>
<li><a href="#org1a44a46">4.3. Importance sampling</a> <li><a href="#org0aba1e8">4.3. Importance sampling</a>
<ul> <ul>
<li><a href="#org25d9eba">4.3.1. Appendix : Details of the Derivation</a></li> <li><a href="#orgcc09947">4.3.1. Appendix : Details of the Derivation</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org4206909">4.4. Fixed-node DMC energy</a></li> <li><a href="#org2f26efe">4.4. Fixed-node DMC energy</a></li>
<li><a href="#orgbc4844d">4.5. Pure Diffusion Monte Carlo (PDMC)</a></li> <li><a href="#orgfc317d3">4.5. Pure Diffusion Monte Carlo (PDMC)</a></li>
<li><a href="#org0e0bf5c">4.6. Hydrogen atom</a> <li><a href="#orgf410952">4.6. Hydrogen atom</a>
<ul> <ul>
<li><a href="#org044109b">4.6.1. Exercise</a> <li><a href="#org5899d68">4.6.1. Exercise</a>
<ul> <ul>
<li><a href="#orgf0ab8a1">4.6.1.1. Solution</a></li> <li><a href="#orge0716bd">4.6.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#orgce119bb">4.7. <span class="todo TODO">TODO</span> H<sub>2</sub></a></li> <li><a href="#org5e287d8">4.7. <span class="todo TODO">TODO</span> H<sub>2</sub></a></li>
</ul> </ul>
</li> </li>
<li><a href="#org02606e3">5. <span class="todo TODO">TODO</span> <code>[0/3]</code> Last things to do</a></li> <li><a href="#org17d4d49">5. <span class="todo TODO">TODO</span> <code>[0/3]</code> Last things to do</a></li>
</ul> </ul>
</div> </div>
</div> </div>
<div id="outline-container-org0a42dc6" class="outline-2"> <div id="outline-container-orgda3f50b" class="outline-2">
<h2 id="org0a42dc6"><span class="section-number-2">1</span> Introduction</h2> <h2 id="orgda3f50b"><span class="section-number-2">1</span> Introduction</h2>
<div class="outline-text-2" id="text-1"> <div class="outline-text-2" id="text-1">
<p> <p>
This website contains the QMC tutorial of the 2021 LTTC winter school This website contains the QMC tutorial of the 2021 LTTC winter school
@ -514,8 +514,8 @@ coordinates, etc).
</p> </p>
</div> </div>
<div id="outline-container-org6174a0a" class="outline-3"> <div id="outline-container-org036e966" class="outline-3">
<h3 id="org6174a0a"><span class="section-number-3">1.1</span> Energy and local energy</h3> <h3 id="org036e966"><span class="section-number-3">1.1</span> Energy and local energy</h3>
<div class="outline-text-3" id="text-1-1"> <div class="outline-text-3" id="text-1-1">
<p> <p>
For a given system with Hamiltonian \(\hat{H}\) and wave function \(\Psi\), we define the local energy as For a given system with Hamiltonian \(\hat{H}\) and wave function \(\Psi\), we define the local energy as
@ -593,8 +593,8 @@ $$ E &asymp; \frac{1}{N<sub>\rm MC</sub>} &sum;<sub>i=1</sub><sup>N<sub>\rm MC</
</div> </div>
</div> </div>
<div id="outline-container-orge35e3b0" class="outline-2"> <div id="outline-container-orgc590c55" class="outline-2">
<h2 id="orge35e3b0"><span class="section-number-2">2</span> Numerical evaluation of the energy of the hydrogen atom</h2> <h2 id="orgc590c55"><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"> <div class="outline-text-2" id="text-2">
<p> <p>
In this section, we consider the hydrogen atom with the following 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.
</p> </p>
</div> </div>
<div id="outline-container-org536ab35" class="outline-3"> <div id="outline-container-org18ff41d" class="outline-3">
<h3 id="org536ab35"><span class="section-number-3">2.1</span> Local energy</h3> <h3 id="org18ff41d"><span class="section-number-3">2.1</span> Local energy</h3>
<div class="outline-text-3" id="text-2-1"> <div class="outline-text-3" id="text-2-1">
<p> <p>
You will now program all quantities needed to compute the local energy of the H atom for the given wave function. 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.
</div> </div>
</div> </div>
<div id="outline-container-orge1d3531" class="outline-4"> <div id="outline-container-org683e4e2" class="outline-4">
<h4 id="orge1d3531"><span class="section-number-4">2.1.1</span> Exercise 1</h4> <h4 id="org683e4e2"><span class="section-number-4">2.1.1</span> Exercise 1</h4>
<div class="outline-text-4" id="text-2-1-1"> <div class="outline-text-4" id="text-2-1-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -696,8 +696,8 @@ and returns the potential.
</div> </div>
</div> </div>
<div id="outline-container-orge29b2d5" class="outline-5"> <div id="outline-container-org3f5fc9d" class="outline-5">
<h5 id="orge29b2d5"><span class="section-number-5">2.1.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org3f5fc9d"><span class="section-number-5">2.1.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-1-1-1"> <div class="outline-text-5" id="text-2-1-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -737,8 +737,8 @@ and returns the potential.
</div> </div>
</div> </div>
<div id="outline-container-org0082181" class="outline-4"> <div id="outline-container-orgc407b41" class="outline-4">
<h4 id="org0082181"><span class="section-number-4">2.1.2</span> Exercise 2</h4> <h4 id="orgc407b41"><span class="section-number-4">2.1.2</span> Exercise 2</h4>
<div class="outline-text-4" id="text-2-1-2"> <div class="outline-text-4" id="text-2-1-2">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -773,8 +773,8 @@ input arguments, and returns a scalar.
</div> </div>
</div> </div>
<div id="outline-container-orgcb5ffb6" class="outline-5"> <div id="outline-container-org9104fc1" class="outline-5">
<h5 id="orgcb5ffb6"><span class="section-number-5">2.1.2.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org9104fc1"><span class="section-number-5">2.1.2.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-1-2-1"> <div class="outline-text-5" id="text-2-1-2-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -801,8 +801,8 @@ input arguments, and returns a scalar.
</div> </div>
</div> </div>
<div id="outline-container-org950428b" class="outline-4"> <div id="outline-container-orgb70d960" class="outline-4">
<h4 id="org950428b"><span class="section-number-4">2.1.3</span> Exercise 3</h4> <h4 id="orgb70d960"><span class="section-number-4">2.1.3</span> Exercise 3</h4>
<div class="outline-text-4" id="text-2-1-3"> <div class="outline-text-4" id="text-2-1-3">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -883,8 +883,8 @@ Therefore, the local kinetic energy is
</div> </div>
</div> </div>
<div id="outline-container-orgb3b7bff" class="outline-5"> <div id="outline-container-org77aed71" class="outline-5">
<h5 id="orgb3b7bff"><span class="section-number-5">2.1.3.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org77aed71"><span class="section-number-5">2.1.3.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-1-3-1"> <div class="outline-text-5" id="text-2-1-3-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -925,8 +925,8 @@ Therefore, the local kinetic energy is
</div> </div>
</div> </div>
<div id="outline-container-orgd1768b7" class="outline-4"> <div id="outline-container-org7ae5fd2" class="outline-4">
<h4 id="orgd1768b7"><span class="section-number-4">2.1.4</span> Exercise 4</h4> <h4 id="org7ae5fd2"><span class="section-number-4">2.1.4</span> Exercise 4</h4>
<div class="outline-text-4" id="text-2-1-4"> <div class="outline-text-4" id="text-2-1-4">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -969,8 +969,8 @@ local kinetic energy.
</div> </div>
</div> </div>
<div id="outline-container-orgca62f3b" class="outline-5"> <div id="outline-container-orgc9c223c" class="outline-5">
<h5 id="orgca62f3b"><span class="section-number-5">2.1.4.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="orgc9c223c"><span class="section-number-5">2.1.4.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-1-4-1"> <div class="outline-text-5" id="text-2-1-4-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -1000,8 +1000,8 @@ local kinetic energy.
</div> </div>
</div> </div>
<div id="outline-container-orgd9f5f66" class="outline-4"> <div id="outline-container-org9fad9d8" class="outline-4">
<h4 id="orgd9f5f66"><span class="section-number-4">2.1.5</span> Exercise 5</h4> <h4 id="org9fad9d8"><span class="section-number-4">2.1.5</span> Exercise 5</h4>
<div class="outline-text-4" id="text-2-1-5"> <div class="outline-text-4" id="text-2-1-5">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -1011,8 +1011,8 @@ Find the theoretical value of \(a\) for which \(\Psi\) is an eigenfunction of \(
</div> </div>
</div> </div>
<div id="outline-container-org1e5b04a" class="outline-5"> <div id="outline-container-org6035a20" class="outline-5">
<h5 id="org1e5b04a"><span class="section-number-5">2.1.5.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org6035a20"><span class="section-number-5">2.1.5.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-1-5-1"> <div class="outline-text-5" id="text-2-1-5-1">
\begin{eqnarray*} \begin{eqnarray*}
E &=& \frac{\hat{H} \Psi}{\Psi} = - \frac{1}{2} \frac{\Delta \Psi}{\Psi} - E &=& \frac{\hat{H} \Psi}{\Psi} = - \frac{1}{2} \frac{\Delta \Psi}{\Psi} -
@ -1032,8 +1032,8 @@ equal to -0.5 atomic units.
</div> </div>
</div> </div>
<div id="outline-container-org8d93b3a" class="outline-3"> <div id="outline-container-org541ad7b" class="outline-3">
<h3 id="org8d93b3a"><span class="section-number-3">2.2</span> Plot of the local energy along the \(x\) axis</h3> <h3 id="org541ad7b"><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"> <div class="outline-text-3" id="text-2-2">
<div class="note"> <div class="note">
<p> <p>
@ -1044,8 +1044,8 @@ choose a grid which does not contain the origin.
</div> </div>
</div> </div>
<div id="outline-container-org73c7953" class="outline-4"> <div id="outline-container-org6fe4366" class="outline-4">
<h4 id="org73c7953"><span class="section-number-4">2.2.1</span> Exercise</h4> <h4 id="org6fe4366"><span class="section-number-4">2.2.1</span> Exercise</h4>
<div class="outline-text-4" id="text-2-2-1"> <div class="outline-text-4" id="text-2-2-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -1128,8 +1128,8 @@ plot './data' index 0 using 1:2 with lines title 'a=0.1', \
</div> </div>
</div> </div>
<div id="outline-container-org0fcc683" class="outline-5"> <div id="outline-container-org3f1245c" class="outline-5">
<h5 id="org0fcc683"><span class="section-number-5">2.2.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org3f1245c"><span class="section-number-5">2.2.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-2-1-1"> <div class="outline-text-5" id="text-2-2-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -1204,8 +1204,8 @@ plt.savefig(<span style="color: #8b2252;">"plot_py.png"</span>)
</div> </div>
</div> </div>
<div id="outline-container-org997c814" class="outline-3"> <div id="outline-container-org887fd3f" class="outline-3">
<h3 id="org997c814"><span class="section-number-3">2.3</span> Numerical estimation of the energy</h3> <h3 id="org887fd3f"><span class="section-number-3">2.3</span> Numerical estimation of the energy</h3>
<div class="outline-text-3" id="text-2-3"> <div class="outline-text-3" id="text-2-3">
<p> <p>
If the space is discretized in small volume elements \(\mathbf{r}_i\) If the space is discretized in small volume elements \(\mathbf{r}_i\)
@ -1235,8 +1235,8 @@ The energy is biased because:
</div> </div>
<div id="outline-container-org7a24d0a" class="outline-4"> <div id="outline-container-org9274039" class="outline-4">
<h4 id="org7a24d0a"><span class="section-number-4">2.3.1</span> Exercise</h4> <h4 id="org9274039"><span class="section-number-4">2.3.1</span> Exercise</h4>
<div class="outline-text-4" id="text-2-3-1"> <div class="outline-text-4" id="text-2-3-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -1305,8 +1305,8 @@ To compile the Fortran and run it:
</div> </div>
</div> </div>
<div id="outline-container-org44d22a3" class="outline-5"> <div id="outline-container-org451ad90" class="outline-5">
<h5 id="org44d22a3"><span class="section-number-5">2.3.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org451ad90"><span class="section-number-5">2.3.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-3-1-1"> <div class="outline-text-5" id="text-2-3-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -1421,8 +1421,8 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002
</div> </div>
</div> </div>
<div id="outline-container-org361114f" class="outline-3"> <div id="outline-container-org276e07e" class="outline-3">
<h3 id="org361114f"><span class="section-number-3">2.4</span> Variance of the local energy</h3> <h3 id="org276e07e"><span class="section-number-3">2.4</span> Variance of the local energy</h3>
<div class="outline-text-3" id="text-2-4"> <div class="outline-text-3" id="text-2-4">
<p> <p>
The variance of the local energy is a functional of \(\Psi\) 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.
</p> </p>
</div> </div>
<div id="outline-container-org2c40196" class="outline-4"> <div id="outline-container-org43e53cc" class="outline-4">
<h4 id="org2c40196"><span class="section-number-4">2.4.1</span> Exercise (optional)</h4> <h4 id="org43e53cc"><span class="section-number-4">2.4.1</span> Exercise (optional)</h4>
<div class="outline-text-4" id="text-2-4-1"> <div class="outline-text-4" id="text-2-4-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -1461,8 +1461,8 @@ Prove that :
</div> </div>
</div> </div>
<div id="outline-container-orgbecaeef" class="outline-5"> <div id="outline-container-org38d9972" class="outline-5">
<h5 id="orgbecaeef"><span class="section-number-5">2.4.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org38d9972"><span class="section-number-5">2.4.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-4-1-1"> <div class="outline-text-5" id="text-2-4-1-1">
<p> <p>
\(\bar{E} = \langle E \rangle\) is a constant, so \(\langle \bar{E} \(\bar{E} = \langle E \rangle\) is a constant, so \(\langle \bar{E}
@ -1481,8 +1481,8 @@ Prove that :
</div> </div>
</div> </div>
</div> </div>
<div id="outline-container-orgf1e8e3d" class="outline-4"> <div id="outline-container-org733ec8a" class="outline-4">
<h4 id="orgf1e8e3d"><span class="section-number-4">2.4.2</span> Exercise</h4> <h4 id="org733ec8a"><span class="section-number-4">2.4.2</span> Exercise</h4>
<div class="outline-text-4" id="text-2-4-2"> <div class="outline-text-4" id="text-2-4-2">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -1556,8 +1556,8 @@ To compile and run:
</div> </div>
</div> </div>
<div id="outline-container-org8fc9a13" class="outline-5"> <div id="outline-container-org739fa49" class="outline-5">
<h5 id="org8fc9a13"><span class="section-number-5">2.4.2.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org739fa49"><span class="section-number-5">2.4.2.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-2-4-2-1"> <div class="outline-text-5" id="text-2-4-2-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -1694,8 +1694,8 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002 s2 = 1.8068814
</div> </div>
</div> </div>
<div id="outline-container-org7aa6a0a" class="outline-2"> <div id="outline-container-org81347ce" class="outline-2">
<h2 id="org7aa6a0a"><span class="section-number-2">3</span> Variational Monte Carlo</h2> <h2 id="org81347ce"><span class="section-number-2">3</span> Variational Monte Carlo</h2>
<div class="outline-text-2" id="text-3"> <div class="outline-text-2" id="text-3">
<p> <p>
Numerical integration with deterministic methods is very efficient Numerical integration with deterministic methods is very efficient
@ -1711,8 +1711,8 @@ interval.
</p> </p>
</div> </div>
<div id="outline-container-org2087616" class="outline-3"> <div id="outline-container-orgd013ab9" class="outline-3">
<h3 id="org2087616"><span class="section-number-3">3.1</span> Computation of the statistical error</h3> <h3 id="orgd013ab9"><span class="section-number-3">3.1</span> Computation of the statistical error</h3>
<div class="outline-text-3" id="text-3-1"> <div class="outline-text-3" id="text-3-1">
<p> <p>
To compute the statistical error, you need to perform \(M\) To compute the statistical error, you need to perform \(M\)
@ -1752,8 +1752,8 @@ And the confidence interval is given by
</p> </p>
</div> </div>
<div id="outline-container-orgaeae4c2" class="outline-4"> <div id="outline-container-org32ca3c3" class="outline-4">
<h4 id="orgaeae4c2"><span class="section-number-4">3.1.1</span> Exercise</h4> <h4 id="org32ca3c3"><span class="section-number-4">3.1.1</span> Exercise</h4>
<div class="outline-text-4" id="text-3-1-1"> <div class="outline-text-4" id="text-3-1-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -1791,8 +1791,8 @@ input array.
</div> </div>
</div> </div>
<div id="outline-container-orgdfc7b53" class="outline-5"> <div id="outline-container-orgebeb146" class="outline-5">
<h5 id="orgdfc7b53"><span class="section-number-5">3.1.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="orgebeb146"><span class="section-number-5">3.1.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-3-1-1-1"> <div class="outline-text-5" id="text-3-1-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -1851,8 +1851,8 @@ input array.
</div> </div>
</div> </div>
<div id="outline-container-orge7d91c3" class="outline-3"> <div id="outline-container-orgb2a9889" class="outline-3">
<h3 id="orge7d91c3"><span class="section-number-3">3.2</span> Uniform sampling in the box</h3> <h3 id="orgb2a9889"><span class="section-number-3">3.2</span> Uniform sampling in the box</h3>
<div class="outline-text-3" id="text-3-2"> <div class="outline-text-3" id="text-3-2">
<p> <p>
We will now perform our first Monte Carlo calculation to compute the We will now perform our first Monte Carlo calculation to compute the
@ -1872,15 +1872,15 @@ Clearly, the square of the wave function is a good choice of probability density
</p> </p>
\begin{eqnarray*} \begin{eqnarray*}
E & = & \frac{\int E_L(\mathbf{r})\frac{|\Psi(\mathbf{r})|^2}{p(\mathbf{r})}p(\mathbf{r})\, \,d\mathbf{r}}{\int \frac{|\Psi(\mathbf{r})|^2 }{p(\mathbf{r})}p(\mathbf{r})d\mathbf{r}}\,. E & = & \frac{\int E_L(\mathbf{r})\frac{|\Psi(\mathbf{r})|^2}{P(\mathbf{r})}P(\mathbf{r})\, \,d\mathbf{r}}{\int \frac{|\Psi(\mathbf{r})|^2 }{P(\mathbf{r})}P(\mathbf{r})d\mathbf{r}}\,.
\end{eqnarray*} \end{eqnarray*}
<p> <p>
Here, we will sample a uniform probability \(p(\mathbf{r})\) in a cube of volume \(L^3\) centered at the origin: Here, we will sample a uniform probability \(P(\mathbf{r})\) in a cube of volume \(L^3\) centered at the origin:
</p> </p>
<p> <p>
\[ p(\mathbf{r}) = \frac{1}{L^3}\,, \] \[ P(\mathbf{r}) = \frac{1}{L^3}\,, \]
</p> </p>
<p> <p>
@ -1913,8 +1913,8 @@ compute the statistical error.
</p> </p>
</div> </div>
<div id="outline-container-org96d1bb2" class="outline-4"> <div id="outline-container-org4e6a1f7" class="outline-4">
<h4 id="org96d1bb2"><span class="section-number-4">3.2.1</span> Exercise</h4> <h4 id="org4e6a1f7"><span class="section-number-4">3.2.1</span> Exercise</h4>
<div class="outline-text-4" id="text-3-2-1"> <div class="outline-text-4" id="text-3-2-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -2014,8 +2014,8 @@ well as the index of the current step.
</div> </div>
</div> </div>
<div id="outline-container-orgc8c3acf" class="outline-5"> <div id="outline-container-orgbffcbab" class="outline-5">
<h5 id="orgc8c3acf"><span class="section-number-5">3.2.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="orgbffcbab"><span class="section-number-5">3.2.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-3-2-1-1"> <div class="outline-text-5" id="text-3-2-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -2129,8 +2129,8 @@ E = -0.49518773675598715 +/- 5.2391494923686175E-004
</div> </div>
</div> </div>
<div id="outline-container-org0e66655" class="outline-3"> <div id="outline-container-org0733fed" class="outline-3">
<h3 id="org0e66655"><span class="section-number-3">3.3</span> Metropolis sampling with \(\Psi^2\)</h3> <h3 id="org0733fed"><span class="section-number-3">3.3</span> Metropolis sampling with \(\Psi^2\)</h3>
<div class="outline-text-3" id="text-3-3"> <div class="outline-text-3" id="text-3-3">
<p> <p>
We will now use the square of the wave function to sample random We will now use the square of the wave function to sample random
@ -2155,29 +2155,75 @@ sampling:
<p> <p>
To sample a chosen probability density, an efficient method is the To sample a chosen probability density, an efficient method is the
<a href="https://en.wikipedia.org/wiki/Metropolis%E2%80%93Hastings_algorithm">Metropolis-Hastings sampling algorithm</a>. Starting from a random <a href="https://en.wikipedia.org/wiki/Metropolis%E2%80%93Hastings_algorithm">Metropolis-Hastings sampling algorithm</a>. Starting from a random
initial position \(\mathbf{r}_0\), we will realize a random walk as follows: initial position \(\mathbf{r}_0\), we will realize a random walk:
</p>
<p>
\[ \mathbf{r}_0 \rightarrow \mathbf{r}_1 \rightarrow \mathbf{r}_2 \ldots \mathbf{r}_{N_{\rm MC}}\,, \]
</p>
<p>
according to the following algorithm.
</p>
<p>
At every step, we propose a new move according to a transition probability \(T(\mathbf{r}_{n+1},\mathbf{r}_n)\) of our choice.
</p>
<p>
For simplicity, let us move the electron in a 3-dimensional box of side \(2\delta L\) centered at the current position
of the electron:
</p> </p>
<p> <p>
\[ \[
\mathbf{r}_{n+1} = \mathbf{r}_{n} + \delta t\, \mathbf{u} \mathbf{r}_{n+1} = \mathbf{r}_{n} + \delta L \, \mathbf{u}
\] \]
</p> </p>
<p> <p>
where \(\delta t\) is a fixed constant (the so-called <i>time-step</i>), and where \(\delta L\) is a fixed constant, and
\(\mathbf{u}\) is a uniform random number in a 3-dimensional box \(\mathbf{u}\) is a uniform random number in a 3-dimensional box
\((-1,-1,-1) \le \mathbf{u} \le (1,1,1)\). We will then add the \((-1,-1,-1) \le \mathbf{u} \le (1,1,1)\).
</p>
<p>
After having moved the electron, add the
accept/reject step that guarantees that the distribution of the accept/reject step that guarantees that the distribution of the
\(\mathbf{r}_n\) is \(\Psi^2\): \(\mathbf{r}_n\) is \(\Psi^2\). This amounts to accepting the move with
probability
</p>
<p>
\[
A{\mathbf{r}_{n+1},\mathbf{r}_n) = \min\left(1,\frac{T(\mathbf{r}_{n},\mathbf{r}_{n+1}) P(\mathbf{r}_{n+1})}{T(\mathbf{r}_{n+1},\mathbf{r}_n)P(\mathbf{r}_{n})}\right)\,,
\]
</p>
<p>
which, for our choice of transition probability, becomes
</p>
<p>
\[
A{\mathbf{r}_{n+1},\mathbf{r}_n) = \min\left(1,\frac{P(\mathbf{r}_{n+1})}{P(\mathbf{r}_{n})}\right)= \min\left(1,\frac{\Psi(\mathbf{r}_{n+1})^2}{\Psi(\mathbf{r}_{n})^2}
\]
</p>
<p>
Explain why the transition probability cancels out in the expression of \(A\). Also note that we do not need to compute the norm of the wave function!
</p>
<p>
The algorithm is summarized as follows:
</p> </p>
<ol class="org-ol"> <ol class="org-ol">
<li>Compute \(\Psi\) at a new position \(\mathbf{r'} = \mathbf{r}_n + <li>Compute \(\Psi\) at a new position \(\mathbf{r'} = \mathbf{r}_n +
\delta t\, \mathbf{u}\)</li> \delta L\, \mathbf{u}\)</li>
<li>Compute the ratio \(R = \frac{\left[\Psi(\mathbf{r'})\right]^2}{\left[\Psi(\mathbf{r}_{n})\right]^2}\)</li> <li>Compute the ratio \(A = \frac{\left[\Psi(\mathbf{r'})\right]^2}{\left[\Psi(\mathbf{r}_{n})\right]^2}\)</li>
<li>Draw a uniform random number \(v \in [0,1]\)</li> <li>Draw a uniform random number \(v \in [0,1]\)</li>
<li>if \(v \le R\), accept the move : set \(\mathbf{r}_{n+1} = \mathbf{r'}\)</li> <li>if \(v \le A\), accept the move : set \(\mathbf{r}_{n+1} = \mathbf{r'}\)</li>
<li>else, reject the move : set \(\mathbf{r}_{n+1} = \mathbf{r}_n\)</li> <li>else, reject the move : set \(\mathbf{r}_{n+1} = \mathbf{r}_n\)</li>
<li>evaluate the local energy at \(\mathbf{r}_{n+1}\)</li> <li>evaluate the local energy at \(\mathbf{r}_{n+1}\)</li>
</ol> </ol>
@ -2195,30 +2241,30 @@ All samples should be kept, from both accepted and rejected moves.
</div> </div>
<p> <p>
If the time step is infinitely small, the ratio will be very close If the box is infinitely small, the ratio will be very close
to one and all the steps will be accepted. But the trajectory will to one and all the steps will be accepted. However, the moves will be
be infinitely too short to have statistical significance. very correlated and you will visit the configurational space very slowly.
</p> </p>
<p> <p>
On the other hand, as the time step increases, the number of On the other hand, if you propose too large moves, the number of
accepted steps will decrease because the ratios might become accepted steps will decrease because the ratios might become
small. If the number of accepted steps is close to zero, then the small. If the number of accepted steps is close to zero, then the
space is not well sampled either. space is not well sampled either.
</p> </p>
<p> <p>
The time step should be adjusted so that it is as large as The size of the move should be adjusted so that it is as large as
possible, keeping the number of accepted steps not too small. To possible, keeping the number of accepted steps not too small. To
achieve that, we define the acceptance rate as the number of achieve that, we define the acceptance rate as the number of
accepted steps over the total number of steps. Adjusting the time 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. step such that the acceptance rate is close to 0.5 is a good compromise for the current problem.
</p> </p>
</div> </div>
<div id="outline-container-org9692143" class="outline-4"> <div id="outline-container-org0c0af3c" class="outline-4">
<h4 id="org9692143"><span class="section-number-4">3.3.1</span> Exercise</h4> <h4 id="org0c0af3c"><span class="section-number-4">3.3.1</span> Exercise</h4>
<div class="outline-text-4" id="text-3-3-1"> <div class="outline-text-4" id="text-3-3-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -2228,7 +2274,7 @@ sampled with \(\Psi^2\).
<p> <p>
Compute also the acceptance rate, so that you can adapt the time Compute also the acceptance rate, so that you can adapt the time
step in order to have an acceptance rate close to 0.5 . step in order to have an acceptance rate close to 0.5.
</p> </p>
<p> <p>
@ -2325,8 +2371,8 @@ Can you observe a reduction in the statistical error?
</div> </div>
</div> </div>
<div id="outline-container-org88f43cd" class="outline-5"> <div id="outline-container-org6c72dc3" class="outline-5">
<h5 id="org88f43cd"><span class="section-number-5">3.3.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org6c72dc3"><span class="section-number-5">3.3.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-3-3-1-1"> <div class="outline-text-5" id="text-3-3-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -2471,8 +2517,8 @@ A = 0.51695266666666673 +/- 4.0445505648997396E-004
</div> </div>
</div> </div>
<div id="outline-container-org6c65f73" class="outline-3"> <div id="outline-container-orga0b0b8d" class="outline-3">
<h3 id="org6c65f73"><span class="section-number-3">3.4</span> Gaussian random number generator</h3> <h3 id="orga0b0b8d"><span class="section-number-3">3.4</span> Gaussian random number generator</h3>
<div class="outline-text-3" id="text-3-4"> <div class="outline-text-3" id="text-3-4">
<p> <p>
To obtain Gaussian-distributed random numbers, you can apply the To obtain Gaussian-distributed random numbers, you can apply the
@ -2534,14 +2580,17 @@ In Python, you can use the <a href="https://numpy.org/doc/stable/reference/rando
</p> </p>
</div> </div>
</div> </div>
<div id="outline-container-org70ec84a" class="outline-3">
<h3 id="org70ec84a"><span class="section-number-3">3.5</span> Generalized Metropolis algorithm</h3> <div id="outline-container-org57a608a" class="outline-3">
<h3 id="org57a608a"><span class="section-number-3">3.5</span> Generalized Metropolis algorithm</h3>
<div class="outline-text-3" id="text-3-5"> <div class="outline-text-3" id="text-3-5">
<p> <p>
One can use more efficient numerical schemes to move the electrons, One can use more efficient numerical schemes to move the electrons by choosing a smarter expression for the transition probability.
but the Metropolis accepation step has to be adapted accordingly: </p>
the acceptance
probability \(A\) is chosen so that it is consistent with the <p>
The Metropolis acceptance step has to be adapted accordingly to ensure that the detailed balance condition is satisfied. This means that
the acceptance probability \(A\) is chosen so that it is consistent with the
probability of leaving \(\mathbf{r}_n\) and the probability of probability of leaving \(\mathbf{r}_n\) and the probability of
entering \(\mathbf{r}_{n+1}\): entering \(\mathbf{r}_{n+1}\):
</p> </p>
@ -2565,7 +2614,7 @@ numbers. Hence, the transition probability was
<p> <p>
\[ \[
T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) = T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) =
\text{constant} \text{constant}\,,
\] \]
</p> </p>
@ -2584,7 +2633,7 @@ choose to draw Gaussian random numbers with zero mean and variance
\[ \[
T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) = T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) =
\frac{1}{(2\pi\,\delta t)^{3/2}} \exp \left[ - \frac{\left( \frac{1}{(2\pi\,\delta t)^{3/2}} \exp \left[ - \frac{\left(
\mathbf{r}_{n+1} - \mathbf{r}_{n} \right)^2}{2\delta t} \right] \mathbf{r}_{n+1} - \mathbf{r}_{n} \right)^2}{2\delta t} \right]\,.
\] \]
</p> </p>
@ -2597,23 +2646,23 @@ acceptance ratios and improve the sampling.
</p> </p>
<p> <p>
To do this, we can add the drift vector To do this, we can use the gradient of the probability density
</p> </p>
<p> <p>
\[ \[
\frac{\nabla [ \Psi^2 ]}{\Psi^2} = 2 \frac{\nabla \Psi}{\Psi}. \frac{\nabla [ \Psi^2 ]}{\Psi^2} = 2 \frac{\nabla \Psi}{\Psi}\,,
\] \]
</p> </p>
<p> <p>
The numerical scheme becomes a drifted diffusion: and add the so-called drift vector, so that the numerical scheme becomes a drifted diffusion:
</p> </p>
<p> <p>
\[ \[
\mathbf{r}_{n+1} = \mathbf{r}_{n} + \delta t\, \frac{\nabla \mathbf{r}_{n+1} = \mathbf{r}_{n} + \delta t\, \frac{\nabla
\Psi(\mathbf{r})}{\Psi(\mathbf{r})} + \chi \Psi(\mathbf{r})}{\Psi(\mathbf{r})} + \chi \,,
\] \]
</p> </p>
@ -2628,14 +2677,40 @@ The transition probability becomes:
T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) = T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) =
\frac{1}{(2\pi\,\delta t)^{3/2}} \exp \left[ - \frac{\left( \frac{1}{(2\pi\,\delta t)^{3/2}} \exp \left[ - \frac{\left(
\mathbf{r}_{n+1} - \mathbf{r}_{n} - \frac{\nabla \mathbf{r}_{n+1} - \mathbf{r}_{n} - \frac{\nabla
\Psi(\mathbf{r}_n)}{\Psi(\mathbf{r}_n)} \right)^2}{2\,\delta t} \right] \Psi(\mathbf{r}_n)}{\Psi(\mathbf{r}_n)} \right)^2}{2\,\delta t} \right]\,.
\] \]
</p> </p>
<p>
The algorithm of the previous exercise is only slighlty modified summarized:
</p>
<ol class="org-ol">
<li>For the starting position compute \(\Psi\) and the drif-vector \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\)</li>
<li><p>
Compute a new position \(\mathbf{r'} = \mathbf{r}_n +
\delta t\, \frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})} + \chi\)
</p>
<p>
Evaluate \(\Psi\) and \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\) at the new position
</p></li>
<li>Compute the ratio $A = \frac{T(\mathbf{r}<sub>n+1</sub> &rarr; \mathbf{r}<sub>n</sub>) P(\mathbf{r}<sub>n+1</sub>)}</li>
</ol>
<p>
{T(\mathbf{r}<sub>n</sub> &rarr; \mathbf{r}<sub>n+1</sub>) P(\mathbf{r}<sub>n</sub>)}$
</p>
<ol class="org-ol">
<li>Draw a uniform random number \(v \in [0,1]\)</li>
<li>if \(v \le A\), accept the move : set \(\mathbf{r}_{n+1} = \mathbf{r'}\)</li>
<li>else, reject the move : set \(\mathbf{r}_{n+1} = \mathbf{r}_n\)</li>
<li>evaluate the local energy at \(\mathbf{r}_{n+1}\)</li>
</ol>
</div> </div>
<div id="outline-container-org6e34709" class="outline-4"> <div id="outline-container-orgaa87988" class="outline-4">
<h4 id="org6e34709"><span class="section-number-4">3.5.1</span> Exercise 1</h4> <h4 id="orgaa87988"><span class="section-number-4">3.5.1</span> Exercise 1</h4>
<div class="outline-text-4" id="text-3-5-1"> <div class="outline-text-4" id="text-3-5-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -2669,8 +2744,8 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P
</div> </div>
</div> </div>
<div id="outline-container-orgcf485b0" class="outline-5"> <div id="outline-container-orgf391a29" class="outline-5">
<h5 id="orgcf485b0"><span class="section-number-5">3.5.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="orgf391a29"><span class="section-number-5">3.5.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-3-5-1-1"> <div class="outline-text-5" id="text-3-5-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -2703,8 +2778,8 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P
</div> </div>
</div> </div>
<div id="outline-container-orge3ee834" class="outline-4"> <div id="outline-container-org6abfe47" class="outline-4">
<h4 id="orge3ee834"><span class="section-number-4">3.5.2</span> Exercise 2</h4> <h4 id="org6abfe47"><span class="section-number-4">3.5.2</span> Exercise 2</h4>
<div class="outline-text-4" id="text-3-5-2"> <div class="outline-text-4" id="text-3-5-2">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -2798,8 +2873,8 @@ Modify the previous program to introduce the drifted diffusion scheme.
</div> </div>
</div> </div>
<div id="outline-container-org2d51c0d" class="outline-5"> <div id="outline-container-org53b5631" class="outline-5">
<h5 id="org2d51c0d"><span class="section-number-5">3.5.2.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="org53b5631"><span class="section-number-5">3.5.2.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-3-5-2-1"> <div class="outline-text-5" id="text-3-5-2-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -2985,12 +3060,12 @@ A = 0.78839866666666658 +/- 3.2503783452043152E-004
</div> </div>
</div> </div>
<div id="outline-container-org58ca27b" class="outline-2"> <div id="outline-container-org5f1d81b" class="outline-2">
<h2 id="org58ca27b"><span class="section-number-2">4</span> Diffusion Monte Carlo&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h2> <h2 id="org5f1d81b"><span class="section-number-2">4</span> Diffusion Monte Carlo&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h2>
<div class="outline-text-2" id="text-4"> <div class="outline-text-2" id="text-4">
</div> </div>
<div id="outline-container-orgde86ff6" class="outline-3"> <div id="outline-container-org95ab9cd" class="outline-3">
<h3 id="orgde86ff6"><span class="section-number-3">4.1</span> Schrödinger equation in imaginary time</h3> <h3 id="org95ab9cd"><span class="section-number-3">4.1</span> Schrödinger equation in imaginary time</h3>
<div class="outline-text-3" id="text-4-1"> <div class="outline-text-3" id="text-4-1">
<p> <p>
Consider the time-dependent Schrödinger equation: Consider the time-dependent Schrödinger equation:
@ -3049,8 +3124,8 @@ system.
</div> </div>
</div> </div>
<div id="outline-container-org02ca0c2" class="outline-3"> <div id="outline-container-org9fcbab9" class="outline-3">
<h3 id="org02ca0c2"><span class="section-number-3">4.2</span> Diffusion and branching</h3> <h3 id="org9fcbab9"><span class="section-number-3">4.2</span> Diffusion and branching</h3>
<div class="outline-text-3" id="text-4-2"> <div class="outline-text-3" id="text-4-2">
<p> <p>
The <a href="https://en.wikipedia.org/wiki/Diffusion_equation">diffusion equation</a> of particles is given by The <a href="https://en.wikipedia.org/wiki/Diffusion_equation">diffusion equation</a> of particles is given by
@ -3104,8 +3179,8 @@ the combination of a diffusion process and a branching process.
</div> </div>
</div> </div>
<div id="outline-container-org1a44a46" class="outline-3"> <div id="outline-container-org0aba1e8" class="outline-3">
<h3 id="org1a44a46"><span class="section-number-3">4.3</span> Importance sampling</h3> <h3 id="org0aba1e8"><span class="section-number-3">4.3</span> Importance sampling</h3>
<div class="outline-text-3" id="text-4-3"> <div class="outline-text-3" id="text-4-3">
<p> <p>
In a molecular system, the potential is far from being constant, In a molecular system, the potential is far from being constant,
@ -3162,8 +3237,8 @@ error known as the <i>fixed node error</i>.
</p> </p>
</div> </div>
<div id="outline-container-org25d9eba" class="outline-4"> <div id="outline-container-orgcc09947" class="outline-4">
<h4 id="org25d9eba"><span class="section-number-4">4.3.1</span> Appendix : Details of the Derivation</h4> <h4 id="orgcc09947"><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"> <div class="outline-text-4" id="text-4-3-1">
<p> <p>
\[ \[
@ -3225,8 +3300,8 @@ Defining \(\Pi(\mathbf{r},t) = \psi(\mathbf{r},\tau)
</div> </div>
<div id="outline-container-org4206909" class="outline-3"> <div id="outline-container-org2f26efe" class="outline-3">
<h3 id="org4206909"><span class="section-number-3">4.4</span> Fixed-node DMC energy</h3> <h3 id="org2f26efe"><span class="section-number-3">4.4</span> Fixed-node DMC energy</h3>
<div class="outline-text-3" id="text-4-4"> <div class="outline-text-3" id="text-4-4">
<p> <p>
Now that we have a process to sample \(\Pi(\mathbf{r},\tau) = Now that we have a process to sample \(\Pi(\mathbf{r},\tau) =
@ -3278,8 +3353,8 @@ energies computed with the trial wave function.
</div> </div>
</div> </div>
<div id="outline-container-orgbc4844d" class="outline-3"> <div id="outline-container-orgfc317d3" class="outline-3">
<h3 id="orgbc4844d"><span class="section-number-3">4.5</span> Pure Diffusion Monte Carlo (PDMC)</h3> <h3 id="orgfc317d3"><span class="section-number-3">4.5</span> Pure Diffusion Monte Carlo (PDMC)</h3>
<div class="outline-text-3" id="text-4-5"> <div class="outline-text-3" id="text-4-5">
<p> <p>
Instead of having a variable number of particles to simulate the Instead of having a variable number of particles to simulate the
@ -3331,13 +3406,13 @@ code, so this is what we will do in the next section.
</div> </div>
</div> </div>
<div id="outline-container-org0e0bf5c" class="outline-3"> <div id="outline-container-orgf410952" class="outline-3">
<h3 id="org0e0bf5c"><span class="section-number-3">4.6</span> Hydrogen atom</h3> <h3 id="orgf410952"><span class="section-number-3">4.6</span> Hydrogen atom</h3>
<div class="outline-text-3" id="text-4-6"> <div class="outline-text-3" id="text-4-6">
</div> </div>
<div id="outline-container-org044109b" class="outline-4"> <div id="outline-container-org5899d68" class="outline-4">
<h4 id="org044109b"><span class="section-number-4">4.6.1</span> Exercise</h4> <h4 id="org5899d68"><span class="section-number-4">4.6.1</span> Exercise</h4>
<div class="outline-text-4" id="text-4-6-1"> <div class="outline-text-4" id="text-4-6-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -3436,8 +3511,8 @@ energy of H for any value of \(a\).
</div> </div>
</div> </div>
<div id="outline-container-orgf0ab8a1" class="outline-5"> <div id="outline-container-orge0716bd" class="outline-5">
<h5 id="orgf0ab8a1"><span class="section-number-5">4.6.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="orge0716bd"><span class="section-number-5">4.6.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5>
<div class="outline-text-5" id="text-4-6-1-1"> <div class="outline-text-5" id="text-4-6-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -3653,8 +3728,8 @@ A = 0.98788066666666663 +/- 7.2889356133441110E-005
</div> </div>
<div id="outline-container-orgce119bb" class="outline-3"> <div id="outline-container-org5e287d8" class="outline-3">
<h3 id="orgce119bb"><span class="section-number-3">4.7</span> <span class="todo TODO">TODO</span> H<sub>2</sub></h3> <h3 id="org5e287d8"><span class="section-number-3">4.7</span> <span class="todo TODO">TODO</span> H<sub>2</sub></h3>
<div class="outline-text-3" id="text-4-7"> <div class="outline-text-3" id="text-4-7">
<p> <p>
We will now consider the H<sub>2</sub> molecule in a minimal basis composed of the We will now consider the H<sub>2</sub> molecule in a minimal basis composed of the
@ -3675,8 +3750,8 @@ the nuclei.
</div> </div>
<div id="outline-container-org02606e3" class="outline-2"> <div id="outline-container-org17d4d49" class="outline-2">
<h2 id="org02606e3"><span class="section-number-2">5</span> <span class="todo TODO">TODO</span> <code>[0/3]</code> Last things to do</h2> <h2 id="org17d4d49"><span class="section-number-2">5</span> <span class="todo TODO">TODO</span> <code>[0/3]</code> Last things to do</h2>
<div class="outline-text-2" id="text-5"> <div class="outline-text-2" id="text-5">
<ul class="org-ul"> <ul class="org-ul">
<li class="off"><code>[&#xa0;]</code> Give some hints of how much time is required for each section</li> <li class="off"><code>[&#xa0;]</code> Give some hints of how much time is required for each section</li>
@ -3692,7 +3767,7 @@ the H\(_2\) molecule at $R$=1.4010 bohr. Answer: 0.17406 a.u.</li>
</div> </div>
<div id="postamble" class="status"> <div id="postamble" class="status">
<p class="author">Author: Anthony Scemama, Claudia Filippi</p> <p class="author">Author: Anthony Scemama, Claudia Filippi</p>
<p class="date">Created: 2021-01-31 Sun 08:40</p> <p class="date">Created: 2021-01-31 Sun 09:26</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p> <p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div> </div>
</body> </body>