Ewald summation of electrostatic interactions in molecular dynamics of a three-dimensional system with periodicity in two directions