Hi, so this is actually a really good question. I have been thinking pretty hard about it and examining where things go wrong inside AutoMPO.
So on a higher level of abstraction, what happens first is that the two "Cdagup" operators are multiplied together since they act on the same site. Of course that's the correct thing to do. Then the code analyzes the resulting tensor, assuming it's not zero, and figures out its quantum number structure. It turns out this quantum number structure is incompatible with the IQMPO being built, which is what triggers the error.
So that's actually a reasonable thing for the code to do, for two reasons. The first reason is maybe a bit 'picky', but one can argue that even if the tensors which happen to violate the symmetry of the IQMPO always happen to be numerically zero, it's still inappropriate to accept such terms as input if they violate the symmetry (plus that's useful to catch them for finding deeper bugs in the logic of the AutoMPO construction).
The second reason is more practical, which is that checking whether each operator going into the IQMPO is numerically zero can be costly and also unreliable for cases where users genuinely want to add quite small terms (this can occur in quantum chemistry or in studies of small perturbations to lattice models, say).
So for now, I think the best thing to do is to leave the behavior as-is, perhaps with me improving the error message if possible.
What you can do is to put an if statement that checks for a term like
"Cdagup",i,"Cup"j,"Cdagup",k,"Cup",l
whether i==k or j==l.
In a quantum chemistry code I'm currently using I have similar terms and I have just such a check to eliminate invalid / zero terms like this.
Will that work for your case?
Miles