Thomas-Fermi theory with magnetic fields and the Fermi-Amaldi correction