Z=\sum_{\{S_i\}}e^{-\beta H(S_i)}