An efficient algorithm for electron repulsion integrals over contracted Gaussian-type functions