# Parallel Computing of Edwards--Anderson Model
## 2 Algorithm  
To find the minimum energy it is necessary to enumerate all possible states of the lattice spins, calculate their energies and compare them with each other. In order not to calculate it every time, one can calculate once the energies of states of a subsystem (part of the initial system) with given boundaries, and then extend the subsystem by adding spins to it. Knowing the boundary state makes it possible to calculate the change of energy of the ground state when adding spins. So \(E\to E+\Delta E\). Expanding the subsystem by adding one spin at each step until the initial given system is achieved, we compute at each step a new minimum energy. The calculated energy of the ground state at the last step will be the final answer. This approach is quite widespread and is used, in particular, in the transfer matrix method in the calculation of the Ising model [28] and quantum many-body problem models [29; 30]. Further, let's describe the parallelisation scheme, preliminarily introducing some notations and formalizing the task. Let a lattice have size \(L_{y}\times L_{x}\). The above described energy calculation scheme for filling the spins of one lattice row (let the system expand line by line) can be represented as follows  
\[ \begin{pmatrix}E(s_{1}=-1,s_{2}=-1,\ldots,s_{L_{x}}=-1)_{m-1,L_{x}}\\ E(s_{1}=+1,s_{2}=-1,\ldots,s_{L_{x}}=-1)_{m-1,L_{x}}\\ \ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\\ E(s_{1}=+1,s_{2}=+1,\ldots,s_{L_{x}}=+1)_{m-1,L_{x}}\end{pmatrix} \xrightarrow{ \text{add}\,s_{n,1}} \begin{pmatrix}E(s_{1}=-1,s_{2}=-1,\ldots,s_{L_{x}}=-1)_ {m,1}\\ E(s_{1}=+1,s_{2}=-1,\ldots,s_{L_{x}}=-1)_{m,1}\\ \ldots\ldots\ldots\ldots\ldots\ldots\ldots\\ E(s_{1}=+1,s_{2}=+1,\ldots,s_{L_{x}}=+1)_{m,1}\end{pmatrix}  \tag{3}\]  
\[\xrightarrow{\text{add}\,s_{n,2}}\ldots\xrightarrow{\text{add}\,s_{n,L_{x}}} \begin{pmatrix}E(s_{1}=-1,s_{2}=-1,\ldots,s_{L_{x}}=-1)_{m,L_{x}}\\ E(s_{1}=+1,s_{2}=-1,\ldots,s_{L_{x}}=-1)_{m,L_{x}}\\ E(s_{1}=+1,s_{2}=+1,\ldots,s_{L_{x}}=+1)_{m,L_{x}}\end{pmatrix} .\]  
From the scheme one can see that all values of the minimum energy of the subsystem with a given boundary consisting of \(L_{x}\) spins are written in vector-columns. Each column component corresponds to a given subsystem boundary. The state of the boundary is given by the set \((s_{1},s_{2},\ldots,s_{L_{x}})\). The column has \(2^{L_{x}}\) components. Thus all states of the upper boundary are covered. The bottom two indices \(y,x\) to the right after the bracket \(E(\ldots)_{y,x}\) denote the subsystem consisting of \(y\) rows with \(x\) spins in the top \(y\) line. We extend it at each step, adding one spin from left to right, so these indices allow us to understand which subsystem we are dealing with at the current step. The notation system is given for the lattice with \(L_{x}=4\) in Figure 1.  
After filling one line, one should repeat the process for the next line until the original system is obtained. Figure 1: Notations for \(L_{x}=4\) for different lengths of the top row filled in from left to right. The upper boundary is indicated by shaded squares. Let us consider in details the calculation of \(E\).