Calculation of the spin-spin correlation function