Quadrupole moment of CO, N2, and NO+