This is a description of the main greenhouse gases
Absorption of infrared radiation by the main components of the atmosphere, namely nitrogen and oxygen molecules, is forbidden by quantum laws. These indicate that molecules that are allowed to absorb and emit infrared radiation must either possess a permanent dipole moment—for example the bent water molecule in which the oxygen atom has a partially negative charge balanced by partially positive charges on the hydrogen atoms—or undergo vibrational motions that alter the dipole moment. An example of the latter is the linear CO2 molecule that has zero dipole moment because the partially negatively charged oxygen atoms are diametrically opposed, but when it undergoes a bending vibration the dipole moment is transiently non-zero. Thus water vapour and CO2 are greenhouse gases, as are to a lesser extent methane (CH4), nitrous oxide (dinitrogen oxide, N2O) and ozone (O3).
Because the diatomic molecules that make up the majority of the atmosphere do not possess permanent dipole moments they are forbidden by the quantum rules from interacting with electromagnetic radiation to cause rotational or vibrational changes in their energy. There is a different quantum rule for their interaction with radiation to produce changes in their electronic energy. Both oxygen and nitrogen molecules interact with incoming solar radiation in the ultraviolet region. They are both involved in the phenomenon of aurora and are active in the thermosphere. Oxygen, O2, interacts with solar radiation to produce trioxygen, O3, otherwise known as ozone. This molecule acts as a protection of the Earth's surface from the UVB and much of the UVA radiation in sunlight that causes sunburn.