Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
documentation:language_reference:objects:responsefunction:functions:calculateselfenergy [2024/09/16 11:53] – created Maurits W. Haverkort | documentation:language_reference:objects:responsefunction:functions:calculateselfenergy [2024/12/27 10:08] (current) – Maurits W. Haverkort | ||
---|---|---|---|
Line 3: | Line 3: | ||
### | ### | ||
- | alligned paragraph text | + | ResponseFunction.CalculateSelfEnergy($G_0$, |
+ | \begin{equation} | ||
+ | \Sigma = G_0^{-1} - G^{-1} | ||
+ | \end{equation} | ||
### | ### | ||
+ | ===== Input ===== | ||
+ | * $G_0$ : ResponseFunction object | ||
+ | * $G$ : ResponseFunction object | ||
+ | * Possible options are: | ||
+ | * " | ||
+ | ===== Output ===== | ||
+ | * $\Sigma$ : ResponseFunction object | ||
===== Example ===== | ===== Example ===== | ||
- | |||
### | ### | ||
- | description text | + | As an example we take a one dimensional tight binding Hamiltonian of a 4 site ring for $H_0$ and $G_0$. To this we add to each site a one dimensional chain of length 2. In most real cases $H_1$ would be a two particle interaction. This example allows one to see the effect of the different algorithms clearly. |
### | ### | ||
- | |||
==== Input ==== | ==== Input ==== | ||
- | <code Quanty | + | <code Quanty |
- | -- some example code | + | -- We define H0 as a 4 site tight binding model with periodic boundary conditions |
+ | -- | ||
+ | -- ... (0) --- (3) --- (6) --- (9) --- (0) ... | ||
+ | -- | ||
+ | H0 = NewOperator(12, | ||
+ | | ||
+ | | ||
+ | | ||
+ | print(" | ||
+ | print(H0) | ||
+ | print(" | ||
+ | print(OperatorToMatrix(H0)) | ||
+ | |||
+ | -- We define H1 as coupling to the local sites | ||
+ | -- | ||
+ | -- (0) | ||
+ | -- | ||
+ | -- (1) | ||
+ | -- | ||
+ | -- (2) | ||
+ | -- | ||
+ | H1 = NewOperator(12, | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | { 10, | ||
+ | print(" | ||
+ | print(" | ||
+ | print(H1) | ||
+ | print(" | ||
+ | print(OperatorToMatrix(H1)) | ||
+ | |||
+ | -- We now can define the full Hamiltonian | ||
+ | H = H0 + H1 | ||
+ | print(" | ||
+ | print(H) | ||
+ | print(" | ||
+ | print(OperatorToMatrix(H)) | ||
+ | |||
+ | print(" | ||
+ | -- In order to define the Green' | ||
+ | psi0 = NewWavefunction(12, | ||
+ | |||
+ | -- And the transition operators | ||
+ | -- We want a^{dag}_k = sum_{x=1}^N \sqrt{1/N} e^{i k x} a^{dag}_x | ||
+ | adag={} | ||
+ | x = {0,1,2,3} | ||
+ | k = {0/ | ||
+ | for ik=1,4 do | ||
+ | adag[ik] = NewOperator(12, | ||
+ | { 3, sqrt(1/ | ||
+ | { 6, sqrt(1/ | ||
+ | { 9, sqrt(1/ | ||
+ | end | ||
+ | -- Create Green' | ||
+ | S0, G0 = CreateSpectra(H0, | ||
+ | G0.Chop() | ||
+ | S, G = CreateSpectra(H , adag, psi0, | ||
+ | G.Chop() | ||
+ | |||
+ | print(" | ||
+ | print(G0) | ||
+ | print(" | ||
+ | print(ResponseFunction.ToMatrix(G0)) | ||
+ | |||
+ | print(" | ||
+ | print(G) | ||
+ | print(" | ||
+ | print(ResponseFunction.ToMatrix(G)) | ||
+ | |||
+ | print(" | ||
+ | Sigma = ResponseFunction.CalculateSelfEnergy(G0, | ||
+ | Sigma = ResponseFunction.ChangeType(Sigma," | ||
+ | Sigma.Chop() | ||
+ | |||
+ | print(Sigma) | ||
+ | |||
+ | print(" | ||
+ | omega = 0.1 | ||
+ | Gamma = 0.3 | ||
+ | |||
+ | print(" | ||
+ | print(G(omega, | ||
+ | |||
+ | print(" | ||
+ | print(Matrix.Inverse( Matrix.Inverse(G0(omega, | ||
+ | |||
+ | print(" | ||
+ | print(G(omega, | ||
+ | print(" | ||
+ | print(" | ||
+ | print(0.1+0.2-0.3) | ||
+ | |||
+ | print(" | ||
+ | print(Chop( G(omega, | ||
</ | </ | ||
==== Result ==== | ==== Result ==== | ||
<file Quanty_Output> | <file Quanty_Output> | ||
- | text produced | + | The tight binding Hamiltonian for a 4 cite chain is given as |
- | </ | + | |
+ | Operator: Operator | ||
+ | QComplex | ||
+ | MaxLength | ||
+ | NFermionic modes = 12 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
+ | NBosonic modes | ||
+ | |||
+ | Operator of Length | ||
+ | QComplex | ||
+ | N | ||
+ | C 0 A 3 | 1.00000000000000E+00 | ||
+ | C 3 A 0 | 1.00000000000000E+00 | ||
+ | C 3 A 6 | 1.00000000000000E+00 | ||
+ | C 6 A 3 | 1.00000000000000E+00 | ||
+ | C 6 A 9 | 1.00000000000000E+00 | ||
+ | C 9 A 6 | 1.00000000000000E+00 | ||
+ | C 9 A 0 | 1.00000000000000E+00 | ||
+ | C 0 A 9 | 1.00000000000000E+00 | ||
+ | |||
+ | |||
+ | In matrix form | ||
+ | { { 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } } | ||
+ | |||
+ | The full Hamiltonian we take as the one dimensional chain with side chains | ||
+ | The side chains are given by the Hamiltonian | ||
+ | |||
+ | Operator: Operator | ||
+ | QComplex | ||
+ | MaxLength | ||
+ | NFermionic modes = 12 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
+ | NBosonic modes | ||
+ | |||
+ | Operator of Length | ||
+ | QComplex | ||
+ | N | ||
+ | C 0 A 1 | 1.00000000000000E+00 | ||
+ | C 1 A 0 | 1.00000000000000E+00 | ||
+ | C 1 A 2 | 1.00000000000000E+00 | ||
+ | C 2 A 1 | 1.00000000000000E+00 | ||
+ | C 3 A 4 | 1.00000000000000E+00 | ||
+ | C 4 A 3 | 1.00000000000000E+00 | ||
+ | C 4 A 5 | 1.00000000000000E+00 | ||
+ | C 5 A 4 | 1.00000000000000E+00 | ||
+ | C 6 A 7 | 1.00000000000000E+00 | ||
+ | C 7 A 6 | 1.00000000000000E+00 | ||
+ | C 7 A 8 | 1.00000000000000E+00 | ||
+ | C 8 A 7 | 1.00000000000000E+00 | ||
+ | C 9 A 10 | 1.00000000000000E+00 | ||
+ | C 10 A 9 | 1.00000000000000E+00 | ||
+ | C 10 A 11 | 1.00000000000000E+00 | ||
+ | C 11 A 10 | 1.00000000000000E+00 | ||
+ | |||
+ | |||
+ | In matrix form | ||
+ | { { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } } | ||
+ | |||
+ | The full Hamiltonian is H0 + H1 | ||
+ | |||
+ | Operator: Operator | ||
+ | QComplex | ||
+ | MaxLength | ||
+ | NFermionic modes = 12 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis) | ||
+ | NBosonic modes | ||
+ | |||
+ | Operator of Length | ||
+ | QComplex | ||
+ | N | ||
+ | C 0 A 3 | 1.00000000000000E+00 | ||
+ | C 3 A 0 | 1.00000000000000E+00 | ||
+ | C 3 A 6 | 1.00000000000000E+00 | ||
+ | C 6 A 3 | 1.00000000000000E+00 | ||
+ | C 6 A 9 | 1.00000000000000E+00 | ||
+ | C 9 A 6 | 1.00000000000000E+00 | ||
+ | C 9 A 0 | 1.00000000000000E+00 | ||
+ | C 0 A 9 | 1.00000000000000E+00 | ||
+ | C 0 A 1 | 1.00000000000000E+00 | ||
+ | C 1 A 0 | 1.00000000000000E+00 | ||
+ | C 1 A 2 | 1.00000000000000E+00 | ||
+ | C 2 A 1 | 1.00000000000000E+00 | ||
+ | C 3 A 4 | 1.00000000000000E+00 | ||
+ | C 4 A 3 | 1.00000000000000E+00 | ||
+ | C 4 A 5 | 1.00000000000000E+00 | ||
+ | C 5 A 4 | 1.00000000000000E+00 | ||
+ | C 6 A 7 | 1.00000000000000E+00 | ||
+ | C 7 A 6 | 1.00000000000000E+00 | ||
+ | C 7 A 8 | 1.00000000000000E+00 | ||
+ | C 8 A 7 | 1.00000000000000E+00 | ||
+ | C 9 A 10 | 1.00000000000000E+00 | ||
+ | C 10 A 9 | 1.00000000000000E+00 | ||
+ | C 10 A 11 | 1.00000000000000E+00 | ||
+ | C 11 A 10 | 1.00000000000000E+00 | ||
+ | |||
+ | |||
+ | In matrix form | ||
+ | { { 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 } , | ||
+ | { 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 1 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } , | ||
+ | { 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } } | ||
+ | |||
+ | We now calcualte the bare (G0) and full (G) vacuum Green' | ||
+ | Start of LanczosBlockTriDiagonalize | ||
+ | Start of LanczosBlockTriDiagonalizeRC | ||
+ | Reduce dimension from 4 to 0 in block 1 | ||
+ | Start of LanczosBlockTriDiagonalize | ||
+ | Start of LanczosBlockTriDiagonalizeRC | ||
+ | Reduce dimension from 4 to 0 in block 3 | ||
+ | G0 is | ||
+ | { { { { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } , | ||
+ | { { 2 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , -2 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } } , | ||
+ | { { { 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 } } } , | ||
+ | BlockSize = { 4 , 4 } , | ||
+ | type = Tri , | ||
+ | mu = 0 , | ||
+ | name = Block Tridiagonal Matrix } | ||
+ | in matrix form that becomes | ||
+ | { { 2 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , -2 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } | ||
+ | |||
+ | G is | ||
+ | { { { { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } , | ||
+ | { { 2 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , -2 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } , | ||
+ | { { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } , | ||
+ | { { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } } , | ||
+ | { { { 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 } } , | ||
+ | { { 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 } } , | ||
+ | { { 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 } } } , | ||
+ | BlockSize = { 4 , 4 , 4 , 4 } , | ||
+ | type = Tri , | ||
+ | mu = 0 , | ||
+ | name = Block Tridiagonal Matrix } | ||
+ | in matrix form that becomes | ||
+ | { { 2 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , -2 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } , | ||
+ | { 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 } , | ||
+ | { 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } } | ||
+ | |||
+ | The self energy can be calcualted as Sigma = G0^{-1} - G^{-1} | ||
+ | Reduce dimension from 4 to 0 in block 2 | ||
+ | { { { { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } , | ||
+ | { { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } , | ||
+ | { { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } } , | ||
+ | { { { 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 } } , | ||
+ | { { 1 , 0 , 0 , 0 } , | ||
+ | { 0 , 1 , 0 , 0 } , | ||
+ | { 0 , 0 , 1 , 0 } , | ||
+ | { 0 , 0 , 0 , 1 } } } , | ||
+ | BlockSize = { 4 , 4 , 4 } , | ||
+ | type = Tri , | ||
+ | mu = 0 , | ||
+ | name = Matrix } | ||
+ | We now can compare G0(w), G(w) and G0(w-Sigma(w)) | ||
+ | G(omega) | ||
+ | { { (-0.55141413226786 - 0.046491809053112 I) , 0 , 0 , 0 } , | ||
+ | { 0 , (3.1750878423276 - 2.418978356337 I) , 0 , 0 } , | ||
+ | { 0 , 0 , (0.4525371980109 - 0.031240475239916 I) , 0 } , | ||
+ | { 0 , 0 , 0 , (3.1750878423276 - 2.418978356337 I) } } | ||
+ | G(omega-Sigma(omega)) | ||
+ | { { (-0.55141413226786 - 0.046491809053112 I) , 0 , 0 , 0 } , | ||
+ | { 0 , (3.1750878423276 - 2.418978356337 I) , 0 , 0 } , | ||
+ | { 0 , 0 , (0.4525371980109 - 0.031240475239916 I) , 0 } , | ||
+ | { -0 , -0 , -0 , (3.1750878423276 - 2.418978356337 I) } } | ||
+ | G(omega)-Sigma(omega) | ||
+ | { { (-1.1102230246252e-16 - 8.3266726846887e-17 I) , 0 , 0 , 0 } , | ||
+ | { 0 , (-8.8817841970013e-16 - 4.4408920985006e-16 I) , 0 , 0 } , | ||
+ | { 0 , 0 , (-5.5511151231258e-17 - 4.5102810375397e-17 I) , 0 } , | ||
+ | { 0 , 0 , 0 , 4.4408920985006e-16 } } | ||
+ | The previous should have been zero but computer math is different. Have a look at | ||
+ | 0.1+0.2-0.3 | ||
+ | 5.5511151231258e-17 | ||
+ | If we " | ||
+ | { { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } , | ||
+ | { 0 , 0 , 0 , 0 } } | ||
+ | </ | ||
===== Table of contents ===== | ===== Table of contents ===== | ||
- | {{indexmenu> | + | {{indexmenu> |