Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
documentation:language_reference:objects:responsefunction:functions:calculateselfenergy [2024/12/22 20:30] – Maurits W. Haverkort | documentation:language_reference:objects:responsefunction:functions:calculateselfenergy [2024/12/27 10:08] (current) – Maurits W. Haverkort | ||
---|---|---|---|
Line 17: | Line 17: | ||
===== Example ===== | ===== Example ===== | ||
### | ### | ||
+ | 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 CalculateSelfEnergy.Quanty> | <code Quanty CalculateSelfEnergy.Quanty> | ||
+ | -- 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)) | ||
- | -- H0, H1, Npsi, TPes, TIPes are defined beforehand | + | -- We now can define the full Hamiltonian |
- | psiList = Eigensystem(H0, | + | H = H0 + H1 |
+ | print("The full Hamiltonian is H0 + H1") | ||
+ | print(H) | ||
+ | print(" | ||
+ | print(OperatorToMatrix(H)) | ||
- | G0PESIPES_Spectra, | + | print("We now calcualte the bare (G0) and full (G) vacuum Green' |
- | G0 = G0PESIPES_ResponseFunction[2] | + | -- In order to define the Green' |
+ | psi0 = NewWavefunction(12,0,{{"000 000 000 000",1}}) | ||
- | Eigensystem(H0+H1, psiList[1]) -- Use H0 groundstate as Ansatz for Full Hamiltonian groundstate calculation | + | -- And the transition operators |
- | --For memory efficiency, this way of calling Eigensystem overwrites Ansatz wavefunction with a new one. | + | -- 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,0,{{ 0, sqrt(1/ | ||
+ | { 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() | ||
- | GPESIPES_Spectra, | + | print("G0 is") |
- | G = GPESIPES_ResponseFunction[2] | + | print(G0) |
+ | print("in matrix form that becomes") | ||
+ | print(ResponseFunction.ToMatrix(G0)) | ||
+ | print(" | ||
+ | print(G) | ||
+ | print(" | ||
+ | print(ResponseFunction.ToMatrix(G)) | ||
+ | |||
+ | print(" | ||
Sigma = ResponseFunction.CalculateSelfEnergy(G0, | Sigma = ResponseFunction.CalculateSelfEnergy(G0, | ||
+ | Sigma = ResponseFunction.ChangeType(Sigma," | ||
+ | Sigma.Chop() | ||
- | print(ResponseFunction.ToTable(Sigma)) | + | 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> | ||
- | { { 0.5 , 6.9374060711003e-16 , 3.0413812651491 | + | The tight binding Hamiltonian for a 4 cite chain is given as |
- | { 0.085601012694643 | + | |
- | name = Self energy , | + | 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 , 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, | ||
+ | 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 | ||
+ | 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 | ||
+ | { | ||
+ | { 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, | ||
+ | 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 | ||
+ | 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 , | mu = 0 , | ||
- | | + | |
- | </ | + | 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> | ||