Electrostatic interactions in finite systems treated with periodic boundary conditions: application to linear-scaling density functional theory.