Partial vectorization of energy_surf() and a basic test.