I want to use the iDMRG code in a 2D system, so I am trying to write a 2D version of the Heisenberg.h file for my 2D spinless fermionic system. I managed to write the MPO with the W-matrices, similarly as in the Heisenberg.h code, and also taken into account the Jordan-Wigner transformation.

Still, I do not know how to handle QN conservation (I want the number of fermions to be conserved), and when I run the code I get an error related to the divergence of the IQTensors.

I understand that I should arrange the tensor in non-zero blocks, but in practice how can I do it when adding terms to the W-matrices? I do not see any special line in the Heisenberg.h file related to this (I see that from lines 84-94 the different terms are added and that's all), but I guess there is something more involved in my system, which is 2D and requires the Jordan-Wigner strings mediating interactions.

Thanks a lot for your time,

Sergi