# Problems with creation and annihilation operators

asked by Carlos Alberto Martins Junior (2020/02/22 18:59)

Hello,

I am trying to learn how to program using Quanty, however I am having some issues to understand why my code is wrong. I tried to print the creation and annihilation operators in a d shell basis but the result is wrong. My code is

NF=10
NB=0

IndexDn={0,2,4,6,8}
IndexUp={1,3,5,7,9}

psi0 =NewWavefunction(NF,NB,{{"0000000000",1}})
psi1 =NewWavefunction(NF,NB,{{"1000000000",1}})
psi2 =NewWavefunction(NF,NB,{{"1100000000",1}})
psi3 =NewWavefunction(NF,NB,{{"1110000000",1}})
psi4 =NewWavefunction(NF,NB,{{"1111000000",1}})
psi5 =NewWavefunction(NF,NB,{{"1111100000",1}})
psi6 =NewWavefunction(NF,NB,{{"1111110000",1}})
psi7 =NewWavefunction(NF,NB,{{"1111111000",1}})
psi8 =NewWavefunction(NF,NB,{{"1111111100",1}})
psi9 =NewWavefunction(NF,NB,{{"1111111110",1}})
psi10=NewWavefunction(NF,NB,{{"1111111111",1}})

psilist={psi0,psi1,psi2,psi3,psi4,psi5,psi6,psi7,psi8,psi9,psi10}

OppN   = NewOperator("Number",NF,{0,1,2,3,4,5,6,7,8,9,10},{0,1,2,3,4,5,6,7,8,9,10},{1,1,1,1,1,1,1,1,1,1,1})
OppCr  = NewOperator("Cr",NF,{0,1,2,3,4,5,6,7,8,9,10},{1,1,1,1,1,1,1,1,1,1,1})
OppAn  = NewOperator("An",NF,{0,1,2,3,4,5,6,7,8,9,10},{1,1,1,1,1,1,1,1,1,1,1})

print("Operator N:")
for i=1,11 do
for j=1,11 do
io.write(string.format("%5.2f",psilist[i]*OppN*psilist[j]))
end
io.write("\n")
end
print("")

print("Operator Cr:")
for i=1,11 do
for j=1,11 do
io.write(string.format("%5.2f",psilist[i]*OppCr*psilist[j]))
end
io.write("\n")
end
print("")

print("Operator An:")
for i=1,11 do
for j=1,11 do
io.write(string.format("%5.2f",psilist[i]*OppAn*psilist[j]))
end
io.write("\n")
end
print("")


And my result is

Operator N:
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 2.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 3.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 4.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 5.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 6.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 7.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 8.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.0010.00

Operator Cr:
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00-1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00-1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00-1.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00-1.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00-1.00 0.00

Operator An:
1.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 3.61-1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 5.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 6.08-1.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 7.00 1.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 7.81-1.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 8.54 1.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.22-1.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9.85 1.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.0010.44-1.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.0011.00

I do not understand why I got this result for the creation and annihilation operators.

, 2020/02/22 19:32, 2020/02/22 19:34

Dear Carlos,

Thank you for your question. This is a mixture of an error in your input and Quanty not producing a useful error message.

Your basis has 10 one electron wave-functions (a d-shell) that can be filled or empty. These are labeled from 0 to 9. Your operator

OppCr  = NewOperator("Cr",NF,{0,1,2,3,4,5,6,7,8,9,10},{1,1,1,1,1,1,1,1,1,1,1})

is equal to
$\sum_{i=0}^{i=10} a_{i}^{\dagger}$
The creation of a particle in orbital with index 10 ($a_{10}^{\dagger}$) is a problem. You only have initiated 10 Fermions in your basis, which are labeled from 0 to 9.

If you replace the operators by

OppN   = NewOperator("Number",NF,{0,1,2,3,4,5,6,7,8,9},{0,1,2,3,4,5,6,7,8,9},{1,1,1,1,1,1,1,1,1,1})
OppCr  = NewOperator("Cr",NF,{0,1,2,3,4,5,6,7,8,9},{1,1,1,1,1,1,1,1,1,1})
OppAn  = NewOperator("An",NF,{0,1,2,3,4,5,6,7,8,9},{1,1,1,1,1,1,1,1,1,1})

the result should make more sense.

Operator N:
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   1.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   2.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   3.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   4.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   5.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   6.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   7.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   8.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   9.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00  10.00

Operator Cr:
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
1.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00  -1.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   1.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00  -1.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   1.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00  -1.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   1.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00  -1.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   1.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00  -1.00   0.00

Operator An:
0.00   1.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00  -1.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   1.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00  -1.00   0.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   1.00   0.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00  -1.00   0.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   1.00   0.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00  -1.00   0.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   1.00   0.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00  -1.00
0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00

I've updated the code and the next version will through an error in this case.

Best wishes, Maurits

, 2020/02/26 19:39

Thanks. It help me a lot. However, I still do not get why there are negative matrix elements, when creation and annihilation operators for fermions only have 1 and 0 as eigenvalues. It is correlated with the electronic spin?

, 2020/02/26 20:04, 2020/02/26 20:05

Dear Carlos,

Ah those are commutation relations

$a^{\dagger}_i a^{\dagger}_j = - a^{\dagger}_j a^{\dagger}_i$

If you evaluate the following piece of code:

NF=2
NB=0

psi0 =NewWavefunction(NF,NB,{{"00",1}})
print(NewOperator("Cr",NF,0)*NewOperator("Cr",NF,1)*psi0)
print(NewOperator("Cr",NF,1)*NewOperator("Cr",NF,0)*psi0)

You will see that it prints two times a function with two electrons. One in orbital 0 and one in orbital 1, but that the coefficient for the first state is +1, for the second -1.

WaveFunction: Wave Function
QComplex         =          0 (Real==0 or Complex==1)
N                =          1 (Number of basis functions used to discribe psi)
NFermionic modes =          2 (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       11

WaveFunction: Wave Function
QComplex         =          0 (Real==0 or Complex==1)
N                =          1 (Number of basis functions used to discribe psi)
NFermionic modes =          2 (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       11

Please see our documentation on:

You could leave a comment if you were logged in.