Resolution of identity approximation for the Coulomb term in molecular and periodic systems.