Exercise 3
Part of the course Computational Chemistry.
Potential energy surfaces are models and exist in a wide range of complexity.
Task 3.1: Free atoms
An (overly simplistic) model is to estimate the energy of each atom to be \(-\frac{1}{2}Z^{7/3}\). Write a python function get_energy(list_of_elements: list[str]) -> float
which returns the total energy for elements until Z=10. For carbon monoxide, the function would be called like get_energy(['C', 'O'])
.
Optional: for those who are a bit more fluent in python, write the function to instead accept sum formulas as strings, such as "C6H6", i.e. get_energy(elements: str) -> float
.
Task 3.2: Harmonic potentials
In the previous model, there were no bonds. A simple model of bonds is a harmonic potential. Consider carbon dioxide this time. Assume a potential where each bond has an equilibrium bond length of \(b_0\) and the energy depending on the actual bond length is \(a(b-b_0)^2\). Write a function co2_energy(b_left: float, b_right: float, a: float, b_0: float) -> float
where b_left
and b_right
are the two bond lengths. Choose some values for both \(a\) and \(b_0\) and plot the potential energy surface if the central carbon atom is moved along the axis of a linear carbon dioxide molecule. You may use matplotlib
for plotting.
Task 3.3: Minimize potential
Write a function implementing gradient descent to optimize the harmonic potential from 3.2. Can you tell beforehand what the solution will be?
Task 3.4: Describe BFGS
Describe in at most three sentences the core idea of BFGS and how this is more efficient than the Newton method for minimisation.