The quantum mechanics of the greenhouse effect