# Operators continued

The third examples shows several standard operators acting on a $p$-shell.

Operators_continued.Quanty
-- A basis consists of:
-- a number of Fermionic modes or spin-orbitals
NF=6;
-- a number of Bosonic modes (phonon modes, ...)
NB=0;
-- an index relating the spinorbitals to quantum
-- numbers we assign to them.  For a p-shell we would
-- like the have 6 spinorbitals with the quantum
-- numbers spin up ml=-1,ml=0,ml=1 and spin down
-- with ml=-1, ml=0, ml=1
IndexDn={0,2,4};
IndexUp={1,3,5};
-- the code knows that a 3 fold degenerate shell
-- has l=1 and ml=-1, 0 and 1 are assigned to
-- them automatically

-- we can now create the spin operators on this basis
OppSx=NewOperator("Sx",NF,IndexUp,IndexDn);
OppSy=NewOperator("Sy",NF,IndexUp,IndexDn);
OppSz=NewOperator("Sz",NF,IndexUp,IndexDn);

-- and print them
print(OppSx)
print(OppSy)
print(OppSz)

print("=================================");
-- the spin operators commute such that
-- Sx * Sy - Sy * Sx = I Sz. This can easily be
-- checked by multiplying operators
OppNill = OppSx * OppSy - OppSy * OppSx - I * OppSz;

-- OppNill should be a zero operator
print(OppNill)

-- Printing indeed showed only zero's, but the are
-- still stored. The above equation should return
-- an operator of lenght zero. in order to remove
-- small values from the operator one can chop these
OppNill=Chop(OppNill);

-- secondly the name of the operator is a generic
-- "operator". Not so nice, so lets set the name
OppNill.Name = "Sx * Sy - Sy * Sx - I Sz";

-- now we can print again.
print(OppNill)

The output is:

Operators_continued.out
Operator: Sx
QComplex         =          0 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          2 (largest number of product of lader operators)
NFermionic modes =          6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   2
QComplex      =          0 (Real==0 or Complex==1)
N             =          6 (number of operators of length   2)
C  0 A  1 |  5.000000000000000E-01
C  1 A  0 |  5.000000000000000E-01
C  2 A  3 |  5.000000000000000E-01
C  3 A  2 |  5.000000000000000E-01
C  4 A  5 |  5.000000000000000E-01
C  5 A  4 |  5.000000000000000E-01

Operator: Sy
QComplex         =          1 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          2 (largest number of product of lader operators)
NFermionic modes =          6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          6 (number of operators of length   2)
C  0 A  1 |  0.000000000000000E+00  5.000000000000000E-01
C  1 A  0 |  0.000000000000000E+00 -5.000000000000000E-01
C  2 A  3 |  0.000000000000000E+00  5.000000000000000E-01
C  3 A  2 |  0.000000000000000E+00 -5.000000000000000E-01
C  4 A  5 |  0.000000000000000E+00  5.000000000000000E-01
C  5 A  4 |  0.000000000000000E+00 -5.000000000000000E-01

Operator: Sz
QComplex         =          0 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          2 (largest number of product of lader operators)
NFermionic modes =          6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   2
QComplex      =          0 (Real==0 or Complex==1)
N             =          6 (number of operators of length   2)
C  1 A  1 |  5.000000000000000E-01
C  0 A  0 | -5.000000000000000E-01
C  3 A  3 |  5.000000000000000E-01
C  2 A  2 | -5.000000000000000E-01
C  5 A  5 |  5.000000000000000E-01
C  4 A  4 | -5.000000000000000E-01

=================================

Operator: Operator
QComplex         =          1 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          6 (number of operators of length   2)
C  1 A  1 |  0.000000000000000E+00  0.000000000000000E+00
C  0 A  0 |  0.000000000000000E+00  0.000000000000000E+00
C  3 A  3 |  0.000000000000000E+00  0.000000000000000E+00
C  2 A  2 |  0.000000000000000E+00  0.000000000000000E+00
C  5 A  5 |  0.000000000000000E+00  0.000000000000000E+00
C  4 A  4 |  0.000000000000000E+00  0.000000000000000E+00

Operator of Length   4
QComplex      =          1 (Real==0 or Complex==1)
N             =         15 (number of operators of length   4)
C  1 C  0 A  1 A  0 |  0.000000000000000E+00  0.000000000000000E+00
C  2 C  0 A  3 A  1 |  0.000000000000000E+00  0.000000000000000E+00
C  3 C  0 A  2 A  1 |  0.000000000000000E+00  0.000000000000000E+00
C  4 C  0 A  5 A  1 |  0.000000000000000E+00  0.000000000000000E+00
C  5 C  0 A  4 A  1 |  0.000000000000000E+00  0.000000000000000E+00
C  2 C  1 A  3 A  0 |  0.000000000000000E+00  0.000000000000000E+00
C  3 C  1 A  2 A  0 |  0.000000000000000E+00  0.000000000000000E+00
C  4 C  1 A  5 A  0 |  0.000000000000000E+00  0.000000000000000E+00
C  5 C  1 A  4 A  0 |  0.000000000000000E+00  0.000000000000000E+00
C  3 C  2 A  3 A  2 |  0.000000000000000E+00  0.000000000000000E+00
C  4 C  2 A  5 A  3 |  0.000000000000000E+00  0.000000000000000E+00
C  5 C  2 A  4 A  3 |  0.000000000000000E+00  0.000000000000000E+00
C  4 C  3 A  5 A  2 |  0.000000000000000E+00  0.000000000000000E+00
C  5 C  3 A  4 A  2 |  0.000000000000000E+00  0.000000000000000E+00
C  5 C  4 A  5 A  4 |  0.000000000000000E+00  0.000000000000000E+00

Operator: Sx * Sy - Sy * Sx - I Sz
QComplex         =          0 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)