Homework Assignment

HW 29 — Golden Section Search on the Buckingham Potential

📘 Related: Lesson 29 🛠 MATLAB required

📖 Background

The Buckingham potential is an empirical model for the interaction energy between two neutral atoms or molecules. Unlike the simpler Lennard-Jones potential, it uses an exponential repulsion term. For a pair of atoms separated by distance \(r\), the potential is:

\[ V(r) = \left(\frac{\sigma}{r}\right)^6 - \exp\!\left(-\frac{r}{\sigma}\right) \]

where \(\sigma\) is a length scale parameter. The equilibrium separation \(r^*\) — the distance at which the atoms are in their lowest-energy configuration — is the minimum of \(V(r)\).

In this assignment you will write general-purpose UDFs for bracketing and GSS, then apply them to locate \(r^*\) for \(\sigma = 10^{-9}\) m (1 nm). The UDFs must accept any function handle as input — do not hard-code \(V(r)\) inside the UDF.

More information about the Buckingham potential: wikipedia.org/wiki/Buckingham_potential

Tasks

Part 1 — Bracketing UDF

  1. Write a MATLAB UDF called bracket_min that finds a bracket \([a, b, c]\) for the minimum of a 1D function. The inputs should be a function handle, an initial guess \(x_0\), and an initial step size \(\Delta_0\). The outputs should be the three bracket points \(a < b < c\) satisfying \(f(b) < f(a)\) and \(f(b) < f(c)\).
  2. Apply your UDF to the Buckingham potential \(V(r)\) with \(\sigma = 10^{-9}\) m, an initial guess of \(x_0 = 1.5 \times 10^{-9}\) m, and an initial step size of \(\Delta_0 = 10^{-10}\) m. Report the bracket you find.

Part 2 — GSS UDF

  1. Write a MATLAB UDF called gss that minimizes a 1D function using the Golden Section Search algorithm. The inputs should be a function handle, bracket endpoints \([a, b]\), and a tolerance \(\epsilon\). The output should be the estimated minimum location \(x^*\).
  2. Apply your gss UDF to the bracket from Part 1 with a tolerance of \(\epsilon = 10^{-13}\) m. Report the minimum location \(r^*\) and the potential value \(V(r^*)\).

Part 3 — Plot

  1. Plot \(V(r)\) over a physically meaningful range of \(r\) values. On the same plot, mark the bracket endpoints found in Part 1 (use square markers) and the GSS minimum from Part 2 (use a star marker). Label axes with units and include a legend.

💡 Hints