Minimal-Energy Configuration of Charged Particles in a Square Lattice