I use one big loop for all the interactions instead of many small repeated ones.
I'm not using sparse matrices for now… I couldn't find an eigenvalues solver.
Stupid mistake in the conditional….