1
0
mirror of https://github.com/TREX-CoE/qmc-lttc.git synced 2024-11-04 05:04:01 +01:00
This commit is contained in:
filippi-claudia 2021-02-01 20:57:15 +00:00
parent 7de40ef5ae
commit 3a6bc9d6b7

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-02-01 Mon 12:52 --> <!-- 2021-02-01 Mon 20:57 -->
<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,151 +329,151 @@ 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="#org911f20e">1. Introduction</a> <li><a href="#org2651723">1. Introduction</a>
<ul> <ul>
<li><a href="#org8dc5f89">1.1. Energy and local energy</a></li> <li><a href="#org131ad5b">1.1. Energy and local energy</a></li>
</ul> </ul>
</li> </li>
<li><a href="#orgd55defa">2. Numerical evaluation of the energy of the hydrogen atom</a> <li><a href="#orgaef3f04">2. Numerical evaluation of the energy of the hydrogen atom</a>
<ul> <ul>
<li><a href="#org5925d8c">2.1. Local energy</a> <li><a href="#orgd36696b">2.1. Local energy</a>
<ul> <ul>
<li><a href="#org45bba09">2.1.1. Exercise 1</a> <li><a href="#org06e7f3c">2.1.1. Exercise 1</a>
<ul> <ul>
<li><a href="#org143bcea">2.1.1.1. Solution</a></li> <li><a href="#org923cd33">2.1.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#orgcf94a92">2.1.2. Exercise 2</a> <li><a href="#orgc226f7b">2.1.2. Exercise 2</a>
<ul> <ul>
<li><a href="#org866900c">2.1.2.1. Solution</a></li> <li><a href="#org68ff820">2.1.2.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org17e5bee">2.1.3. Exercise 3</a> <li><a href="#orgd05efaf">2.1.3. Exercise 3</a>
<ul> <ul>
<li><a href="#org5eeb018">2.1.3.1. Solution</a></li> <li><a href="#orga686e1e">2.1.3.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org8a93471">2.1.4. Exercise 4</a> <li><a href="#org64eedf7">2.1.4. Exercise 4</a>
<ul> <ul>
<li><a href="#org2af14b8">2.1.4.1. Solution</a></li> <li><a href="#org089f90c">2.1.4.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#orga1a0859">2.1.5. Exercise 5</a> <li><a href="#org09ee903">2.1.5. Exercise 5</a>
<ul> <ul>
<li><a href="#org92ebd7d">2.1.5.1. Solution</a></li> <li><a href="#orgcc02f60">2.1.5.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org5cca68c">2.2. Plot of the local energy along the \(x\) axis</a> <li><a href="#org2f2d6bb">2.2. Plot of the local energy along the \(x\) axis</a>
<ul> <ul>
<li><a href="#org27f229d">2.2.1. Exercise</a> <li><a href="#orga518fc0">2.2.1. Exercise</a>
<ul> <ul>
<li><a href="#orgefbba7b">2.2.1.1. Solution</a></li> <li><a href="#org13a7709">2.2.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org6f7b212">2.3. Numerical estimation of the energy</a> <li><a href="#orgcc96fb8">2.3. Numerical estimation of the energy</a>
<ul> <ul>
<li><a href="#org73d0044">2.3.1. Exercise</a> <li><a href="#org3a137bd">2.3.1. Exercise</a>
<ul> <ul>
<li><a href="#org9fa7e9b">2.3.1.1. Solution</a></li> <li><a href="#orgc3bbb1c">2.3.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org0ae7607">2.4. Variance of the local energy</a> <li><a href="#orgda033ae">2.4. Variance of the local energy</a>
<ul> <ul>
<li><a href="#org85f88d6">2.4.1. Exercise (optional)</a> <li><a href="#org65d32ac">2.4.1. Exercise (optional)</a>
<ul> <ul>
<li><a href="#orgde76526">2.4.1.1. Solution</a></li> <li><a href="#orgaf2eca8">2.4.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org85a5fb7">2.4.2. Exercise</a> <li><a href="#orgaef7130">2.4.2. Exercise</a>
<ul> <ul>
<li><a href="#org81ff0a9">2.4.2.1. Solution</a></li> <li><a href="#org7feddd3">2.4.2.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org6efff28">3. Variational Monte Carlo</a> <li><a href="#org79f2368">3. Variational Monte Carlo</a>
<ul> <ul>
<li><a href="#org4d2f25c">3.1. Computation of the statistical error</a> <li><a href="#org4e200b0">3.1. Computation of the statistical error</a>
<ul> <ul>
<li><a href="#org59769bf">3.1.1. Exercise</a> <li><a href="#org9e7a67b">3.1.1. Exercise</a>
<ul> <ul>
<li><a href="#org53031b1">3.1.1.1. Solution</a></li> <li><a href="#org7ce66b5">3.1.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#orgda04982">3.2. Uniform sampling in the box</a> <li><a href="#org72f5650">3.2. Uniform sampling in the box</a>
<ul> <ul>
<li><a href="#org374dde3">3.2.1. Exercise</a> <li><a href="#org16e93f6">3.2.1. Exercise</a>
<ul> <ul>
<li><a href="#org44796a9">3.2.1.1. Solution</a></li> <li><a href="#orgfdffcd3">3.2.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org4530877">3.3. Metropolis sampling with \(\Psi^2\)</a> <li><a href="#org02cf3aa">3.3. Metropolis sampling with \(\Psi^2\)</a>
<ul> <ul>
<li><a href="#orgc4d1979">3.3.1. Exercise</a> <li><a href="#org72f25a5">3.3.1. Exercise</a>
<ul> <ul>
<li><a href="#org035fdd6">3.3.1.1. Solution</a></li> <li><a href="#orgd9ea31c">3.3.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org7c86c4f">3.4. Gaussian random number generator</a></li> <li><a href="#org0e35321">3.4. Gaussian random number generator</a></li>
<li><a href="#org4981ac1">3.5. Generalized Metropolis algorithm</a> <li><a href="#org46c79a2">3.5. Generalized Metropolis algorithm</a>
<ul> <ul>
<li><a href="#orgab2ad4b">3.5.1. Exercise 1</a> <li><a href="#org9114081">3.5.1. Exercise 1</a>
<ul> <ul>
<li><a href="#org1c15cfb">3.5.1.1. Solution</a></li> <li><a href="#org232a214">3.5.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org0a89fa9">3.5.2. Exercise 2</a> <li><a href="#orgff165dc">3.5.2. Exercise 2</a>
<ul> <ul>
<li><a href="#org298a5fb">3.5.2.1. Solution</a></li> <li><a href="#orgd31a9d6">3.5.2.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#org0bd32b3">4. Diffusion Monte Carlo</a> <li><a href="#orgb642136">4. Diffusion Monte Carlo</a>
<ul> <ul>
<li><a href="#orgf29da22">4.1. Schrödinger equation in imaginary time</a></li> <li><a href="#org896d62d">4.1. Schrödinger equation in imaginary time</a></li>
<li><a href="#orgd5273df">4.2. Diffusion and branching</a></li> <li><a href="#org10e850c">4.2. Diffusion and branching</a></li>
<li><a href="#orge2f84dc">4.3. Importance sampling</a> <li><a href="#org308a035">4.3. Importance sampling</a>
<ul> <ul>
<li><a href="#org13921db">4.3.1. Appendix : Details of the Derivation</a></li> <li><a href="#orgdd63af1">4.3.1. Appendix : Details of the Derivation</a></li>
</ul> </ul>
</li> </li>
<li><a href="#org2082417">4.4. Pure Diffusion Monte Carlo (PDMC)</a></li> <li><a href="#orga67a8aa">4.4. Pure Diffusion Monte Carlo (PDMC)</a></li>
<li><a href="#org7342b6d">4.5. Hydrogen atom</a> <li><a href="#org08cac2c">4.5. Hydrogen atom</a>
<ul> <ul>
<li><a href="#orgc9cbd6b">4.5.1. Exercise</a> <li><a href="#orged492a0">4.5.1. Exercise</a>
<ul> <ul>
<li><a href="#org5b7ac88">4.5.1.1. Solution</a></li> <li><a href="#orgde645d7">4.5.1.1. Solution</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
</li> </li>
<li><a href="#orgff35458">4.6. <span class="todo TODO">TODO</span> H<sub>2</sub></a></li> <li><a href="#orgeaede30">4.6. <span class="todo TODO">TODO</span> H<sub>2</sub></a></li>
</ul> </ul>
</li> </li>
<li><a href="#orgfed2921">5. <span class="todo TODO">TODO</span> <code>[0/3]</code> Last things to do</a></li> <li><a href="#orgd092c37">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-org911f20e" class="outline-2"> <div id="outline-container-org2651723" class="outline-2">
<h2 id="org911f20e"><span class="section-number-2">1</span> Introduction</h2> <h2 id="org2651723"><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
@ -513,8 +513,8 @@ coordinates, etc).
</p> </p>
</div> </div>
<div id="outline-container-org8dc5f89" class="outline-3"> <div id="outline-container-org131ad5b" class="outline-3">
<h3 id="org8dc5f89"><span class="section-number-3">1.1</span> Energy and local energy</h3> <h3 id="org131ad5b"><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
@ -578,7 +578,7 @@ where the probability density is given by the square of the wave function:
</p> </p>
<p> <p>
\[ P(\mathbf{r}) = \frac{|Psi(\mathbf{r}|^2)}{\int |\Psi(\mathbf{r})|^2 d\mathbf{r}}\,. \] \[ P(\mathbf{r}) = \frac{|\Psi(\mathbf{r})|^2}{\int |\Psi(\mathbf{r})|^2 d\mathbf{r}}\,. \]
</p> </p>
<p> <p>
@ -592,8 +592,8 @@ If we can sample \(N_{\rm MC}\) configurations \(\{\mathbf{r}\}\) distributed as
</div> </div>
</div> </div>
<div id="outline-container-orgd55defa" class="outline-2"> <div id="outline-container-orgaef3f04" class="outline-2">
<h2 id="orgd55defa"><span class="section-number-2">2</span> Numerical evaluation of the energy of the hydrogen atom</h2> <h2 id="orgaef3f04"><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
@ -622,8 +622,8 @@ To do that, we will compute the local energy and check whether it is constant.
</p> </p>
</div> </div>
<div id="outline-container-org5925d8c" class="outline-3"> <div id="outline-container-orgd36696b" class="outline-3">
<h3 id="org5925d8c"><span class="section-number-3">2.1</span> Local energy</h3> <h3 id="orgd36696b"><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.
@ -650,8 +650,8 @@ to catch the error.
</div> </div>
</div> </div>
<div id="outline-container-org45bba09" class="outline-4"> <div id="outline-container-org06e7f3c" class="outline-4">
<h4 id="org45bba09"><span class="section-number-4">2.1.1</span> Exercise 1</h4> <h4 id="org06e7f3c"><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>
@ -695,8 +695,8 @@ and returns the potential.
</div> </div>
</div> </div>
<div id="outline-container-org143bcea" class="outline-5"> <div id="outline-container-org923cd33" class="outline-5">
<h5 id="org143bcea"><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="org923cd33"><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>
@ -736,8 +736,8 @@ and returns the potential.
</div> </div>
</div> </div>
<div id="outline-container-orgcf94a92" class="outline-4"> <div id="outline-container-orgc226f7b" class="outline-4">
<h4 id="orgcf94a92"><span class="section-number-4">2.1.2</span> Exercise 2</h4> <h4 id="orgc226f7b"><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>
@ -772,8 +772,8 @@ input arguments, and returns a scalar.
</div> </div>
</div> </div>
<div id="outline-container-org866900c" class="outline-5"> <div id="outline-container-org68ff820" class="outline-5">
<h5 id="org866900c"><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="org68ff820"><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>
@ -800,8 +800,8 @@ input arguments, and returns a scalar.
</div> </div>
</div> </div>
<div id="outline-container-org17e5bee" class="outline-4"> <div id="outline-container-orgd05efaf" class="outline-4">
<h4 id="org17e5bee"><span class="section-number-4">2.1.3</span> Exercise 3</h4> <h4 id="orgd05efaf"><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>
@ -882,8 +882,8 @@ Therefore, the local kinetic energy is
</div> </div>
</div> </div>
<div id="outline-container-org5eeb018" class="outline-5"> <div id="outline-container-orga686e1e" class="outline-5">
<h5 id="org5eeb018"><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="orga686e1e"><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>
@ -924,8 +924,8 @@ Therefore, the local kinetic energy is
</div> </div>
</div> </div>
<div id="outline-container-org8a93471" class="outline-4"> <div id="outline-container-org64eedf7" class="outline-4">
<h4 id="org8a93471"><span class="section-number-4">2.1.4</span> Exercise 4</h4> <h4 id="org64eedf7"><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>
@ -968,8 +968,8 @@ local kinetic energy.
</div> </div>
</div> </div>
<div id="outline-container-org2af14b8" class="outline-5"> <div id="outline-container-org089f90c" class="outline-5">
<h5 id="org2af14b8"><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="org089f90c"><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>
@ -999,8 +999,8 @@ local kinetic energy.
</div> </div>
</div> </div>
<div id="outline-container-orga1a0859" class="outline-4"> <div id="outline-container-org09ee903" class="outline-4">
<h4 id="orga1a0859"><span class="section-number-4">2.1.5</span> Exercise 5</h4> <h4 id="org09ee903"><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>
@ -1010,8 +1010,8 @@ Find the theoretical value of \(a\) for which \(\Psi\) is an eigenfunction of \(
</div> </div>
</div> </div>
<div id="outline-container-org92ebd7d" class="outline-5"> <div id="outline-container-orgcc02f60" class="outline-5">
<h5 id="org92ebd7d"><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="orgcc02f60"><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} -
@ -1031,8 +1031,8 @@ equal to -0.5 atomic units.
</div> </div>
</div> </div>
<div id="outline-container-org5cca68c" class="outline-3"> <div id="outline-container-org2f2d6bb" class="outline-3">
<h3 id="org5cca68c"><span class="section-number-3">2.2</span> Plot of the local energy along the \(x\) axis</h3> <h3 id="org2f2d6bb"><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>
@ -1043,8 +1043,8 @@ choose a grid which does not contain the origin.
</div> </div>
</div> </div>
<div id="outline-container-org27f229d" class="outline-4"> <div id="outline-container-orga518fc0" class="outline-4">
<h4 id="org27f229d"><span class="section-number-4">2.2.1</span> Exercise</h4> <h4 id="orga518fc0"><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>
@ -1127,8 +1127,8 @@ plot './data' index 0 using 1:2 with lines title 'a=0.1', \
</div> </div>
</div> </div>
<div id="outline-container-orgefbba7b" class="outline-5"> <div id="outline-container-org13a7709" class="outline-5">
<h5 id="orgefbba7b"><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="org13a7709"><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>
@ -1203,8 +1203,8 @@ plt.savefig(<span style="color: #8b2252;">"plot_py.png"</span>)
</div> </div>
</div> </div>
<div id="outline-container-org6f7b212" class="outline-3"> <div id="outline-container-orgcc96fb8" class="outline-3">
<h3 id="org6f7b212"><span class="section-number-3">2.3</span> Numerical estimation of the energy</h3> <h3 id="orgcc96fb8"><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\)
@ -1234,8 +1234,8 @@ The energy is biased because:
</div> </div>
<div id="outline-container-org73d0044" class="outline-4"> <div id="outline-container-org3a137bd" class="outline-4">
<h4 id="org73d0044"><span class="section-number-4">2.3.1</span> Exercise</h4> <h4 id="org3a137bd"><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>
@ -1304,8 +1304,8 @@ To compile the Fortran and run it:
</div> </div>
</div> </div>
<div id="outline-container-org9fa7e9b" class="outline-5"> <div id="outline-container-orgc3bbb1c" class="outline-5">
<h5 id="org9fa7e9b"><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="orgc3bbb1c"><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>
@ -1420,8 +1420,8 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002
</div> </div>
</div> </div>
<div id="outline-container-org0ae7607" class="outline-3"> <div id="outline-container-orgda033ae" class="outline-3">
<h3 id="org0ae7607"><span class="section-number-3">2.4</span> Variance of the local energy</h3> <h3 id="orgda033ae"><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\)
@ -1448,8 +1448,8 @@ energy can be used as a measure of the quality of a wave function.
</p> </p>
</div> </div>
<div id="outline-container-org85f88d6" class="outline-4"> <div id="outline-container-org65d32ac" class="outline-4">
<h4 id="org85f88d6"><span class="section-number-4">2.4.1</span> Exercise (optional)</h4> <h4 id="org65d32ac"><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>
@ -1460,8 +1460,8 @@ Prove that :
</div> </div>
</div> </div>
<div id="outline-container-orgde76526" class="outline-5"> <div id="outline-container-orgaf2eca8" class="outline-5">
<h5 id="orgde76526"><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="orgaf2eca8"><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}
@ -1480,8 +1480,8 @@ Prove that :
</div> </div>
</div> </div>
</div> </div>
<div id="outline-container-org85a5fb7" class="outline-4"> <div id="outline-container-orgaef7130" class="outline-4">
<h4 id="org85a5fb7"><span class="section-number-4">2.4.2</span> Exercise</h4> <h4 id="orgaef7130"><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>
@ -1555,8 +1555,8 @@ To compile and run:
</div> </div>
</div> </div>
<div id="outline-container-org81ff0a9" class="outline-5"> <div id="outline-container-org7feddd3" class="outline-5">
<h5 id="org81ff0a9"><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="org7feddd3"><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>
@ -1693,8 +1693,8 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002 s2 = 1.8068814
</div> </div>
</div> </div>
<div id="outline-container-org6efff28" class="outline-2"> <div id="outline-container-org79f2368" class="outline-2">
<h2 id="org6efff28"><span class="section-number-2">3</span> Variational Monte Carlo</h2> <h2 id="org79f2368"><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
@ -1710,8 +1710,8 @@ interval.
</p> </p>
</div> </div>
<div id="outline-container-org4d2f25c" class="outline-3"> <div id="outline-container-org4e200b0" class="outline-3">
<h3 id="org4d2f25c"><span class="section-number-3">3.1</span> Computation of the statistical error</h3> <h3 id="org4e200b0"><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\)
@ -1751,8 +1751,8 @@ And the confidence interval is given by
</p> </p>
</div> </div>
<div id="outline-container-org59769bf" class="outline-4"> <div id="outline-container-org9e7a67b" class="outline-4">
<h4 id="org59769bf"><span class="section-number-4">3.1.1</span> Exercise</h4> <h4 id="org9e7a67b"><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>
@ -1790,8 +1790,8 @@ input array.
</div> </div>
</div> </div>
<div id="outline-container-org53031b1" class="outline-5"> <div id="outline-container-org7ce66b5" class="outline-5">
<h5 id="org53031b1"><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="org7ce66b5"><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>
@ -1850,8 +1850,8 @@ input array.
</div> </div>
</div> </div>
<div id="outline-container-orgda04982" class="outline-3"> <div id="outline-container-org72f5650" class="outline-3">
<h3 id="orgda04982"><span class="section-number-3">3.2</span> Uniform sampling in the box</h3> <h3 id="org72f5650"><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
@ -1912,8 +1912,8 @@ compute the statistical error.
</p> </p>
</div> </div>
<div id="outline-container-org374dde3" class="outline-4"> <div id="outline-container-org16e93f6" class="outline-4">
<h4 id="org374dde3"><span class="section-number-4">3.2.1</span> Exercise</h4> <h4 id="org16e93f6"><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>
@ -2013,8 +2013,8 @@ well as the index of the current step.
</div> </div>
</div> </div>
<div id="outline-container-org44796a9" class="outline-5"> <div id="outline-container-orgfdffcd3" class="outline-5">
<h5 id="org44796a9"><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="orgfdffcd3"><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>
@ -2128,8 +2128,8 @@ E = -0.49518773675598715 +/- 5.2391494923686175E-004
</div> </div>
</div> </div>
<div id="outline-container-org4530877" class="outline-3"> <div id="outline-container-org02cf3aa" class="outline-3">
<h3 id="org4530877"><span class="section-number-3">3.3</span> Metropolis sampling with \(\Psi^2\)</h3> <h3 id="org02cf3aa"><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
@ -2262,14 +2262,14 @@ compromise for the current problem.
</p> </p>
<p> <p>
NOTE: below, we use the symbol dt to denote dL since we will use NOTE: below, we use the symbol \(\delta t\) to denote \(\delta L\) since we will use
the same variable later on to store a time step. the same variable later on to store a time step.
</p> </p>
</div> </div>
<div id="outline-container-orgc4d1979" class="outline-4"> <div id="outline-container-org72f25a5" class="outline-4">
<h4 id="orgc4d1979"><span class="section-number-4">3.3.1</span> Exercise</h4> <h4 id="org72f25a5"><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>
@ -2376,8 +2376,8 @@ Can you observe a reduction in the statistical error?
</div> </div>
</div> </div>
<div id="outline-container-org035fdd6" class="outline-5"> <div id="outline-container-orgd9ea31c" class="outline-5">
<h5 id="org035fdd6"><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="orgd9ea31c"><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>
@ -2522,8 +2522,8 @@ A = 0.51695266666666673 +/- 4.0445505648997396E-004
</div> </div>
</div> </div>
<div id="outline-container-org7c86c4f" class="outline-3"> <div id="outline-container-org0e35321" class="outline-3">
<h3 id="org7c86c4f"><span class="section-number-3">3.4</span> Gaussian random number generator</h3> <h3 id="org0e35321"><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
@ -2586,8 +2586,8 @@ In Python, you can use the <a href="https://numpy.org/doc/stable/reference/rando
</div> </div>
</div> </div>
<div id="outline-container-org4981ac1" class="outline-3"> <div id="outline-container-org46c79a2" class="outline-3">
<h3 id="org4981ac1"><span class="section-number-3">3.5</span> Generalized Metropolis algorithm</h3> <h3 id="org46c79a2"><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 by choosing a smarter expression for the transition probability. One can use more efficient numerical schemes to move the electrons by choosing a smarter expression for the transition probability.
@ -2705,12 +2705,7 @@ Compute a new position \(\mathbf{r'} = \mathbf{r}_n +
<p> <p>
Evaluate \(\Psi\) and \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\) at the new position Evaluate \(\Psi\) and \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\) at the new position
</p></li> </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> <li>Compute the ratio \(A = \frac{T(\mathbf{r}_{n+1} \rightarrow \mathbf{r}_{n}) P(\mathbf{r}_{n+1})}{T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) P(\mathbf{r}_{n})}\)</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>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>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>
@ -2719,8 +2714,8 @@ Evaluate \(\Psi\) and \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\) at th
</div> </div>
<div id="outline-container-orgab2ad4b" class="outline-4"> <div id="outline-container-org9114081" class="outline-4">
<h4 id="orgab2ad4b"><span class="section-number-4">3.5.1</span> Exercise 1</h4> <h4 id="org9114081"><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>
@ -2754,8 +2749,8 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P
</div> </div>
</div> </div>
<div id="outline-container-org1c15cfb" class="outline-5"> <div id="outline-container-org232a214" class="outline-5">
<h5 id="org1c15cfb"><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="org232a214"><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>
@ -2788,8 +2783,8 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P
</div> </div>
</div> </div>
<div id="outline-container-org0a89fa9" class="outline-4"> <div id="outline-container-orgff165dc" class="outline-4">
<h4 id="org0a89fa9"><span class="section-number-4">3.5.2</span> Exercise 2</h4> <h4 id="orgff165dc"><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>
@ -2883,8 +2878,8 @@ Modify the previous program to introduce the drift-diffusion scheme.
</div> </div>
</div> </div>
<div id="outline-container-org298a5fb" class="outline-5"> <div id="outline-container-orgd31a9d6" class="outline-5">
<h5 id="org298a5fb"><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="orgd31a9d6"><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>
@ -3070,12 +3065,12 @@ A = 0.78839866666666658 +/- 3.2503783452043152E-004
</div> </div>
</div> </div>
<div id="outline-container-org0bd32b3" class="outline-2"> <div id="outline-container-orgb642136" class="outline-2">
<h2 id="org0bd32b3"><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="orgb642136"><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-orgf29da22" class="outline-3"> <div id="outline-container-org896d62d" class="outline-3">
<h3 id="orgf29da22"><span class="section-number-3">4.1</span> Schrödinger equation in imaginary time</h3> <h3 id="org896d62d"><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:
@ -3088,7 +3083,7 @@ Consider the time-dependent Schrödinger equation:
</p> </p>
<p> <p>
where we introduced a shift in the energy, \(E_{\rm ref}\), which will come useful below. where we introduced a shift in the energy, \(E_{\rm ref}\), for reasons which will become apparent below.
</p> </p>
<p> <p>
@ -3124,13 +3119,13 @@ Now, if we replace the time variable \(t\) by an imaginary time variable
</p> </p>
<p> <p>
where \(\psi(\mathbf{r},\tau) = \Psi(\mathbf{r},-i\,t)\) where \(\psi(\mathbf{r},\tau) = \Psi(\mathbf{r},-i\,\tau)\)
and and
</p> </p>
\begin{eqnarray*} \begin{eqnarray*}
\psi(\mathbf{r},\tau) &=& \sum_k a_k \exp( -(E_k-E_{\rm ref})\, \tau) \phi_k(\mathbf{r})\\ \psi(\mathbf{r},\tau) &=& \sum_k a_k \exp( -(E_k-E_{\rm ref})\, \tau) \Phi_k(\mathbf{r})\\
&=& \exp(-(E_0-E_{\rm ref})\, \tau)\sum_k a_k \exp( -(E_k-E_0)\, \tau) \phi_k(\mathbf{r})\,. &=& \exp(-(E_0-E_{\rm ref})\, \tau)\sum_k a_k \exp( -(E_k-E_0)\, \tau) \Phi_k(\mathbf{r})\,.
\end{eqnarray*} \end{eqnarray*}
<p> <p>
@ -3143,8 +3138,8 @@ system.
</div> </div>
</div> </div>
<div id="outline-container-orgd5273df" class="outline-3"> <div id="outline-container-org10e850c" class="outline-3">
<h3 id="orgd5273df"><span class="section-number-3">4.2</span> Diffusion and branching</h3> <h3 id="org10e850c"><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 imaginary-time Schrödinger equation can be explicitly written in terms of the kinetic and The imaginary-time Schrödinger equation can be explicitly written in terms of the kinetic and
@ -3213,8 +3208,8 @@ so-called branching process).
</p> </p>
<p> <p>
<i>Diffusion Monte Carlo</i> (DMC) consists in obtaining the ground state of a In <i>Diffusion Monte Carlo</i> (DMC), one onbtains the ground state of a
system by simulating the Schrödinger equation in imaginary time, by system by simulating the Schrödinger equation in imaginary time via
the combination of a diffusion process and a branching process. the combination of a diffusion process and a branching process.
</p> </p>
@ -3241,12 +3236,12 @@ Therefore, in both cases, you are dealing with a "Bosonic" ground state.
</div> </div>
</div> </div>
<div id="outline-container-orge2f84dc" class="outline-3"> <div id="outline-container-org308a035" class="outline-3">
<h3 id="orge2f84dc"><span class="section-number-3">4.3</span> Importance sampling</h3> <h3 id="org308a035"><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
and diverges at inter-particle coalescence points. Hence, when the and, in fact, diverges at the inter-particle coalescence points. Hence, when the
rate equation is simulated, it results in very large fluctuations rate equation is simulated, it results in very large fluctuations
in the numbers of particles, making the calculations impossible in in the numbers of particles, making the calculations impossible in
practice. practice.
@ -3279,7 +3274,7 @@ Defining \(\Pi(\mathbf{r},\tau) = \psi(\mathbf{r},\tau) \Psi_T(\mathbf{r})\), (s
The new "kinetic energy" can be simulated by the drift-diffusion The new "kinetic energy" can be simulated by the drift-diffusion
scheme presented in the previous section (VMC). scheme presented in the previous section (VMC).
The new "potential" is the local energy, which has smaller fluctuations The new "potential" is the local energy, which has smaller fluctuations
when \(\Psi_T\) gets closer to the exact wave function. It can be simulated by when \(\Psi_T\) gets closer to the exact wave function. This term can be simulated by
changing the number of particles according to \(\exp\left[ -\delta t\, changing the number of particles according to \(\exp\left[ -\delta t\,
\left(E_L(\mathbf{r}) - E_{\rm ref}\right)\right]\) \left(E_L(\mathbf{r}) - E_{\rm ref}\right)\right]\)
where \(E_{\rm ref}\) is the constant we had introduced above, which is adjusted to where \(E_{\rm ref}\) is the constant we had introduced above, which is adjusted to
@ -3338,8 +3333,8 @@ energies computed with the trial wave function.
</p> </p>
</div> </div>
<div id="outline-container-org13921db" class="outline-4"> <div id="outline-container-orgdd63af1" class="outline-4">
<h4 id="org13921db"><span class="section-number-4">4.3.1</span> Appendix : Details of the Derivation</h4> <h4 id="orgdd63af1"><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>
\[ \[
@ -3400,8 +3395,8 @@ Defining \(\Pi(\mathbf{r},t) = \psi(\mathbf{r},\tau)
</div> </div>
</div> </div>
<div id="outline-container-org2082417" class="outline-3"> <div id="outline-container-orga67a8aa" class="outline-3">
<h3 id="org2082417"><span class="section-number-3">4.4</span> Pure Diffusion Monte Carlo (PDMC)</h3> <h3 id="orga67a8aa"><span class="section-number-3">4.4</span> Pure Diffusion Monte Carlo (PDMC)</h3>
<div class="outline-text-3" id="text-4-4"> <div class="outline-text-3" id="text-4-4">
<p> <p>
Instead of having a variable number of particles to simulate the Instead of having a variable number of particles to simulate the
@ -3437,12 +3432,7 @@ Compute a new position \(\mathbf{r'} = \mathbf{r}_n +
<p> <p>
Evaluate \(\Psi\) and \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\) at the new position Evaluate \(\Psi\) and \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\) at the new position
</p></li> </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> <li>Compute the ratio \(A = \frac{T(\mathbf{r}_{n+1} \rightarrow \mathbf{r}_{n}) P(\mathbf{r}_{n+1})}{T(\mathbf{r}_{n} \rightarrow \mathbf{r}_{n+1}) P(\mathbf{r}_{n})}\)</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>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>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>
@ -3460,37 +3450,29 @@ Some comments are needed:
</ul> </ul>
\begin{eqnarray*} \begin{eqnarray*}
E = \frac{\sum_{i=1}{N_{\rm MC}} E_L(\mathbf{r}_i) W(\mathbf{r}_i, i\delta t)}{\sum_{i=1}{N_{\rm MC}} W(\mathbf{r}_i, i\delta t)} E = \frac{\sum_{k=1}{N_{\rm MC}} E_L(\mathbf{r}_k) W(\mathbf{r}_k, k\delta t)}{\sum_{k=1}{N_{\rm MC}} W(\mathbf{r}_k, k\delta t)}
\end{eqnarray}
- The result will be affected by a time-step error (the finite size of $\delta t$) and one
has in principle to extrapolate to the limit $\delta t \rightarrow 0$. This amounts to fitting
the energy computed for multiple values of $\delta t$.
- The accept/reject step (steps 2-5 in the algorithm) is not in principle needed for the correctness of
the DMC algorithm. However, its use reduces si
The wave function becomes
\[
\psi(\mathbf{r},\tau) = \Psi_T(\mathbf{r}) W(\mathbf{r},\tau)
\]
and the expression of the fixed-node DMC energy is
\begin{eqnarray*}
E(\tau) & = & \frac{\int \psi(\mathbf{r},\tau) \Psi_T(\mathbf{r}) E_L(\mathbf{r}) d\mathbf{r}}
{\int \psi(\mathbf{r},\tau) \Psi_T(\mathbf{r}) d\mathbf{r}} \\
& = & \frac{\int \left[ \Psi_T(\mathbf{r}) \right]^2 W(\mathbf{r},\tau) E_L(\mathbf{r}) d\mathbf{r}}
{\int \left[ \Psi_T(\mathbf{r}) \right]^2 W(\mathbf{r},\tau) d\mathbf{r}} \\
\end{eqnarray*} \end{eqnarray*}
<ul class="org-ul">
<li>The result will be affected by a time-step error (the finite size of \(\delta t\)) and one</li>
</ul>
<p> <p>
This algorithm is less stable than the branching algorithm: it has in principle to extrapolate to the limit \(\delta t \rightarrow 0\). This amounts to fitting
the energy computed for multiple values of \(\delta t\).
</p>
<p>
Here, you will be using a small enough time-step and you should not worry about the extrapolation.
</p>
<ul class="org-ul">
<li>The accept/reject step (steps 2-5 in the algorithm) is in principle not needed for the correctness of</li>
</ul>
<p>
the DMC algorithm. However, its use reduces significantly the time-step error.
</p>
<p>
PDMC algorithm is less stable than the branching algorithm: it
requires to have a value of \(E_\text{ref}\) which is close to the requires to have a value of \(E_\text{ref}\) which is close to the
fixed-node energy, and a good trial wave function. Its big fixed-node energy, and a good trial wave function. Its big
advantage is that it is very easy to program starting from a VMC advantage is that it is very easy to program starting from a VMC
@ -3499,13 +3481,13 @@ code, so this is what we will do in the next section.
</div> </div>
</div> </div>
<div id="outline-container-org7342b6d" class="outline-3"> <div id="outline-container-org08cac2c" class="outline-3">
<h3 id="org7342b6d"><span class="section-number-3">4.5</span> Hydrogen atom</h3> <h3 id="org08cac2c"><span class="section-number-3">4.5</span> Hydrogen atom</h3>
<div class="outline-text-3" id="text-4-5"> <div class="outline-text-3" id="text-4-5">
</div> </div>
<div id="outline-container-orgc9cbd6b" class="outline-4"> <div id="outline-container-orged492a0" class="outline-4">
<h4 id="orgc9cbd6b"><span class="section-number-4">4.5.1</span> Exercise</h4> <h4 id="orged492a0"><span class="section-number-4">4.5.1</span> Exercise</h4>
<div class="outline-text-4" id="text-4-5-1"> <div class="outline-text-4" id="text-4-5-1">
<div class="exercise"> <div class="exercise">
<p> <p>
@ -3604,8 +3586,8 @@ energy of H for any value of \(a\).
</div> </div>
</div> </div>
<div id="outline-container-org5b7ac88" class="outline-5"> <div id="outline-container-orgde645d7" class="outline-5">
<h5 id="org5b7ac88"><span class="section-number-5">4.5.1.1</span> Solution&#xa0;&#xa0;&#xa0;<span class="tag"><span class="solution">solution</span></span></h5> <h5 id="orgde645d7"><span class="section-number-5">4.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-4-5-1-1"> <div class="outline-text-5" id="text-4-5-1-1">
<p> <p>
<b>Python</b> <b>Python</b>
@ -3821,8 +3803,8 @@ A = 0.98788066666666663 +/- 7.2889356133441110E-005
</div> </div>
<div id="outline-container-orgff35458" class="outline-3"> <div id="outline-container-orgeaede30" class="outline-3">
<h3 id="orgff35458"><span class="section-number-3">4.6</span> <span class="todo TODO">TODO</span> H<sub>2</sub></h3> <h3 id="orgeaede30"><span class="section-number-3">4.6</span> <span class="todo TODO">TODO</span> H<sub>2</sub></h3>
<div class="outline-text-3" id="text-4-6"> <div class="outline-text-3" id="text-4-6">
<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
@ -3843,8 +3825,8 @@ the nuclei.
</div> </div>
<div id="outline-container-orgfed2921" class="outline-2"> <div id="outline-container-orgd092c37" class="outline-2">
<h2 id="orgfed2921"><span class="section-number-2">5</span> <span class="todo TODO">TODO</span> <code>[0/3]</code> Last things to do</h2> <h2 id="orgd092c37"><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>
@ -3860,7 +3842,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-02-01 Mon 12:52</p> <p class="date">Created: 2021-02-01 Mon 20:57</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>