Learn to Use ITensor

main / classes / qn


A QN object contains set of "quantum numbers" (up to four of these; this number can be increased with a compile-time flag).

Quantum numbers have a name and an integer value. They can also optionally have a "mod factor" which makes them obey @@Z_N@@ addition rules rather than standard integer addition.

QN objects can be added and subtracted, and any missing quantum numbers are treated as having the value zero.

Similarly, QN objects can be compared, and any missing quantum numbers are treated as having the value zero.


auto q1 = QN({"Sz",1});
auto q2 = QN({"Sz",2});

Print(q1 == q1); //prints "true"
Print(q1 == q2); //prints "false"

Print(q1+q2); //prints QN({"Sz",3})
Print(q1-q1); //prints QN({"Sz",0})
Print(q1-q2); //prints QN({"Sz",-1})

auto c = QN({"C",1});

Print(q1+c); //prints QN({"C",1},{"Sz",1})

auto qc0 = QN({"C",0},{"Sz",0});
auto c0 = QN({"C",0});

Print(qc0 == c0); //prints "true", since
                  //missing quantum numbers
                  //are treated as zero

More Information About Quantum Numbers

When describing spin quantum numbers (total Sz, say), our convention is to work in units of spin 1/2. Thus a QN object made as QN("Sz=",+1) means Sz=+0.5 in physics units. The reason for this is that computers can perform integer arithmetic quickly and exactly. For particle quantum numbers (such as total boson or fermion number) integer values have their usual meaning.

Each quantum number in a QN object has a modulus which can take the following types of values:

QN is defined in the header "itensor/qn.h".

QN Class Methods

QN Functions

This page current as of version 3.0.0

Back to Classes
Back to Main