Dipole and quadrupole polarization in ionic systems: Ab initio studies