diff --git a/index.html b/index.html index cbc3560..97316a3 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +We propose different exercises to understand quantum Monte Carlo (QMC) @@ -364,8 +365,8 @@ interpreted as a single precision value
In this section we consider the Hydrogen atom with the following @@ -439,13 +440,13 @@ E & = & \frac{\langle \Psi| \hat{H} | \Psi\rangle}{\langle \Psi |\Psi \rangle} \end{eqnarray*}
@@ -489,8 +490,8 @@ and returns the potential.
@@ -525,8 +526,8 @@ input arguments, and returns a scalar.
@@ -607,8 +608,8 @@ So the local kinetic energy is
@@ -651,14 +652,14 @@ local energy.
@@ -775,8 +776,8 @@ plot './data' index 0 using 1:2 with lines title 'a=0.1', \
If the space is discretized in small volume elements \(\mathbf{r}_i\) @@ -806,8 +807,8 @@ The energy is biased because:
@@ -917,8 +918,8 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002
The variance of the local energy is a functional of \(\Psi\) @@ -931,6 +932,11 @@ energy associated with \(\Psi\) around the average: \sigma^2(E_L) = \frac{\int \left[\Psi(\mathbf{r})\right]^2\, \left[ E_L(\mathbf{r}) - E \right]^2 \, d\mathbf{r}}{\int \left[\Psi(\mathbf{r}) \right]^2 d\mathbf{r}} \] +which can be simplified as +
+ ++\[ \sigma^2(E_L) = \langle E^2 \rangle - \langle E \rangle^2 \]
@@ -940,12 +946,26 @@ energy can be used as a measure of the quality of a wave function.
-Compute a numerical estimate of the variance of the local energy +Prove that : +\[ \sigma^2(E_L) = \langle E^2 \rangle - \langle E \rangle^2 \] +
+ ++Add the calculation of the variance to the previous code, and +compute a numerical estimate of the variance of the local energy in a grid of \(50\times50\times50\) points in the range \((-5,-5,-5) \le \mathbf{r} \le (5,5,5)\) for different values of \(a\). @@ -967,6 +987,7 @@ in a grid of \(50\times50\times50\) points in the range for a in [0.1, 0.2, 0.5, 0.9, 1., 1.5, 2.]: E = 0. + E2 = 0. norm = 0. for x in interval: r[0] = x @@ -978,20 +999,11 @@ in a grid of \(50\times50\times50\) points in the range w = w * w * delta El = e_loc(a, r) E += w * El + E2 += w * El*El norm += w E = E / norm - s2 = 0. - for x in interval: - r[0] = x - for y in interval: - r[1] = y - for z in interval: - r[2] = z - w = psi(a, r) - w = w * w * delta - El = e_loc(a, r) - s2 += w * (El - E)**2 - s2 = s2 / norm + E2 = E2 / norm + s2 = E2 - E*E print(f"a = {a} \t E = {E:10.8f} \t \sigma^2 = {s2:10.8f}")
Numerical integration with deterministic methods is very efficient @@ -1100,8 +1112,8 @@ interval.
To compute the statistical error, you need to perform \(M\) @@ -1141,8 +1153,8 @@ And the confidence interval is given by
@@ -1191,8 +1203,8 @@ input array.
We will now do our first Monte Carlo calculation to compute the @@ -1226,8 +1238,8 @@ statistical error.
@@ -1337,8 +1349,8 @@ E = -0.49588321986667677 +/- 7.1758863546737969E-004
We will now improve the sampling and allow to sample in the whole @@ -1434,8 +1446,8 @@ average energy can be computed as
@@ -1546,8 +1558,8 @@ E = -0.49517104619091717 +/- 1.0685523607878961E-004
We will now use the square of the wave function to make the sampling: @@ -1572,8 +1584,8 @@ the local energies, each with a weight of 1.
To generate the probability density \(\Psi^2\), we consider a @@ -1686,7 +1698,7 @@ variance \(\tau\,2D\).
@@ -1722,7 +1734,7 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P
@@ -1834,8 +1846,8 @@ E = -0.48584030499187431 +/- 1.0411743995438257E-004
Discretizing the differential equation to generate the desired @@ -1896,7 +1908,7 @@ the simulation.