Atomic and molecular correlation energies with explicitly correlated Gaussian geminals. I. Second‐order perturbation treatment for He, Be, H2, and LiH