The origin of the atmosphere