Quantum Theoretical Chemistry, NWI-MOL112 (3EC)
Computer assignment 1
Read the entire assignment before you start coding (26-Mar-2020).
- Use the results of the exercise of week 1 to do a variational
calculation of one particle with mass \(m=1\) (atomic units, \(m_e=1\) and also \(\hbar=1\))
in a one dimensional potential
\[
V_4(x) = x^4.
\]
Use a harmonic oscillator basis (with mass \(m=1\) and force constant \(k=1\))
and study the convergence of the first 4 eigenvalues as a function
of the number of basis functions.
- To keep the code simple: to compute the matrix elements of the potential,
setup the matrix representation \({\bf X}_2\) for the \(x^2\) potential, and
then square the matrix. Note that this is an approximation and the method
is no longer variational. However, you should still be able to converge your energies by increasing the basis.
- Be aware the computed eigenvalues may need to be sorted.
- In Matlab, Octave, and Scilab, A*B is a matrix multiplication. In Python, A*B
is a pointwise multiplication, so you will have to use numpy.
-
Now try different values of force constant \(k\) (keep \(m=1\)) to generate the harmonic
oscillator basis. For which value of \(k\) can you converge
the first four eigenvalues for the \(V_4\) potential to four digits with the smallest
number of basis functions?
-
Plot your potential, basis functions, and solutions. To evaluate the harmonic oscillator
functions, use the recursion relations (see exercise week 1).
- A useful test of your implementation of harmonic oscillator functions is
to compute the norm by numerical integration of the square of the wave functions.
Many mistakes result in the functions not being normalized. You can also
check the orthogonality of the solutions by numerically computing the
scalar product.
Possible optimizations and improvements
Use these only after your code is producing correct results.
- Since the potential is symmetric, there is no coupling between odd and even
harmonic oscillator functions (see Chapter 9 of the lecture notes), so you
can do separate calculations for odd and even parity.
- When studying the convergence as a function of the number of basis function,
setup the Hamiltonian matrix for the largest basis, and then use part of
that matrix to get results for smaller bases. This way, you will not have to
recompute the matrix elements for each basis.
Some intermediate results to help debug your code
The matrix representation of \(x^2\) in an harmonic oscillator
basis with \(m=1\) and \(k=1\) and \(n=0,1,2,3,4,5\)
X2 =
0.50000 0.00000 0.70711 0.00000 0.00000 0.00000
0.00000 1.50000 0.00000 1.22474 0.00000 0.00000
0.70711 0.00000 2.50000 0.00000 1.73205 0.00000
0.00000 1.22474 0.00000 3.50000 0.00000 2.23607
0.00000 0.00000 1.73205 0.00000 4.50000 0.00000
0.00000 0.00000 0.00000 2.23607 0.00000 5.50000
The kinetic energy matrix in the same basis
T =
0.25000 -0.00000 -0.35355 -0.00000 -0.00000 -0.00000
-0.00000 0.75000 -0.00000 -0.61237 -0.00000 -0.00000
-0.35355 -0.00000 1.25000 -0.00000 -0.86603 -0.00000
-0.00000 -0.61237 -0.00000 1.75000 -0.00000 -1.11803
-0.00000 -0.00000 -0.86603 -0.00000 2.25000 -0.00000
-0.00000 -0.00000 -0.00000 -1.11803 -0.00000 2.75000
The eigenvalues should converge to these values:
0.67
2.39
4.70
7.34
Report
Instructions for writing you report are given on the main page.
HTML5-validator
Last updated: 26-Mar-2020, by Gerrit C. Groenenboom.