Get error message for using Sx2

+1 vote
asked Oct 4 by alesa (220 points)

I'd like to calculate Sx^2 in spin 1 system and the operator "Sx2" is defined in the spinone.h file. For the simplest example below, the compile was successful. But when I run the code, I got error message: "From line 161, file itdata/
Setting IQTensor element non-zero would violate its symmetry.
Setting IQTensor element non-zero would violate its symmetry."

include "itensor/all.h"

using namespace itensor;

int main()
auto sites = SpinOne(4);
ITensor op = sites.op("Sx2",2);
return 0;

I tried to modify the "opname" of "Sx2" and the content of "Sx2" in the spinone.h file, but still got the same error message. Unlike the case when I modify the the "opname" or content of "Sz", I got what I modified.

Other operators have the same problem: Sy2, XUp, XZ0, XDn.

1 Answer

0 votes
answered Oct 10 by miles (18,230 points)

Hi, thanks very much for pointing this out. It was a bug related to the implementation of the SpinOne site set within our new tensor storage system & site set design, which requires using a special temporary storage type for operators like this which don't respect the default symmetries associated with a site set. I just pushed a patch that ought to fix it for you.

It's a technical and confusing issue, although it doesn't cause any real problems when handled properly. But in a future version of ITensor I plan to eliminate the need for this workaround.


Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.