# Functions

This section of the documentation lists all functions and gives a short explanation of what they do. In order to run examples we define a set of standard operators, wave-functions and objects. These are stored in the file definitions.Quanty and loaded in several of the examples below. The definitions are:

definitions.Quanty
Verbosity(0x0)

Nf=6
Nb=0
IndexDn={0,2,4}
IndexUp={1,3,5}

Opp1 = NewOperator("Lx",Nf,IndexUp,IndexDn)
Opp2 = NewOperator("Ly",Nf,IndexUp,IndexDn)
psi1 = NewWavefunction(Nf,Nb,{{"100010",sqrt(9/10)},{"110000",sqrt(1/10)}})
psi2 = NewWavefunction(Nf,Nb,{{"010010",1}})
mat = {{1,1,0},
{1,2,1},
{0,1,3}}

OppLx    = NewOperator("Lx",   Nf,IndexUp,IndexDn)
OppLy    = NewOperator("Ly",   Nf,IndexUp,IndexDn)
OppLz    = NewOperator("Lz",   Nf,IndexUp,IndexDn)
OppLsqr  = NewOperator("Lsqr", Nf,IndexUp,IndexDn)
OppSx    = NewOperator("Sx",   Nf,IndexUp,IndexDn)
OppSy    = NewOperator("Sy",   Nf,IndexUp,IndexDn)
OppSz    = NewOperator("Sz",   Nf,IndexUp,IndexDn)
OppSsqr  = NewOperator("Ssqr", Nf,IndexUp,IndexDn)
OppJx    = NewOperator("Jx",   Nf,IndexUp,IndexDn)
OppJy    = NewOperator("Jy",   Nf,IndexUp,IndexDn)
OppJz    = NewOperator("Jz",   Nf,IndexUp,IndexDn)
OppJsqr  = NewOperator("Jsqr", Nf,IndexUp,IndexDn)
Oppldots = NewOperator("ldots",Nf,IndexUp,IndexDn)
OppU     = NewOperator("U",    Nf,IndexUp,IndexDn,{0,10})
Akm = PotentialExpandedOnClm("D2h",1,{0,0,1})
Opppx = Chop(NewOperator("CF", Nf, IndexUp, IndexDn, Akm))
Opppx.Name="Opp px"
Akm = PotentialExpandedOnClm("D2h",1,{0,1,0})
Opppy = Chop(NewOperator("CF", Nf, IndexUp, IndexDn, Akm))
Opppy.Name="Opp py"
Akm = PotentialExpandedOnClm("D2h",1,{1,0,0})
Opppz = Chop(NewOperator("CF", Nf, IndexUp, IndexDn, Akm))
Opppz.Name="Opp pz"

psim1dn = NewWavefunction(Nf,Nb,{{"100000",1}})
psi0dn  = NewWavefunction(Nf,Nb,{{"001000",1}})
psip1dn = NewWavefunction(Nf,Nb,{{"000010",1}})
psim1up = NewWavefunction(Nf,Nb,{{"010000",1}})
psi0up  = NewWavefunction(Nf,Nb,{{"000100",1}})
psip1up = NewWavefunction(Nf,Nb,{{"000001",1}})

psixdn  = NewWavefunction(Nf,Nb,{{"100000",  sqrt(1/2)},{"000010", -sqrt(1/2)}})
psiydn  = NewWavefunction(Nf,Nb,{{"100000",I*sqrt(1/2)},{"000010",I*sqrt(1/2)}})
psizdn  = NewWavefunction(Nf,Nb,{{"001000",1}})
psixup  = NewWavefunction(Nf,Nb,{{"010000",  sqrt(1/2)},{"000001", -sqrt(1/2)}})
psiyup  = NewWavefunction(Nf,Nb,{{"010000",I*sqrt(1/2)},{"000001",I*sqrt(1/2)}})
psizup  = NewWavefunction(Nf,Nb,{{"000100",1}})

t = sqrt(1/2)
rotmat = {{  t,  0, 0, 0, -t,  0},
{  0,  t, 0, 0,  0, -t},
{I*t,  0, 0, 0,I*t,  0},
{  0,I*t, 0, 0,  0,I*t},
{  0,  0, 1, 0,  0,  0},
{  0,  0, 0, 1,  0,  0}}