This lab optimizes a water molecule's geometry on a simplified potential-energy surface (PES) built from two real internal coordinates: the two O–H bond lengths and the H–O–H bond angle. Each is given its own harmonic ("spring-like") term centered on water's known equilibrium values (r₀ ≈ 0.958 Å, θ₀ ≈ 104.45°), with bond stretching made much stiffer than angle bending — exactly the real relative stiffness in a molecule.
At every iteration the optimizer computes the true numerical gradient of that energy (a central-difference derivative, not a lookup table) with respect to each hydrogen atom's 3D position, then takes a small steepest-descent step directly downhill, clamped to a safe maximum displacement per step so the geometry relaxes smoothly instead of overshooting. The oxygen atom is held fixed as the reference origin — translating the whole molecule can't change its energy, so only the internal bond lengths and angle actually need to relax.
The pale-blue glow around each atom and each O–H bond is a simplified electron-density isosurface: its position, size and elongation are recomputed from the current atomic coordinates every iteration, so it visibly reshapes itself as the bonds stretch, compress and bend on the way down to the same equilibrium geometry — regardless of how badly distorted the starting guess was.
- Drag to orbit the 3D view, scroll to zoom.