Molecular interactions in nitrogen and oxygen