Q: 2 dimensional Ising model: How do we visualize the Hamiltonian for interacting spins, but with no external magnetic field? Suppose we don't have any external magnetic field, so that the Hamiltonian is given by $H=-J\sum_{i,j}s_is_j$. If we have an $n\times n$ 2D lattice of spins. Then does the $H$ correspond to one whole configuration of all the spins, out of all the possible $2^{n\times n}$? How exactly do we compute the $H$ in the 2D case? The 1D case is straightforward, but I'm confused about the 2D case.

A: Maybe it will be easier for you to consider a general graph $G = (V,E)$ where $V$ are the vertices and $E$ are the edges. Then a configuration of spins $s \in \{-1,1\}^{V}$ is an assignment of a spin $+1$ or $-1$ to each vertex in the graph. If the vertex is $i$ we call the spin $s_i$.
Each edge $e \in E$ has two endpoints which are vertices and therefore assigned a spin. You could call those endpoints $e_+ $ and $e_-$ and they are both elements of $V$. That is $s_{e_+}$ and $s_{e_-}$ are $+1$ or $-1$ depending in the configuration.
Then you can calculate the Hamiltonian $H$ for one spin configuration by taking
\begin{align*}
H = - J \sum_{e \in E} s_{e_+} s_{e_-}.
\end{align*}
This is easy to do since you just have to sum up some numbers.
Example: Consider graph which has the shape of a triangle $V= \{v_1, v_2, v_3 \}$ and edges $e_{12}, e_{2,3}, e_{3,1}$. Suppose that $s_{v_1} =1, s_{v_2} = 1, s_{v_3} = -1 $. Then
\begin{align*}
H = - J \sum_{e \in E} s_{e_+} s_{e_-} = - J ( s_{v_1}s_{v_2} + s_{v_2} s_{v_3} + s_{v_3}  s_{v_1} ) = - J ( 1\cdot 1  + 1 \cdot (-1) +  (-1) \cdot 1) = J. 
\end{align*}
