For finite systems, the electronic contribution to the dipole moment is given in terms of the expectation value of the position operator r as µ µ µ = -e i ⟨ψ i |r|ψ i ⟩, where ψ i are the Kohn-Sham density functional theory (KS-DFT) orbitals. This definition does not generalize to periodic systems, where the KS-DFT orbitals are represented by Bloch functions ψ nk , where k is the wave vector. The expectation value ⟨ψ nk |r|ψ nk ⟩ is ill-defined since the integrand diverges as |r| approaches infinity. The modern theory of polarization solved this problem by providing a rigorous reformulation of the electric polarization (dipole moment per unit volume) in terms of a Berry phase or Wannier centers. In the following, we summarize the key equations and refer the reader to Ref. 66 for a detailed description.