Gravar-mail: An efficient algorithm for multipole energies and derivatives based on spherical harmonics and extensions to particle mesh Ewald