this is the code that works for 2D Heisenberg but not for 1D