diff --git a/index.html b/index.html index 1efa19b..0e74cac 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +[0/3]
Last things to do[0/3]
Last things to doThis website contains the QMC tutorial of the 2021 LTTC winter school @@ -508,12 +507,88 @@ is defined everywhere, continuous, and infinitely differentiable. All the quantities are expressed in atomic units (energies, coordinates, etc).
-+** Energy and local energy +
+ ++For a given system with Hamiltonian \(\hat{H}\) and wave function \(\Psi\), we define the local energy as +
+ ++\[ + E_L(\mathbf{r}) = \frac{\hat{H} \Psi(\mathbf{r})}{\Psi(\mathbf{r})}, + \] +
+ ++where \(\mathbf{r}\) denotes the 3N-dimensional electronic coordinates. +
+ ++The electronic energy of a system, \(E\), can be rewritten in terms of the +local energy \(E_L(\mathbf{r})\) as +
+ +\begin{eqnarray*} +E & = & \frac{\langle \Psi| \hat{H} | \Psi\rangle}{\langle \Psi |\Psi \rangle} + = \frac{\int \Psi(\mathbf{r})\, \hat{H} \Psi(\mathbf{r})\, d\mathbf{r}}{\int \left[\Psi(\mathbf{r}) \right]^2 d\mathbf{r}} \\ + & = & \frac{\int \left[\Psi(\mathbf{r})\right]^2\, \frac{\hat{H} \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\,d\mathbf{r}}{\int \left[\Psi(\mathbf{r}) \right]^2 d\mathbf{r}} + = \frac{\int \left[\Psi(\mathbf{r})\right]^2\, E_L(\mathbf{r})\,d\mathbf{r}}{\int \left[\Psi(\mathbf{r}) \right]^2 d\mathbf{r}} +\end{eqnarray*} + ++For few dimensions, one can easily compute \(E\) by evaluating the integrals on a grid but, for a high number of dimensions, one can resort to Monte Carlo techniques to compute \(E\). +
+ ++To this aim, recall that the probabilistic expected value of an arbitrary function \(f(x)\) +with respect to a probability density function \(p(x)\) is given by +
+ ++\[ \langle f \rangle_p = \int_{-\infty}^\infty p(x)\, f(x)\,dx, \] +
+ ++where a probability density function \(p(x)\) is non-negative +and integrates to one: +
+ ++\[ \int_{-\infty}^\infty p(x)\,dx = 1. \] +
+ ++Similarly, we can view the the energy of a system, \(E\), as the expected value of the local energy with respect to +a probability density \(p(\mathbf{r}}\) defined in 3\(N\) dimensions: +
+ ++\[ E = \int E_L(\mathbf{r}) p(\mathbf{r})\,d\mathbf{r}} \equiv \langle E_L \rangle_{\Psi^2}\,, \] +
+ ++where the probability density is given by the square of the wave function: +
+ ++\[ p(\mathbf{r}) = \frac{|Psi(\mathbf{r}|^2){\int \left |\Psi(\mathbf{r})|^2 d\mathbf{r}}\,. \] +
+ ++If we can sample configurations \(\{\mathbf{r}\}\) distributed as \(p\), we can estimate \(E\) as the average of the local energy computed over these configurations: +
+ ++$$ E ≈ \frac{1}{M} ∑i=1M EL(\mathbf{r}i} \,. +
+ +In this section, we consider the hydrogen atom with the following wave function: @@ -540,62 +615,15 @@ eigenfunction of the Hamiltonian To do that, we will compute the local energy, defined as
--\[ - E_L(\mathbf{r}) = \frac{\hat{H} \Psi(\mathbf{r})}{\Psi(\mathbf{r})}, - \] -
and check whether it is constant.
- --In general, the electronic energy of a system, \(E\), can be rewritten as the expectation value of the -local energy \(E(\mathbf{r})\) with respect to the 3N-dimensional -electron density given by the square of the wave function: -
- -\begin{eqnarray*} -E & = & \frac{\langle \Psi| \hat{H} | \Psi\rangle}{\langle \Psi |\Psi \rangle} - = \frac{\int \Psi(\mathbf{r})\, \hat{H} \Psi(\mathbf{r})\, d\mathbf{r}}{\int \left[\Psi(\mathbf{r}) \right]^2 d\mathbf{r}} \\ - & = & \frac{\int \left[\Psi(\mathbf{r})\right]^2\, \frac{\hat{H} \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\,d\mathbf{r}}{\int \left[\Psi(\mathbf{r}) \right]^2 d\mathbf{r}} - = \frac{\int \left[\Psi(\mathbf{r})\right]^2\, E_L(\mathbf{r})\,d\mathbf{r}}{\int \left[\Psi(\mathbf{r}) \right]^2 d\mathbf{r}} - = \langle E_L \rangle_{\Psi^2}\,, -\end{eqnarray*} --where \(\mathbf{r}\) is the vector of the 3N-dimensional electronic coordinates (\(N=1\) for the hydrogen atom). -
- --For a small number of dimensions, one can compute \(E\) by evaluating the integrals on a grid. However, -
- --The probabilistic expected value of an arbitrary function \(f(x)\) -with respect to a probability density function \(p(x)\) is given by -
- --\[ \langle f \rangle_p = \int_{-\infty}^\infty p(x)\, f(x)\,dx, \] -
- --where probability density function \(p(x)\) is non-negative -and integrates to one: -
- --\[ \int_{-\infty}^\infty p(x)\,dx = 1. \] -
Write all the functions of this section in a single file :
hydrogen.py
if you use Python, or hydrogen.f90
is you use
@@ -617,9 +645,9 @@ to catch the error.
Write a function which computes the potential at \(\mathbf{r}\). @@ -662,9 +690,9 @@ and returns the potential.
Python
@@ -703,9 +731,9 @@ and returns the potential.Write a function which computes the wave function at \(\mathbf{r}\). @@ -739,9 +767,9 @@ input arguments, and returns a scalar.
Python
@@ -767,9 +795,9 @@ input arguments, and returns a scalar.Write a function which computes the local kinetic energy at \(\mathbf{r}\). @@ -849,9 +877,9 @@ So the local kinetic energy is
Python
@@ -891,9 +919,9 @@ So the local kinetic energy isWrite a function which computes the local energy at \(\mathbf{r}\), @@ -935,9 +963,9 @@ local kinetic energy.
Python
@@ -966,9 +994,9 @@ local kinetic energy.Find the theoretical value of \(a\) for which \(\Psi\) is an eigenfunction of \(\hat{H}\). @@ -977,9 +1005,9 @@ Find the theoretical value of \(a\) for which \(\Psi\) is an eigenfunction of \(
The potential and the kinetic energy both diverge at \(r=0\), so we @@ -1010,9 +1038,9 @@ choose a grid which does not contain the origin.
For multiple values of \(a\) (0.1, 0.2, 0.5, 1., 1.5, 2.), plot the @@ -1094,9 +1122,9 @@ plot './data' index 0 using 1:2 with lines title 'a=0.1', \
Python
@@ -1170,9 +1198,9 @@ plt.savefig("plot_py.png")If the space is discretized in small volume elements \(\mathbf{r}_i\) of size \(\delta \mathbf{r}\), the expression of \(\langle E_L \rangle_{\Psi^2}\) @@ -1201,9 +1229,9 @@ The energy is biased because:
Compute a numerical estimate of the energy in a grid of @@ -1271,9 +1299,9 @@ To compile the Fortran and run it:
Python
@@ -1387,9 +1415,9 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002The variance of the local energy is a functional of \(\Psi\) which measures the magnitude of the fluctuations of the local @@ -1415,9 +1443,9 @@ energy can be used as a measure of the quality of a wave function.
Prove that : @@ -1427,9 +1455,9 @@ Prove that :
\(\bar{E} = \langle E \rangle\) is a constant, so \(\langle \bar{E} \rangle = \bar{E}\) . @@ -1447,9 +1475,9 @@ Prove that :
Add the calculation of the variance to the previous code, and @@ -1522,9 +1550,9 @@ To compile and run:
Python
@@ -1660,9 +1688,9 @@ a = 2.0000000000000000 E = -8.0869806678448772E-002 s2 = 1.8068814Numerical integration with deterministic methods is very efficient in low dimensions. When the number of dimensions becomes large, @@ -1677,9 +1705,9 @@ interval.
To compute the statistical error, you need to perform \(M\) independent Monte Carlo calculations. You will obtain \(M\) different @@ -1718,9 +1746,9 @@ And the confidence interval is given by
Write a function returning the average and statistical error of an @@ -1757,9 +1785,9 @@ input array.
Python
@@ -1817,9 +1845,9 @@ input array.We will now do our first Monte Carlo calculation to compute the energy of the hydrogen atom. @@ -1852,9 +1880,9 @@ compute the statistical error.
Parameterize the wave function with \(a=0.9\). Perform 30 @@ -1953,9 +1981,9 @@ well as the index of the current step.
Python
@@ -2068,9 +2096,9 @@ E = -0.49518773675598715 +/- 5.2391494923686175E-004We will now use the square of the wave function to sample random points distributed with the probability density @@ -2157,9 +2185,9 @@ step such that the acceptance rate is close to 0.5 is a good compromise.
Modify the program of the previous section to compute the energy, @@ -2265,9 +2293,9 @@ Can you observe a reduction in the statistical error?
Python
@@ -2411,9 +2439,9 @@ A = 0.51695266666666673 +/- 4.0445505648997396E-004
To obtain Gaussian-distributed random numbers, you can apply the
Box Muller transform to uniform random numbers:
@@ -2474,9 +2502,9 @@ In Python, you can use the
-
One can use more efficient numerical schemes to move the electrons,
but the Metropolis accepation step has to be adapted accordingly:
@@ -2574,9 +2602,9 @@ The transition probability becomes:
Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\Psi(\mathbf{r})}\).
@@ -2609,9 +2637,9 @@ Write a function to compute the drift vector \(\frac{\nabla \Psi(\mathbf{r})}{\P
Python
Modify the previous program to introduce the drifted diffusion scheme.
@@ -2738,9 +2766,9 @@ Modify the previous program to introduce the drifted diffusion scheme.
Python
Consider the time-dependent Schrödinger equation:
The diffusion equation of particles is given by
In a molecular system, the potential is far from being constant,
and diverges at inter-particle coalescence points. Hence, when the
@@ -3102,9 +3130,9 @@ error known as the fixed node error.
\[
-\frac{\partial \psi(\mathbf{r},\tau)}{\partial \tau} \Psi_T(\mathbf{r}) =
@@ -3165,9 +3193,9 @@ Defining \(\Pi(\mathbf{r},t) = \psi(\mathbf{r},\tau)
Now that we have a process to sample \(\Pi(\mathbf{r},\tau) =
\psi(\mathbf{r},\tau) \Psi_T(\mathbf{r})\), we can compute the exact
@@ -3218,9 +3246,9 @@ energies computed with the trial wave function.
Instead of having a variable number of particles to simulate the
branching process, one can choose to sample \([\Psi_T(\mathbf{r})]^2\) instead of
@@ -3271,14 +3299,14 @@ code, so this is what we will do in the next section.
Modify the Metropolis VMC program to introduce the PDMC weight.
@@ -3376,9 +3404,9 @@ energy of H for any value of \(a\).
Python
We will now consider the H2 molecule in a minimal basis composed of the
\(1s\) orbitals of the hydrogen atoms:
@@ -3615,9 +3643,9 @@ the nuclei.
3.5 Generalized Metropolis algorithm
-2.5 Generalized Metropolis algorithm
+3.5.1 Exercise 1
-2.5.1 Exercise 1
+3.5.1.1 Solution solution
-2.5.1.1 Solution solution
+3.5.2 Exercise 2
-2.5.2 Exercise 2
+3.5.2.1 Solution solution
-2.5.2.1 Solution solution
+4 Diffusion Monte Carlo solution
-3 Diffusion Monte Carlo solution
+4.1 Schrödinger equation in imaginary time
-3.1 Schrödinger equation in imaginary time
+4.2 Diffusion and branching
-3.2 Diffusion and branching
+4.3 Importance sampling
-3.3 Importance sampling
+4.3.1 Appendix : Details of the Derivation
-3.3.1 Appendix : Details of the Derivation
+4.4 Fixed-node DMC energy
-3.4 Fixed-node DMC energy
+4.5 Pure Diffusion Monte Carlo (PDMC)
-3.5 Pure Diffusion Monte Carlo (PDMC)
+4.6 Hydrogen atom
-3.6 Hydrogen atom
+4.6.1 Exercise
-3.6.1 Exercise
+4.6.1.1 Solution solution
-3.6.1.1 Solution solution
+4.7 TODO H2
-3.7 TODO H2
+5 TODO
-[0/3]
Last things to do4 TODO
+[0/3]
Last things to do
[ ]
Give some hints of how much time is required for each section[ ]
Prepare 4 questions for the exam: multiple-choice questions
@@ -3632,7 +3660,7 @@ the H\(_2\) molecule at $R$=1.4010 bohr. Answer: 0.17406 a.u.