YtoZMatrix

YtoZMatrix($orb$) takes the angular momentum $l$ or the name of a non-relativistic atomic orbital and returns the corresponding matrix to rotate from a basis of spherical harmonics to tesseral harmonics. It is also possible to give a list of $l$ numbers or orbital names, in which case the output is a block diagonal matrix with the rotation matrices as entries.

Input

• $orb$ : An integer number, or a list of integer numbers, or a string that can be interpreted as a non-relativistic atomic orbital, or a list or strings.
• Options:
• “addSpin” : bool determining if spin-space is considered in the matrix (resulting in matrices double in size). (Default true)

Output

• $R$ : Rotation Matrix from a basis of spherical to tesseral harmonics.

Example

Input

Example.Quanty
print("")
print("YtoZMatrix(0)")
print(YtoZMatrix(0))

print("")

print("")
print("YtoZMatrix(1)")
print(YtoZMatrix(1))

print("")
print("YtoZMatrix(\"p\")")
print(YtoZMatrix("p"))

print("")
print("YtoZMatrix(2)")
print(YtoZMatrix(2))

print("")
print("YtoZMatrix(\"d\")")
print(YtoZMatrix("d"))

print("")

print("")

print("\n\n")
print("A more realistic example")
Orbitals = {"1s","2s","2p"}
Indices, NF = CreateAtomicIndicesDict(Orbitals)

--Some Operator definition on spherical harmonics
op = NewOperator("U", NF, Indices["2p_Up"], Indices["2p_Dn"],{0,1})
print("Operator on a basis of spherical harmonics")
print(op)

opZ = Rotate(op, YtoZMatrix(Orbitals))
print("Operator on a basis of tesseral harmonics")
print(opZ)

Result

YtoZMatrix(0)
{ { 1 , 0 } ,
{ 0 , 1 } }

{ { 1 } }

YtoZMatrix(1)
{ { (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 } ,
{ 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 + 0.70710678118655 I) } ,
{ 0 , 0 , 1 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 1 , 0 , 0 } ,
{ 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 , 0 } ,
{ 0 , 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 } }

YtoZMatrix("p")
{ { (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 } ,
{ 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 + 0.70710678118655 I) } ,
{ 0 , 0 , 1 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 1 , 0 , 0 } ,
{ 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 , 0 } ,
{ 0 , 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 } }

YtoZMatrix(2)
{ { (0 + 0.70710678118655 I) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , (0 - 0.70710678118655 I) , 0 } ,
{ 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , (0 - 0.70710678118655 I) } ,
{ 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 , 0 , 0 } ,
{ 0.70710678118655 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0.70710678118655 , 0 } ,
{ 0 , 0.70710678118655 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0.70710678118655 } }

YtoZMatrix("d")
{ { (0 + 0.70710678118655 I) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , (0 - 0.70710678118655 I) , 0 } ,
{ 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , 0 , 0 , 0 , 0 , (0 - 0.70710678118655 I) } ,
{ 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 , 0 , 0 } ,
{ 0.70710678118655 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0.70710678118655 , 0 } ,
{ 0 , 0.70710678118655 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0.70710678118655 } }

{ { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , (0 + 0.70710678118655 I) , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0.70710678118655 , 0 , -0.70710678118655 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 - 0.70710678118655 I) } ,
{ 0 , 0 , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , (0 + 0.70710678118655 I) , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0.70710678118655 , 0 , -0.70710678118655 , 0 } ,
{ 0 , 0 , 0 , 0 , 0.70710678118655 , 0 , 0 , 0 , 0.70710678118655 } }

{ { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , (0 + 0.70710678118655 I) , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0.70710678118655 , 0 , -0.70710678118655 , 0 , 0 , 0 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , 0 , 0 , (0 - 0.70710678118655 I) } ,
{ 0 , 0 , 0 , 0 , 0 , (0 + 0.70710678118655 I) , 0 , (0 + 0.70710678118655 I) , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 } ,
{ 0 , 0 , 0 , 0 , 0 , 0.70710678118655 , 0 , -0.70710678118655 , 0 } ,
{ 0 , 0 , 0 , 0 , 0.70710678118655 , 0 , 0 , 0 , 0.70710678118655 } }

