Secondly, the distance from the Sun determines the energy available to heat atmospheric gas to the point where its molecules' thermal motion exceed the planet's escape velocity, the speed at which gas molecules overcome a planet's gravitational grasp.