Why atoms bond. At large separation two atoms barely interact; when they approach, electron sharing (or transfer) lowers the energy until short-range repulsion wins. The minimum of this curve is the bond: its depth De is the bond energy, its position re the bond length, and its curvature k = d²V/dr² sets the vibration wavenumber ωe = (1/2πc)√(k/μ).
Diatomics (H₂, N₂, O₂, HCl) use the Morse potential V(r) = De(1 − e−a(r−re))² with a = √(k/2De), where re, De and ωe are spectroscopic values (NIST). The two nuclei are integrated with velocity Verlet around their centre of mass. Above 100 % of De the bond breaks. Morse is a fit, not an ab initio curve: it has the right well and asymptote but not the exact short-range wall.
NaCl ion pair. Two diabatic curves: neutral atoms (V = 0) and Na⁺ Cl⁻ with V = (IE − EA) − e²/(4πε0r) + B e−r/ρ (IE 5.139 eV, EA 3.613 eV, ρ = 0.33 Å, B fixed so the minimum sits at the measured 2.361 Å). They cross at r = 14.40 eV·Å/(IE − EA) ≈ 9.4 Å; a coupling of 0.1 eV (illustrative) turns the crossing into an avoided one, so the charge on Na switches from 0 to +1 as the atoms approach. The model has no polarisation, so its dipole (11 D) and well depth are higher/lower than the measured 9.0 D and about 4.2 eV.
Polarity. Pauling's ionic fraction 1 − exp(−(Δχ)²/4) turns the electronegativity difference into a partial charge on each bond; the bond dipole is that charge times the bond length (1 e·Å = 4.80 D). For H₂O the vector sum of two O–H bond dipoles gives 1.80 D (measured 1.855 D; part of this agreement is luck, lone pairs also matter); for linear CO₂ the two bond dipoles cancel exactly.
H₂O and CO₂ vibrations are shown as internal-coordinate motions at the measured fundamental wavenumbers (H₂O 3657, 1595, 3756 cm⁻¹; CO₂ 1388, 667, 2349) with the zero-point or n-quantum classical amplitude and the recoil of the central atom. Because the dipole is recomputed each frame you can see why only some modes absorb infrared: the CO₂ symmetric stretch leaves the dipole at zero (IR inactive), the bend and asymmetric stretch do not — the greenhouse effect in one picture. The simple bond-dipole model underestimates the size of that change.
Simplifications: the electron clouds and lone-pair lobes are pictures, not orbitals; real amplitudes are tiny and are exaggerated with the slider; time runs in slow motion (the readout gives femtoseconds per screen second); anharmonic mode coupling is ignored.
Running numerical checks...