qsbasis

◼ qsbasis[{ops}] returns the basis with well defined charge Q and spin S quantum numbers in creation operator representation.
◼ qsbasisvc[{ops}] returns the basis with well defined charge Q and spin S quantum numbers in occupation number representation.

◼ As of version 1.147, function makebasis is called with argument {ops}.

◼ See also: qszbasis, qszbasisvc, transformQStoIS, transformbasis, transformQStoPH, transformtoLR, makematricesbzop, makematricesbzvc, makebasis, bzvc2bzop, bzop2bzvc.

Further examples

Load sneg and declare c to be a Fermionic operator.

<< sneg`sneg`;
snegfermionoperators[c]

One-site basis

Timing[bz = qsbasis[{c[]}];]
bz // MatrixForm
Timing[bvc = qsbasisvc[{c[]}];]
bvc // MatrixForm
bzop2bzvc[bz] == bvc

Two-site basis

Timing[bz = qsbasis[{c[1], c[2]}];]
bz // MatrixForm
Timing[bvc = qsbasisvc[{c[1], c[2]}];]
bvc // MatrixForm
bzop2bzvc[bz] == bvc

Three-site basis

Timing[bz = 
          qsbasis[{c[1], c[2], c[3]}];]
bz // MatrixForm
Timing[bvc = qsbasisvc[{c[1], c[2], c[3]}];]
bvc // MatrixForm
bzop2bzvc[bz] == bvc

Four-site basis

Timing[bz = 
          qsbasis[{c[1], c[2], c[3], c[4]}];]
Timing[bvc = qsbasisvc[{c[1], c[2], c[3], c[4]}];]
bzop2bzvc[bz] == bvc // ExpandAll

Five and six-site basis

Timing[bvc = 
          qsbasisvc[{c[1], c[2], c[3], c[4], 
              c[5]}];]
Timing[bvc = 
          qsbasisvc[{c[1], c[2], c[3], c[4], c[5], 
              c[6]}];]
Timing[bvc = 
          qsbasisvc[{c[1], c[2], c[3], c[4], c[5], c[6], 
              c[7]}];]
Timing[bvc = 
          qsbasisvc[{c[1], c[2], c[3], c[4], c[5], c[6], c[7], 
              c[8]}];]

Perform some tests on the four-site basis

Timing[bvc = qsbasisvc[{c[1], c[2], c[3], c[4]}];]

(* 
      Count the total number of states (taking into account the degeneracy of invariant subspaces *) 
countstatesQS[bz_?bzQ] := 
        Total @ 
          Map[(2  #[[1, 2]] + 1) 
                Length[#[[2]]] &, bz];
 (* 
      Check orthogonality of all states *) 

    checkorthogonalvc[states_] := 
        matrixrepresentationvc[1, states] === 
          IdentityMatrix[Length[states]];
 (* 
      Check that total spin (ss) is a good quantum number *) 

    checkspinvc[{{q_, s_}, states_}, ss_] := 
        matrixrepresentationvc[ss, states] == 
            s (s + 1) IdentityMatrix[Length[states]] // 
          Simplify;

countstatesQS[bvc]
And  @@  Map[{First[#], checkorthogonalvc @ Last[#]} &, 
          bvc][[All, 2]]
ss = manyspin[{c[1], c[2], c[3], 
              c[4]}][[4]];
And  @@  Map[checkspinvc[#, ss] &, bvc]