This is an old revision of the document!
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(“”)
OppAn1=NewOperator(“An”,NF,1)
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.
Answers
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.
I've updated the code and the next version will through an error in this case.
Best wishes, Maurits
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?
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.
Please see our documentation on: