Compute the topological polarization/Chern number for a 1D model.