Sie sind auf Seite 1von 2

Computational Physics - Exercise 5

Toon Verstraelen, Maarten Cools-Ceuppens


December 5 & 12, 2017

0 Python Primer
In order to guarantee that all students have the required Python skills to solve the Hartree-Fock
exercises, a Python Primer is provided. The script ex_000_primer/primer.py is a python
program that consists of eight sections. Each section introduces a new Python feature, some
example code and a problem that can be solved once the corresponding feature is understood.
When all eight problems are solved, the script should run without an error message. Run the
script after solving each problem (in order) to see if your solution works:
cd ex_000_primer/
./primer.py

1 The hydrogen atom


The directory ex_001_hydrogen/ contains a data file, data.npz, with all matrix elements
defined in the derivation of Hartree-Fock, as computed with the Aug-cc-pVDZ Gaussian basis set
for Hydrogen in atomic units. The script hydrogen.py loads this datafile. All arrays with matrix
elements can be accessed through the data dictionary.
data['oi'] # overlap integrals.
data['ki'] # kinetic energy integrals.
data['nai'] # nuclear attraction integrals.
data['eri'] # Electronic repulsion integrals.
Print the shapes of these arrays and verify that they are all consistent. Construct a matrix that
represents the Hamiltonian of the neutral hydrogen atom. (This system contains just one
electron, so one does not need Hartree-Fock to treat this problem.) Compute the eigenstates and
compare to the analytic result. Explain the deviations.

2 The helium atom


The directory ex_002_helium/ is very similar to ex_001_hydrogen/. The matrix elements are
loaded in the same way into the example program. These matrix elements are computed with the
Aug-cc-pVDZ Gaussian basis set in atomic units for Helium. Extend the program such that it
computes the HF energy for Helium. One may assume that the lowest spatial orbital is occupied
with one spin-up (alpha) and one spin-down (beta) electron and that the restricted closed-shell
Hartree-Fock is suitable. For the computation of the wavefunction, it is sufficient to only consider
the alpha electrons because the beta electrons have the same spatial orbitals. Such a computation
consists of the following steps:
1. Construct an initial guess for the wavefunction as follows: solve the core Hamiltonian, that
is the Hamiltonian that only contains contributions from the kinetic energy and nuclear
attraction terms.
2. Compute the density matrix of the initial guess for the alpha electrons.
3. The SCF Loop (use a `while True:` loop)

Page 1/2
a. Construct the Fock matrix for the alpha electrons. This consists of a kinetic energy,
nuclear attraction, Hartree and exchange term. Take the correct linear combination of
these operators.
b. Check if the old orbitals already diagonalize the Fock matrix. Propose a measure to
compute the error. If this error drops below a pre-defined threshold, the loop can be
interrupted.
c. Diagonalize the Fock matrix to obtain a new set of alpha orbitals and alpha orbital
energies. Construct a new density matrix
4. Compute the Hartree-Fock energy.
Some results to check your program:
• The lowest orbital energy of the initial guess is: -1.99436423289 Eh.
• The lowest orbital energy of the HF solution is: -0.917123967703 Eh.
• The HF energy is -2.85570466771 Eh.

3 The dissociation of the hydrogen molecule


The directory structure of ex_003_h2diss/ is again similar to that of the previous example. The
main difference is that a series of data files is provided, all for different H-H distances. Solve the
following two problems:
1. Copy and modify the Helium program (with an additional outer loop) to compute the total
energy as a function of the H-H distance. The coordinates of the atoms are stored in the
array data['coordinates'].
2. Make a copy of the first H2 program and modify it to compute the unrestricted open-shell
Hartree-Fock energy for the case that the two electrons have the same spin and occupy
the two lowest spatial orbitals. This is a special case of UHF because there are only alpha
electrons and no beta electrons. It is sufficient to construct only the alpha orbitals.
Collect the results of both programs in one nice plot. You should get something similar to slide 71
of part 1.

4 A ring of 32 hydrogen atoms: metal-insulator transition


The directory ex_004_h32ring/ contains two data files. Each file contains the integrals for a
system containing 32 hydrogen atoms placed on a circle, computed with the STO-3G basis. In one
case (data0.npz) the distances between neighboring hydrogen atoms alternate (1.0 and 1.4 a 0).
In the other case (data1.npz), all spacings are identical to 1.2 a0.
Run restricted Hartree-Fock computations on both cases and answer the following questions:
• Which case shows metallic behavior and which case is a better model for an insulator.
• Which is the most stable? Can this be related to the orbital energies and the
breaking/restoring of the symmetry?

Page 2/2

Das könnte Ihnen auch gefallen