Care should thus be placed into how we store these objects. These are objects with four indices and a sensible first implementation of the CCD equations would be to create two four-dimensional arrays to store the objects. However, it is often more convenient to work with simple one-dimensional arrays instead.
The goal of our code is to calculate the correlation energy, \( \Delta E_{CCD} \), meaning that after each iteration of our equations, we use our newest \( t \) amplitudes to update the correlation energy $$ \begin{equation} \Delta E_{CCD}^{(n)} = \frac{1}{4} \sum_{ijab} \langle ij\vert\hat{v}\vert ab\rangle t^{ab}_{ij}{}^{(n)}. \tag{12} \end{equation} $$ We check that our result is converged by testing whether the most recent iteration has changed the correlation energy by less than some tolerance threshold \( \eta \), $$ \begin{equation} \eta > | \Delta E_{CCD}^{(n+1)} - \Delta E_{CCD}^{(n)} |. \tag{13} \end{equation} $$