Differences

This shows you the differences between two versions of the page.

Link to this comparison view

documentation:tutorials:introduction_to_quanty:operators_1 [2016/10/07 20:20] – created Maurits W. Haverkortdocumentation:tutorials:introduction_to_quanty:operators_1 [2016/10/10 09:41] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +{{indexmenu_n>2}}
 +====== Operators ======
  
 +###
 +The second example creates several operators using creation and annihilation operators
 +###
 +
 +###
 +<code Quanty Operators.Quanty>
 +-- A basis consists of:
 +-- a number of Fermionic modes or spin-orbitals
 +NF=6
 +-- a number of Bosonic modes (phonon modes, ...)
 +NB=0
 +
 +-- Once we have a basis we can define operators.
 +-- Operators are defined in second quantization. 
 +-- We thus need creation and annihilation operators.
 +
 +-- Operators are created with the function 
 +-- "NewOperator". This function takes as a first 
 +-- argument the type of operator to create and 
 +-- further arguments are type specific.
 +
 +-- The creation operator on site 0 is created by 
 +-- the following command 
 +OppC0=NewOperator("Cr",NF,0)
 +
 +-- The annihilation operator on site 0 is created 
 +-- by the following command
 +OppA0=NewOperator("An",NF,0)
 +
 +-- you can print operators
 +print(OppC0)
 +
 +-- the important part of this printout is given by 
 +-- the last line " 0 |  1.000000000000000E+00"
 +-- this tells you that the operator creates at 
 +-- position 0 with prefactor 1
 +
 +-- you are allowed to do mathematics with 
 +-- operators, i.e. the number operator acting 
 +-- on site 0 is given as:
 +OppCA0 = OppC0 * OppA0
 +print(OppCA0)
 +
 +
 +-- the program knows about commutation relations, 
 +-- so a^+_0 a_0 + a_0 a^+_0 = 1
 +Oppdelta = OppC0 * OppA0 + OppA0 * OppC0
 +print(Oppdelta)
 +
 +-- You see that this operator indeed has the 
 +-- correct form: " 1.000000000000000E+00"
 +-- but it also has one element of length 2: 
 +-- " 0 A  0 |  0.000000000000000E+00"
 +-- the total operator is the sum over these two terms.
 +-- The term of length two has prefactor 0, but it is still 
 +-- in the list of operators and thus takes memory.
 +-- You can remove small elements with the command 
 +-- Chop
 +Oppdelta.Chop()
 +print(Oppdelta)
 +
 +-- the number operator can also be created at once, 
 +OppN0 = NewOperator("Number",NF,0,0)
 +print(OppN0)
 +
 +-- you can create sum's of operators at once, 
 +-- evaluate to see what it does
 +Opp2=NewOperator("Cr", NF, {0,1,2}, {0.1,0.2,0.3})
 +print(Opp2)
 +Opp3=NewOperator("Number", NF, {0,1,2}, {0,1,5}, {0.1,0.2,0.3})
 +print(Opp3)
 +
 +-- Operators have a name which is shown in error 
 +-- messages and when you print the operator
 +-- sometimes it can be good to set the name
 +Opp4 =  1+((1+I) * Opp2*Opp3 + 2.7 * OppCA0 ) * Opp3
 +Opp4.Name = "My fantastic Operator"
 +print(Opp4)
 +</code>
 +###
 +
 +###
 +The output is:
 +<file Quanty_Output Operators.out>
 +Operator: Creation operator on site 0
 +QComplex                  0 (Real==0 or Complex==1 or Mixed==2)
 +MaxLength        =          1 (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   1
 +QComplex      =          0 (Real==0 or Complex==1)
 +N                      1 (number of operators of length   1)
 +C  0 |  1.000000000000000E+00
 +
 +
 +
 +Operator: Operator
 +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                      1 (number of operators of length   2)
 +C  0 A  0 |  1.000000000000000E+00
 +
 +
 +
 +Operator: Operator
 +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   0
 +QComplex      =          0 (Real==0 or Complex==1)
 +N                      1 (number of operators of length   0)
 +|  1.000000000000000E+00
 +
 +Operator of Length   2
 +QComplex      =          0 (Real==0 or Complex==1)
 +N                      1 (number of operators of length   2)
 +C  0 A  0 |  0.000000000000000E+00
 +
 +
 +
 +Operator: Operator
 +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   0
 +QComplex      =          0 (Real==0 or Complex==1)
 +N                      1 (number of operators of length   0)
 +|  1.000000000000000E+00
 +
 +
 +
 +Operator: CrAn
 +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                      1 (number of operators of length   2)
 +C  0 A  0 |  1.000000000000000E+00
 +
 +
 +
 +Operator: Cr
 +QComplex                  0 (Real==0 or Complex==1 or Mixed==2)
 +MaxLength        =          1 (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   1
 +QComplex      =          0 (Real==0 or Complex==1)
 +N                      3 (number of operators of length   1)
 +C  0 |  1.000000000000000E-01
 +C  1 |  2.000000000000000E-01
 +C  2 |  3.000000000000000E-01
 +
 +
 +
 +Operator: CrAn
 +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                      3 (number of operators of length   2)
 +C  0 A  0 |  1.000000000000000E-01
 +C  1 A  1 |  2.000000000000000E-01
 +C  2 A  5 |  3.000000000000000E-01
 +
 +
 +
 +Operator: My fantastic Operator
 +QComplex                  1 (Real==0 or Complex==1 or Mixed==2)
 +MaxLength        =          5 (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   0
 +QComplex      =          1 (Real==0 or Complex==1)
 +N                      1 (number of operators of length   0)
 +|  1.000000000000000E+00  0.000000000000000E+00
 +
 +Operator of Length   2
 +QComplex      =          1 (Real==0 or Complex==1)
 +N                      1 (number of operators of length   2)
 +C  0 A  0 |  2.700000000000000E-01  0.000000000000000E+00
 +
 +Operator of Length   3
 +QComplex      =          1 (Real==0 or Complex==1)
 +N                      4 (number of operators of length   3)
 +C  1 C  0 A  0 |  2.000000000000000E-03  2.000000000000000E-03
 +C  2 C  0 A  0 |  3.000000000000000E-03  3.000000000000000E-03
 +C  1 C  0 A  1 | -4.000000000000001E-03 -4.000000000000001E-03
 +C  2 C  1 A  1 |  1.200000000000000E-02  1.200000000000000E-02
 +
 +Operator of Length   4
 +QComplex      =          1 (Real==0 or Complex==1)
 +N                      2 (number of operators of length   4)
 +C  1 C  0 A  1 A  0 | -5.400000000000000E-01 -0.000000000000000E+00
 +C  2 C  0 A  5 A  0 | -8.100000000000001E-01 -0.000000000000000E+00
 +
 +Operator of Length   5
 +QComplex      =          1 (Real==0 or Complex==1)
 +N                      3 (number of operators of length   5)
 +C  2 C  1 C  0 A  1 A  0 | -1.200000000000000E-02 -1.200000000000000E-02
 +C  2 C  1 C  0 A  5 A  0 |  1.200000000000000E-02  1.200000000000000E-02
 +C  2 C  1 C  0 A  5 A  1 | -1.200000000000000E-02 -1.200000000000000E-02
 +</file>
 +###
 +
 +===== Table of contents =====
 +{{indexmenu>.#1|msort}}
Print/export