Skip to content

Commit

Permalink
'varml
Browse files Browse the repository at this point in the history
  • Loading branch information
DPotoyan authored Nov 22, 2024
1 parent a1aa263 commit 88a8ace
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 41 deletions.
65 changes: 37 additions & 28 deletions ch06/lin_var.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@
"cell_type": "markdown",
"metadata": {},
"source": [
":::{admonition} What you need to know\n",
":::{admonition} **What You Need to Know**\n",
":class: note\n",
"\n",
"- The variational method is a powerful method that can be used to determine upper bounds and approximations for ground state energies of numerous quantum mechanical problems. \n",
"- The variational method is used heavily in electronic structure theories such as Hartree Fock.\n",
"- The linear varaation method is seeking solutions to Schrodinger equation by expressing trial wavefunctions as linear combinations of easy to compute functions like gaussians or exponential.\n",
"- The linear variational method converts Schrodinger equation into linear algebra problem of finding eigenvalues (energies) and eigenvectors (coefficients in linear combination)\n",
"- The variational method is a powerful tool for estimating upper bounds and approximations for ground-state energies in a wide range of quantum mechanical problems. \n",
"- It plays a key role in electronic structure theories, such as Hartree-Fock. \n",
"- The **linear variational method** seeks solutions to the Schrödinger equation by representing trial wavefunctions as linear combinations of simple, computationally efficient functions, such as Gaussians or exponentials. \n",
"- By applying the linear variational method, the Schrödinger equation is transformed into a linear algebra problem, where the goal is to find eigenvalues (representing energies) and eigenvectors (providing coefficients for the linear combination). \n",
"\n",
":::"
":::\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Linearizing the pproblem"
"### Linearizing the problem"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"How does this help us in practice? In a typical QM problem, we are attempting to solve for the wavefunction(s) and energy(ies) for a given Hamiltonian. If the Hamiltonian is such that solving the problem exactly is too challenging (e.g. any two or more electron problem) we can expand the wavefunction in a basis and attempt to solve the problem that way. We start with \n",
"- How does linearization help us in practice? In a typical QM problem, we are attempting to solve for the wavefunction(s) and energy(ies) for a given Hamiltonian. If the Hamiltonian is such that solving the problem exactly is too challenging (e.g. any two or more electron problem) we can expand the wavefunction in a basis and attempt to solve the problem that way. We start with \n",
"\n",
"$$\\psi \\approx \\phi = \\sum_n^N c_nf_n$$\n",
"\n",
"Truncating this expansion at any finite $n$ leads to an approximate solution. Also, what the variational principle tells us is that we can minimize the energy with respect to variational paramters ${c_n}$ and still have $E_\\phi \\geq E_0$. "
"- Truncating this expansion at any finite $n$ leads to an approximate solution. Also, what the variational principle tells us is that we can minimize the energy with respect to variational paramters ${c_n}$ and still have $E_\\phi \\geq E_0$. "
]
},
{
Expand All @@ -52,9 +52,10 @@
"\n",
"- There is currently no need to define these functions explicitly so we will leave them as generic functions $f_1$ and $f_2$. We now solve for the energy\n",
"\n",
"$$E_\\phi = \\frac{\\langle\\phi|\\hat{H}|\\phi\\rangle}{\\langle\\phi|\\phi\\rangle}$$\n",
"$$E_\\phi = \\frac{\\langle\\phi|\\hat{H}|\\phi\\rangle}{\\langle\\phi|\\phi\\rangle} = \\frac{\\langle c_1f_1 + c_2f_2|\\hat{H}|c_1f_1 + c_2f_2 \\rangle}{\\langle c_1f_1 + c_2f_2|c_1f_1 + c_2f_2 \\rangle}$$\n",
"\n",
"$$ = \\frac{\\langle c_1f_1 + c_2f_2|\\hat{H}|c_1f_1 + c_2f_2 \\rangle}{\\langle c_1f_1 + c_2f_2|c_1f_1 + c_2f_2 \\rangle}$$\n",
":::{admonitition} **Express probelm in terms of coeeficients and matrix elements**\n",
":class: dropdown\n",
"\n",
"- Let's investigate the numerator and denomenator separately. We start with the numerator\n",
"\n",
Expand All @@ -77,45 +78,53 @@
"$$S_{ij} = \\langle f_i|f_j\\rangle$$\n",
"\n",
"where $S_{ij}$ is another matrix element but this time referred to as the basis function overlap.Now we have that the energy of the trial wavefunction is\n",
":::\n",
"\n",
"$$E_\\phi = \\frac{c_1^2 H_{11} + 2c_1c_2H_{12} + c_2^2H_{22}}{c_1^2S_{11} + 2c_1c_2S_{12} + c_2^2S_{22}}$$"
"\n",
"$$E_\\phi = \\frac{c_1^2 H_{11} + 2c_1c_2H_{12} + c_2^2H_{22}}{c_1^2S_{11} + 2c_1c_2S_{12} + c_2^2S_{22}}$$\n",
"\n",
"- $H_{ij} = \\langle f_i |\\hat{H}|f_j\\rangle$ **Hamiltonian matrix element expressed in basis of $f$**\n",
"- $S_{ij} = \\langle f_i|f_j\\rangle$ **S matrix element or overlap integral expressed in basis of $f$**. This one measures how similiar $f_i$ is to $f_j$. \n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Eigenvalue problem\n",
"### Eigenvalue Problem\n",
"\n",
"- Since $E_\\phi \\geq E_0$ for any trial function $\\phi$, we can minimize the energy $E_\\phi$ by varying the parameters $c_1$ and $c_2$. \n",
"\n",
"- Since $E_\\phi \\geq E_0$ for any function $\\phi$ we can minimize the energy, $E_\\phi$, with respect to variational paramters $c_1$ and $c_2$. We start by minimizing with respect to $c_1$ which equates to differentiating the energy with respect to $c_1$ and setting that derivative to zero\n",
"- To minimize with respect to $c_1$, we differentiate $E_\\phi$ with respect to $c_1$ and set the derivative equal to zero:\n",
"\n",
"$$\\frac{\\partial E_\\phi}{\\partial c_1} = 0 = c_1(H_{11}-ES_{11}) + c_2(H_{12}-ES_{12})$$\n",
" $$\\frac{\\partial E_\\phi}{\\partial c_1} = 0 = c_1(H_{11} - ES_{11}) + c_2(H_{12} - ES_{12})$$\n",
"\n",
"- Similarly, minimizing with respect to $c_2$ we get\n",
"- Similarly, minimizing with respect to $c_2$ gives:\n",
"\n",
"$$\\frac{\\partial E_\\phi}{\\partial c_2} = 0 = c_1(H_{12}-ES_{12}) + c_2(H_{22}-ES_{22})$$\n",
" $$\\frac{\\partial E_\\phi}{\\partial c_2} = 0 = c_1(H_{12} - ES_{12}) + c_2(H_{22} - ES_{22})$$\n",
"\n",
"- We can rewrite the above two coupled linear equations as a matrix equation\n",
"- These two coupled linear equations can be expressed compactly as a matrix equation:\n",
"\n",
"$$\\begin{bmatrix} H_{11}-ES_{11} & H_{12}-ES_{12} \\\\ H_{12}-ES_{12} & H_{22}-ES_{22} \\end{bmatrix}\\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} = 0$$\n",
" $$\\begin{bmatrix} H_{11} - ES_{11} & H_{12} - ES_{12} \\\\ H_{12} - ES_{12} & H_{22} - ES_{22} \\end{bmatrix} \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} = 0$$\n",
"\n",
"- We can rewrite the left most matrix as a difference of two matrices and then add to both sides:\n",
"- The matrix on the left can be rewritten as the difference between two matrices:\n",
"\n",
"$$\\left(\\begin{bmatrix} H_{11} & H_{12} \\\\ H_{12} & H_{22} \\end{bmatrix} - \\begin{bmatrix} ES_{11} & ES_{12} \\\\ ES_{12} & ES_{22} \\end{bmatrix} \\right) \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} = 0$$\n",
" $$\\left(\\begin{bmatrix} H_{11} & H_{12} \\\\ H_{12} & H_{22} \\end{bmatrix} - E \\begin{bmatrix} S_{11} & S_{12} \\\\ S_{12} & S_{22} \\end{bmatrix} \\right) \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} = 0$$\n",
"\n",
"$$\\Rightarrow \\begin{bmatrix} H_{11} & H_{12} \\\\ H_{12} & H_{22} \\end{bmatrix} \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} = \\begin{bmatrix} ES_{11} & ES_{12} \\\\ ES_{12} & ES_{22} \\end{bmatrix} \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} $$\n",
"- Rearranging, we can write:\n",
"\n",
"$$ \\begin{bmatrix} H_{11} & H_{12} \\\\ H_{12} & H_{22} \\end{bmatrix} \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} = E\\begin{bmatrix} S_{11} & S_{12} \\\\ S_{12} & S_{22} \\end{bmatrix} \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} $$\n",
" $$\\begin{bmatrix} H_{11} & H_{12} \\\\ H_{12} & H_{22} \\end{bmatrix} \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix} = E \\begin{bmatrix} S_{11} & S_{12} \\\\ S_{12} & S_{22} \\end{bmatrix} \\begin{bmatrix} c_1 \\\\ c_2 \\end{bmatrix}$$\n",
"\n",
"- or, written in more general matrix notation, \n",
"- In more compact matrix notation, this becomes:\n",
"\n",
"$$\\mathbf{H}\\mathbf{c} = E\\mathbf{S}\\mathbf{c}$$\n",
" $$\\mathbf{H}\\mathbf{c} = E\\mathbf{S}\\mathbf{c}$$\n",
"\n",
"- If we now left multiply both sides of the above equation by $\\mathbf{S}^{-1}$ we see that we have an eigenvalue-eigenvector problem\n",
"- By left-multiplying both sides by $\\mathbf{S}^{-1}$, we transform this into a standard eigenvalue problem:\n",
"\n",
"$$\\mathbf{S}^{-1}\\mathbf{H}\\mathbf{c} = E\\mathbf{I}\\mathbf{c}$$\n",
" $$\\mathbf{S}^{-1}\\mathbf{H}\\mathbf{c} = E\\mathbf{I}\\mathbf{c}$$\n",
"\n",
"- Thus the minimum energies are the eigenvalues of $\\mathbf{S}^{-1}\\mathbf{H}$ and the variational parameters that minimize the energies are the eigenvectors of $\\mathbf{S}^{-1}\\mathbf{H}$."
"- Therefore, the minimum energies correspond to the eigenvalues of $\\mathbf{S}^{-1}\\mathbf{H}$, and the variational parameters that minimize the energies are the eigenvectors of $\\mathbf{S}^{-1}\\mathbf{H}$. \n"
]
},
{
Expand Down
55 changes: 42 additions & 13 deletions ch06/note02.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@

## Variational Method

:::{admonition} What you need to know
:::{admonition} **What you need to know**
:class: note

1. **Analytical Solutions of the Schrödinger Equation**
- The Schrödinger equation can be solved analytically only for simple systems.
- For atomic systems, the hydrogen atom represents the most complex case with an analytical solution.
- For systems with multiple interacting electrons, such as the helium atom or other multi-electron systems, analytical solutions become intractable.

- The Schrodinger equation can only be solved analytically for simple systems, which consist of just one particle. When many particles interact e.g He atom and other mulit-electron systems, analytic solution is not possible.
- It is important to develop approximate methods for finding the solutions and to be able to evaluate how close the approximate solution is to the correct one.
- Variational method provides a powerful tool to make systematic approximations and quantiatively measure convergence of predictions towards true values.
- In variational method one first makes an "educated" guess by picking trial functions for the hamiltonian. One then minimizes parameters of the trial function to get solutions closer to the truth.
- Variational method, when applied to linear combination of trial functions can turn hard QM problem into an easier linear algebra task: solution of systems of linear equations. Instead of solving differentiation equations for eignefunctions/eigenvalues we instead are solving for matrix eigevnalues and eigenvectors.
2. **Need for Approximation Methods**
- Approximation methods are essential for finding solutions to complex quantum systems.
- These methods enable us to estimate solutions and evaluate how close the approximate results are to the true values.

3. **The Variational Method**
- The variational method provides a systematic approach for making approximations.
- It allows for a quantitative assessment of the convergence of predictions towards exact values.

4. **Core Idea of the Variational Method**
- Begin with an "educated guess" by selecting a trial function to represent the wavefunction of the system.
- Adjust the parameters of the trial function to minimize the energy, bringing the solution closer to the exact value.

5. **Advantages of the Variational Method**
- By using a linear combination of trial functions, the variational method transforms a difficult quantum mechanics problem into a more tractable linear algebra task.
- Instead of solving differential equations to find eigenfunctions and eigenvalues, we solve for the eigenvalues and eigenvectors of a matrix.
:::


Expand All @@ -18,21 +32,31 @@

- The variational method states, that for any trial function $\mid \phi \rangle$ The energy computed will always be greater or equal to exact (or true) energy.

::::{admonition}
:class: important

$$
E_{\phi}=\frac{\langle \phi \mid \hat{H} \mid \phi\rangle}{\langle \phi \mid \phi\rangle} \geq E_0
$$

- Where $\hat{H}$ is the Hamiltonian and $E_0$ is the true ground-state energy. Note that the trial function is not generally normalized. The expression simplifies when trial function is normalized beforehand $\langle \phi \mid \phi\rangle=1$
- $\hat{H}$ is the Hamiltonian of the problem we want to solve
- $|\phi\rangle$ is a trial wavefunction with unkown parameters we want to determine
- $E_0$ is the true ground-state energy which generally not known to us

:::

- Note that when we have a trail wavefunction we do not have it normalized hence the need to divide by $\langle \phi \mid \phi\rangle$.
- The expression simplifies when trial function is normalized beforehand $\langle \phi \mid \phi\rangle=1$

- If the true ground-state wavefunction $\psi_0$ is inserted in place of $\psi_t$, the equality is reached. For all other wavefunctions (often called trial wavefunctions) the energy expectation value (i.e. the left side) will always be larger. The ratio on the first line is also called the ``Rayleigh ratio''.

**Consequences of Variational theorem**
### Consequences of Variational theorem

1. Ground state energy is the lowest possible energy for the system.
1. **Ground state energy is the lowest possible energy for the system.**

2. By minimizing the energy functions we can make most accurate prediction for a given trail function.
2. **By minimizing the energy functions we can make most accurate prediction for a given trail function.**

3. More parameters give us more handles to vary and get more acurate solutions.
3. **More parameters give us more handles to vary and get more acurate solutions.**


:::{admonition} **Example**
Expand Down Expand Up @@ -68,7 +92,7 @@ As indicated above, this gives an upper limit for the ground state energy $E_1$.
:::

:::{admonition} **Solution**
:class: note
:class: note, dropdown

- plug the trial function into energy expression computing energy as a function of a parmater $\alpha$

Expand Down Expand Up @@ -151,12 +175,15 @@ $${\psi(r_1)\psi(r_2) = \frac{1}{\sqrt{\pi}}\left(\frac{Z}{a_0}\right)^{3/2}e^{-
=\frac{1}{\pi}\left(\frac{Z}{a_0}\right)^3e^{-Z(r_1 + r_2)/a_0}}$$

### Consequences of independent electron approximation

- For a ground state He atom both electron reside on the lowest energy orbital and therefore the total wavefunction is $\psi(r_1,r_2) = \psi(r_1)\psi(r_2) = \psi(1)\psi(2) = 1s(1)1s(2)$. The energy obtained from this approximation is not sufficiently accurate (missing electron -- electron repulsion) but the wavefunction can be used for qualitative analysis. The variational principle gives a systematic way to asses how good our approximation is.

- The exact ground state energy has been found (very extensive analytic \& numerical calculations) as -79.0 eV. By using the approximate wavefunction, we can calculate the expectation value for energy. This yields -74.8 eV and thus the error in energy for this wavefunction is -5.2 eV. Note that the approximate value is, in accordance with the variational principle, higher than the true energy.

### A better approximation

- We can take the wavefunction from the previous step and use the nuclear charge $Z$ as a variational parameter. The variational principle states that minimization of the energy expectation value with respect to $Z$ should approach the true value from above (but obviously will not reach it).

- By judging the energy, we can say that this new wavefunction is better than the previous wavefunction. The obtained value of $Z$ is less than the true $Z$ (= 2). This can be understood in terms of electrons shielding the nucleus from each other and hence giving a reduced nuclear charge.

$${E = \langle\psi |\hat{H}|\psi\rangle = ... = \left[ Z^2 - \frac{27Z}{8}\right]\frac{e^2}{4\pi\epsilon_0a_0}}$$
Expand Down Expand Up @@ -197,7 +224,9 @@ $$\Gamma\left[\frac{1}{2}\right] = \sqrt{\pi}$$



:::{dropdown} **Solution**
:::{admonition} **Solution**
:class: dropdown

Use the variational principle and employ spherical coordinates in integrations:\\

$E = \frac{\int\psi^*_{trial}H\psi_{trial}d\tau}{\int\psi^*_{trial}\psi_{trial}d\tau}$
Expand Down

0 comments on commit 88a8ace

Please sign in to comment.