  Ewald summation is an important technique used to deal with long-range
Coulomb interaction. While it is widely used in simulations of molecules and
solid state materials, many important results are dispersed in literature and
their implementations are often buried deep in large software packages. Since
reliable and systematic calculation of Coulomb interaction is critical for the
investigation of perovskites, here we start from the fundamentals of Ewald
summation and derive clear expressions for long-range charge-charge,
dipole-dipole, and charge-dipole interactions, which can be readily used for
numerical computations. We also provide the interaction matrix for efficient
Monte Carlo simulations involving charges and dipoles, implementing them in a
Python software package. A new type of interaction matrix, which accounts for
the electrostatic energy change when ions are displaced, is also derived and
implemented. These results are the foundations for the investigation of
ferroelectric perovskites.
