# Rotate

Rotate(psi, rotmat) or Rotate(Opp, rotmat) rotates the basis of a wave-function or operator.

## Input

• psi or Opp : Wavefunction or operator
• rotmat : matrix of dimension NFermion+NBoson (table of tables) or real or complex numbers

## Output

• psi or Opp : Wavefunction or operator

## Example

A small example:

### Input

Rotate.Quanty
dofile("../definitions.Quanty")

OpppxR = Chop(Rotate(Opppx,rotmat))
OpppyR = Chop(Rotate(Opppy,rotmat))
OpppzR = Chop(Rotate(Opppz,rotmat))

print("The matrix rotating an operator on the basis of spherical harmonics with alternating spin to a basis of kubic harmonics with alternating spin for a p orbital is:")
print(rotmat)
print("The operator adding a potential to the px orbital on a basis of spherical harmonics is: ",Opppx)
print("The operator adding a potential to the px orbital on a basis of kubic harmonics is: ",OpppxR)
print("The operator adding a potential to the py orbital on a basis of spherical harmonics is: ",Opppy)
print("The operator adding a potential to the py orbital on a basis of kubic harmonics is: ",OpppyR)
print("The operator adding a potential to the pz orbital on a basis of spherical harmonics is: ",Opppz)
print("The operator adding a potential to the pz orbital on a basis of kubic harmonics is: ",OpppzR)

psixdnR = Chop(Rotate(psixdn,rotmat))
psixupR = Chop(Rotate(psixup,rotmat))
psiydnR = Chop(Rotate(psiydn,rotmat))
psiyupR = Chop(Rotate(psiyup,rotmat))
psizdnR = Chop(Rotate(psizdn,rotmat))
psizupR = Chop(Rotate(psizup,rotmat))

print("The px orbital with spin down on a basis of spherical harmonics is: ",psixdn)
print("The px orbital with spin down on a basis of kubic harmonics is: ",psixdnR)
print("The py orbital with spin down on a basis of spherical harmonics is: ",psiydn)
print("The py orbital with spin down on a basis of kubic harmonics is: ",psiydnR)
print("The pz orbital with spin down on a basis of spherical harmonics is: ",psizdn)
print("The pz orbital with spin down on a basis of kubic harmonics is: ",psizdnR)

print("Counting the px orbital on a basis of spherical harmonics: ",psixdn *Opppx *psixdn)
print("Counting the px orbital on a basis of kubic     harmonics: ",psixdnR*OpppxR*psixdnR)
print("Counting the py orbital on a basis of spherical harmonics: ",psiydn *Opppy *psiydn)
print("Counting the py orbital on a basis of kubic     harmonics: ",psiydnR*OpppyR*psiydnR)
print("Counting the pz orbital on a basis of spherical harmonics: ",psizdn *Opppz *psizdn)
print("Counting the pz orbital on a basis of kubic     harmonics: ",psizdnR*OpppzR*psizdnR)

### Result

