Differences
This shows you the differences between two versions of the page.
| documentation:tutorials:introduction_to_quanty:operators_1 [2016/10/07 20:20] – created Maurits W. Haverkort | documentation:tutorials:introduction_to_quanty:operators_1 [2025/11/20 03:29] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | {{indexmenu_n> | ||
| + | ====== 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 | ||
| + | -- " | ||
| + | -- 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(" | ||
| + | |||
| + | -- The annihilation operator on site 0 is created | ||
| + | -- by the following command | ||
| + | OppA0=NewOperator(" | ||
| + | |||
| + | -- you can print operators | ||
| + | print(OppC0) | ||
| + | |||
| + | -- the important part of this printout is given by | ||
| + | -- the last line " | ||
| + | -- 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: " | ||
| + | -- but it also has one element of length 2: | ||
| + | -- " | ||
| + | -- 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(" | ||
| + | print(OppN0) | ||
| + | |||
| + | -- you can create sum's of operators at once, | ||
| + | -- evaluate to see what it does | ||
| + | Opp2=NewOperator(" | ||
| + | print(Opp2) | ||
| + | Opp3=NewOperator(" | ||
| + | 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) | ||
| + | </ | ||
| + | ### | ||
| + | |||
| + | ### | ||
| + | The output is: | ||
| + | <file Quanty_Output Operators.out> | ||
| + | Operator: Creation operator on site 0 | ||
| + | QComplex | ||
| + | MaxLength | ||
| + | NFermionic modes = 6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
| + | NBosonic modes | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | C 0 | 1.000000000000000E+00 | ||
| + | |||
| + | |||
| + | |||
| + | Operator: Operator | ||
| + | QComplex | ||
| + | MaxLength | ||
| + | NFermionic modes = 6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
| + | NBosonic modes | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | C 0 A 0 | 1.000000000000000E+00 | ||
| + | |||
| + | |||
| + | |||
| + | Operator: Operator | ||
| + | QComplex | ||
| + | MaxLength | ||
| + | NFermionic modes = 6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
| + | NBosonic modes | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | | 1.000000000000000E+00 | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | C 0 A 0 | 0.000000000000000E+00 | ||
| + | |||
| + | |||
| + | |||
| + | Operator: Operator | ||
| + | QComplex | ||
| + | MaxLength | ||
| + | NFermionic modes = 6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
| + | NBosonic modes | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | | 1.000000000000000E+00 | ||
| + | |||
| + | |||
| + | |||
| + | Operator: CrAn | ||
| + | QComplex | ||
| + | MaxLength | ||
| + | NFermionic modes = 6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
| + | NBosonic modes | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | C 0 A 0 | 1.000000000000000E+00 | ||
| + | |||
| + | |||
| + | |||
| + | Operator: Cr | ||
| + | QComplex | ||
| + | MaxLength | ||
| + | NFermionic modes = 6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
| + | NBosonic modes | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | C 0 | 1.000000000000000E-01 | ||
| + | C 1 | 2.000000000000000E-01 | ||
| + | C 2 | 3.000000000000000E-01 | ||
| + | |||
| + | |||
| + | |||
| + | Operator: CrAn | ||
| + | QComplex | ||
| + | MaxLength | ||
| + | NFermionic modes = 6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
| + | NBosonic modes | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | 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 | ||
| + | MaxLength | ||
| + | NFermionic modes = 6 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
| + | NBosonic modes | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | | 1.000000000000000E+00 | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | C 0 A 0 | 2.700000000000000E-01 | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | C 1 C 0 A 0 | 2.000000000000000E-03 | ||
| + | C 2 C 0 A 0 | 3.000000000000000E-03 | ||
| + | C 1 C 0 A 1 | -4.000000000000001E-03 -4.000000000000001E-03 | ||
| + | C 2 C 1 A 1 | 1.200000000000000E-02 | ||
| + | |||
| + | Operator of Length | ||
| + | QComplex | ||
| + | N | ||
| + | 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 | ||
| + | QComplex | ||
| + | N | ||
| + | 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 | ||
| + | C 2 C 1 C 0 A 5 A 1 | -1.200000000000000E-02 -1.200000000000000E-02 | ||
| + | </ | ||
| + | ### | ||
| + | |||
| + | ===== Table of contents ===== | ||
| + | {{indexmenu> | ||