A more realistic example
Operator on a basis of spherical harmonics

Operator: Coulomb Operator
QComplex         =          0 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =         10 (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   4
QComplex      =          0 (Real==0 or Complex==1)
N             =         25 (number of operators of length   4)
C  5 C  4 A  5 A  4 | -3.999999999999999E-02
C  7 C  5 A  7 A  5 |  2.000000000000000E-01
C  6 C  5 A  6 A  5 |  7.999999999999999E-02
C  7 C  4 A  7 A  4 |  7.999999999999999E-02
C  6 C  4 A  6 A  4 |  2.000000000000000E-01
C  9 C  5 A  9 A  5 |  2.000000000000000E-01
C  8 C  5 A  8 A  5 | -3.999999999999999E-02
C  9 C  4 A  9 A  4 | -3.999999999999999E-02
C  8 C  4 A  8 A  4 |  2.000000000000000E-01
C  7 C  6 A  7 A  6 | -1.600000000000000E-01
C  9 C  7 A  9 A  7 |  2.000000000000000E-01
C  8 C  7 A  8 A  7 |  7.999999999999999E-02
C  9 C  6 A  9 A  6 |  7.999999999999999E-02
C  8 C  6 A  8 A  6 |  2.000000000000000E-01
C  9 C  8 A  9 A  8 | -3.999999999999999E-02
C  6 C  5 A  7 A  4 |  1.200000000000000E-01
C  7 C  4 A  6 A  5 |  1.200000000000000E-01
C  8 C  5 A  7 A  6 | -1.200000000000000E-01
C  9 C  4 A  7 A  6 |  1.200000000000000E-01
C  8 C  5 A  9 A  4 |  2.400000000000000E-01
C  9 C  4 A  8 A  5 |  2.400000000000000E-01
C  7 C  6 A  8 A  5 | -1.200000000000000E-01
C  7 C  6 A  9 A  4 |  1.200000000000000E-01
C  8 C  7 A  9 A  6 |  1.200000000000000E-01
C  9 C  6 A  8 A  7 |  1.200000000000000E-01

Operator on a basis of tesseral harmonics

Operator: Coulomb Operator
QComplex         =          0 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =         10 (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   4
QComplex      =          0 (Real==0 or Complex==1)
N             =         27 (number of operators of length   4)
C  5 C  4 A  5 A  4 | -1.599999999999999E-01
C  9 C  8 A  5 A  4 | -1.200000000000000E-01
C  9 C  4 A  9 A  4 |  7.999999999999997E-02
C  8 C  5 A  9 A  4 |  1.200000000000000E-01
C  9 C  4 A  8 A  5 |  1.200000000000000E-01
C  8 C  5 A  8 A  5 |  7.999999999999997E-02
C  5 C  4 A  9 A  8 | -1.200000000000000E-01
C  9 C  8 A  9 A  8 | -1.599999999999999E-01
C  7 C  5 A  7 A  5 |  1.999999999999999E-01
C  9 C  7 A  9 A  7 |  1.999999999999999E-01
C  6 C  5 A  6 A  5 |  7.999999999999997E-02
C  9 C  6 A  9 A  6 |  7.999999999999997E-02
C  7 C  4 A  7 A  4 |  7.999999999999997E-02
C  8 C  7 A  8 A  7 |  7.999999999999997E-02
C  6 C  4 A  6 A  4 |  1.999999999999999E-01
C  8 C  6 A  8 A  6 |  1.999999999999999E-01
C  9 C  5 A  9 A  5 |  1.999999999999999E-01
C  8 C  4 A  8 A  4 |  1.999999999999999E-01
C  7 C  6 A  7 A  6 | -1.600000000000000E-01
C  6 C  5 A  7 A  4 |  1.200000000000000E-01
C  9 C  6 A  8 A  7 |  1.200000000000000E-01
C  7 C  4 A  6 A  5 |  1.200000000000000E-01
C  8 C  7 A  9 A  6 |  1.200000000000000E-01
C  5 C  4 A  7 A  6 | -1.200000000000000E-01
C  9 C  8 A  7 A  6 | -1.200000000000000E-01
C  7 C  6 A  5 A  4 | -1.200000000000000E-01
C  7 C  6 A  9 A  8 | -1.200000000000000E-01