Abstract
When performing density-functional calculations of surfaces using a plane-wave pseudopotential code, it is necessary to embed a slab with two surfaces in a periodic supercell. In many situations, it is desirable to study an asymmetric slab with a net surface dipole density. The periodic boundary conditions imposed on the electrostatic potential then give rise to an artificial electric field across the slab. We present a dipole correction that cancels the artificial field, and show how this correction can be incorporated in the density-functional theory total-energy expression. The results are supported by total-energy calculations of water-molecule layers.