Rotate.out
The matrix rotating an operator on the basis of spherical harmonics with alternating spin to a basis of kubic harmonics with alternating spin for a p orbital is:
{ { 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 , 0 } ,
{ 0 , 0.70710678118655 , 0 , 0 , 0 , -0.70710678118655 } ,
{ (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 } }
The operator adding a potential to the px orbital on a basis of spherical harmonics is:
Operator: Opp px
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             =          8 (number of operators of length   2)
C  0 A  0 |  4.999999999999999E-01
C  1 A  1 |  4.999999999999999E-01
C  4 A  4 |  4.999999999999999E-01
C  5 A  5 |  4.999999999999999E-01
C  4 A  0 | -5.000000000000000E-01
C  5 A  1 | -5.000000000000000E-01
C  0 A  4 | -5.000000000000000E-01
C  1 A  5 | -5.000000000000000E-01

The operator adding a potential to the px orbital on a basis of kubic harmonics is:
Operator: Opp px
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             =          2 (number of operators of length   2)
C  0 A  0 |  1.000000000000000E+00
C  1 A  1 |  1.000000000000000E+00

The operator adding a potential to the py orbital on a basis of spherical harmonics is:
Operator: Opp py
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             =          8 (number of operators of length   2)
C  0 A  0 |  4.999999999999999E-01
C  1 A  1 |  4.999999999999999E-01
C  4 A  4 |  4.999999999999999E-01
C  5 A  5 |  4.999999999999999E-01
C  4 A  0 |  5.000000000000000E-01
C  5 A  1 |  5.000000000000000E-01
C  0 A  4 |  5.000000000000000E-01
C  1 A  5 |  5.000000000000000E-01

The operator adding a potential to the py orbital on a basis of kubic harmonics is:
Operator: Opp py
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             =          2 (number of operators of length   2)
C  2 A  2 |  1.000000000000000E+00
C  3 A  3 |  1.000000000000000E+00

The operator adding a potential to the pz orbital on a basis of spherical harmonics is:
Operator: Opp pz
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             =          2 (number of operators of length   2)
C  2 A  2 |  9.999999999999999E-01
C  3 A  3 |  9.999999999999999E-01

The operator adding a potential to the pz orbital on a basis of kubic harmonics is:
Operator: Opp pz
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             =          2 (number of operators of length   2)
C  4 A  4 |  9.999999999999999E-01
C  5 A  5 |  9.999999999999999E-01

The px orbital with spin down on a basis of spherical harmonics is:
WaveFunction: Wave Function
QComplex         =          0 (Real==0 or Complex==1)
N                =          2 (Number of basis functions used to discribe psi)
NFermionic modes =          6 (Number of fermions in the one particle basis)
NBosonic modes   =          0 (Number of bosons in the one particle basis)

#      pre-factor         Determinant
1   7.071067811865E-01       100000
2  -7.071067811865E-01       000010

The px orbital with spin down on a basis of kubic harmonics is:
WaveFunction: Wave Function
QComplex         =          0 (Real==0 or Complex==1)
N                =          1 (Number of basis functions used to discribe psi)
NFermionic modes =          6 (Number of fermions in the one particle basis)
NBosonic modes   =          0 (Number of bosons in the one particle basis)

#      pre-factor         Determinant
1   1.000000000000E+00       100000

The py orbital with spin down on a basis of spherical harmonics is:
WaveFunction: Wave Function
QComplex         =          1 (Real==0 or Complex==1)
N                =          2 (Number of basis functions used to discribe psi)
NFermionic modes =          6 (Number of fermions in the one particle basis)
NBosonic modes   =          0 (Number of bosons in the one particle basis)

#      pre-factor             +I  pre-factor         Determinant
1   0.000000000000E+00         7.071067811865E-01       100000
2   0.000000000000E+00         7.071067811865E-01       000010

The py orbital with spin down on a basis of kubic harmonics is:
WaveFunction: Wave Function
QComplex         =          0 (Real==0 or Complex==1)
N                =          1 (Number of basis functions used to discribe psi)
NFermionic modes =          6 (Number of fermions in the one particle basis)
NBosonic modes   =          0 (Number of bosons in the one particle basis)

#      pre-factor         Determinant
1   1.000000000000E+00       001000

The pz orbital with spin down on a basis of spherical harmonics is:
WaveFunction: Wave Function
QComplex         =          0 (Real==0 or Complex==1)
N                =          1 (Number of basis functions used to discribe psi)
NFermionic modes =          6 (Number of fermions in the one particle basis)
NBosonic modes   =          0 (Number of bosons in the one particle basis)

#      pre-factor         Determinant
1   1.000000000000E+00       001000

The pz orbital with spin down on a basis of kubic harmonics is:
WaveFunction: Wave Function
QComplex         =          0 (Real==0 or Complex==1)
N                =          1 (Number of basis functions used to discribe psi)
NFermionic modes =          6 (Number of fermions in the one particle basis)
NBosonic modes   =          0 (Number of bosons in the one particle basis)

#      pre-factor         Determinant
1   1.000000000000E+00       000010

Counting the px orbital on a basis of spherical harmonics: 	1
Counting the px orbital on a basis of kubic     harmonics: 	1
Counting the py orbital on a basis of spherical harmonics: 	1
Counting the py orbital on a basis of kubic     harmonics: 	1
Counting the pz orbital on a basis of spherical harmonics: 	1
Counting the pz orbital on a basis of kubic     harmonics: 	1