Spin-spin correlation functions in the Ising Model Monte Carlo [closed]

I'm using the Metropolis algorithm for 2D up to 5D for the Ising Model and I want to compute the spin-spin correlation function.

$$c(r)=<s_is_r>−〈s_i〉〈s_r 〉$$ but I'm not sure how to estimate

$$<s_is_r> = \frac{1}{N}\sum s_is_r$$

What can I do for $s_is_r$ numerically?

• The spin-spin correlation function is a matrix. It's not quite clear to me what exactly your question is? – Wolfgang Bangerth Mar 11 '15 at 10:27