{{indexmenu_n>999}}
====== Response function ======
One simple way to represent a spectrum, for example one that is calculated using the function //[[documentation:language_reference:functions:createspectra|CreateSpectra()]]//, is a sum over the poles multiplied by the residues:
\begin{equation}
I(\omega) = \sum_{k} \frac{R_k}{\omega - \omega_k + i \gamma/2} \qquad \qquad \qquad (1)
\end{equation}
A more compact way to store this spectrum, as a function of $\omega$ (and $\gamma$), is by just using two arrays for the values of $ \{R_k\} $ (residues) and $ \{\omega_k\} $ (poles). This is precicely the purpose of the object //Response Function//. In other words, response functions in Quanty are functions that, given a complex number as input ($\omega + i \gamma/2$) return a complex number (single valued functions). Additionally, the output could be a matrix (matrix functions) when the response function is defined using array of matrices, instead of array of numbers. Response functions fullfil the Kramers Kronig relations and "causality".
The response functions can also be defined by matrices such that the function is given by
$$ A_0 + B_0^* \frac{ 1 }{\omega - H + i \gamma / 2} \Bigg|_{[0,0]} B_0^{T} $$
where $A_0$, $B_0$ and $H$ are matrices. Any unitary transformation that leaves the [0,0] element of $H$ unchanged results in the same spectrum. Hence $H$ can have different forms, whereby only a few elements/blocks are non-zero. In Quanty, there are 4 different forms (types) for the matrix $H$:
* list of poles (//ListOfPoles//)
* tri-diagonal (//Tri//)
* Anderson (//And//)
* natural impurity orbital (//NaturalImpurityOrbital//)
These types are related to each other by unitary transformations and the Quanty function //[[documentation/language_reference/objects/responsefunction/functions/changetype|ChangeType()]]// can be used to transform between these types. List of poles is exactly the representation in Eq. (1).
In order to define a response function, one needs to set the meta table to "ResponseFunctionMeta" in Lua. Note that there is no type-check, (i.e. setting the meta table is optional) for the functions acting on these tables.
==== Definitions ====
-- Defining single-valued response functions
a = {0, -1,-0.5, 0, 0.5, 1, 1.5}
b = { 0.2, 0.1, 0.1, 0.1, 0.2, 0.3}
GA_L = {a,b,mu=0,type="ListOfPoles", name="A"}
setmetatable(GA_L, ResponseFunctionMeta)
a = {0, 1, 1, 1, 1, 1, 1}
b = { 1, 0.5, 0.5, 0.5, 0.5, 0.5}
GB_T = {a,b,mu=0,type="Tri", name="B"}
setmetatable(GB_T, ResponseFunctionMeta)
a = {0, 1, 1.5, 2, 2.5, 3, 3.5}
b = { 1, 0.5, 0.5, 0.5, 0.5, 0.5}
GC_A = {a,b,mu=0,type="And", name="C"}
setmetatable(GC_A, ResponseFunctionMeta)
acon = {0, 1, 1, 1, 1, 1, 1}
bcon = { sqrt(1/2), 0.5, 0.5, 0.5, 0.5, 0.5}
Gcon = {acon,bcon,mu=0,type="Tri"}
setmetatable(Gcon, ResponseFunctionMeta)
aval = {0, -1, -1, -1, -1, -1, -1}
bval = { sqrt(1/2), 0.5, 0.5, 0.5, 0.5, 0.5}
Gval = {aval,bval,mu=0,type="Tri"}
setmetatable(Gval, ResponseFunctionMeta)
a0=0
b0=1
GD_N = {{a0,b0},val=Gval,con=Gcon,mu=0,type="Nat", name="D"}
setmetatable(GD_N, ResponseFunctionMeta)
-- For a more efficient storage, one can convert from Table to Userdata
GA_l = ResponseFunction.ToUserdata(GA_L)
GB_t = ResponseFunction.ToUserdata(GB_T)
GC_a = ResponseFunction.ToUserdata(GC_A)
GD_n = ResponseFunction.ToUserdata(GD_N)
print("GA_L:")
print(GA_L)
print("GA_l:")
print(GA_l)
print("GB_T:")
print(GB_T)
print("GB_t:")
print(GB_t)
print("GC_A:")
print(GC_A)
print("GC_a:")
print(GC_a)
print("GD_N:")
print(GD_N)
print("GD_n:")
print(GD_n)
-- response functions in Quanty are functions that, given
-- a complex number as input w + I gamma/2 return a complex
-- number (single valued functions) or a matrix (matrix functions)
omega = 0.764
gamma = 0.1
print("omega = ", omega)
print("gamma = ", gamma)
print("")
print("GA_L(omega, gamma) = ", GA_L(omega, gamma))
print("GA_l(omega, gamma) = ", GA_l(omega, gamma))
print("GB_T(omega, gamma) = ", GB_T(omega, gamma))
print("GB_t(omega, gamma) = ", GB_t(omega, gamma))
print("GC_A(omega, gamma) = ", GC_A(omega, gamma))
print("GC_a(omega, gamma) = ", GC_a(omega, gamma))
print("GD_N(omega, gamma) = ", GD_N(omega, gamma))
print("GD_n(omega, gamma) = ", GD_n(omega, gamma))
-- Defining matrix response functions
A0 = {{0,0,0},{0,0,0},{0,0,0}}
setmetatable(A0, MatrixMeta)
A1 = {{1,2,3},{2,5,6},{3,6,9}}
setmetatable(A1, MatrixMeta)
A2 = {{2,2,3},{2,5,6},{3,6,9}}
setmetatable(A2, MatrixMeta)
A3 = {{3,2,3},{2,5,6},{3,6,9}}
setmetatable(A3, MatrixMeta)
a1 = -1
a2 = 0
a3 = 1
av1 = -0.5
av2 = -1.0
av3 = -1.5
ac1 = 0.5
ac2 = 1.0
ac3 = 1.5
B0s = {{1,0,0},{0,1,0},{0,0,1}}
setmetatable(B0s, MatrixMeta)
t=sqrt(0.5)
B0vs = {{t,0,0},{0,t,0},{0,0,t}}
setmetatable(B0vs, MatrixMeta)
B0cs = {{t,0,0},{0,t,0},{0,0,t}}
setmetatable(B0cs, MatrixMeta)
B0 = B0s * B0s
B0v = B0vs * B0vs
B0c = B0cs * B0cs
B1s = {{1,I,3},{-I,5,6},{3,6,9}}
setmetatable(B1s, MatrixMeta)
B1 = B1s * B1s
B2s = {{2,0,3},{0,5,6},{3,6,9}}
setmetatable(B2s, MatrixMeta)
B2 = B2s * B2s
B3s = {{3,0,3},{0,5,6},{3,6,9}}
setmetatable(B3s, MatrixMeta)
B3 = B3s * B3s
MA_L = { {A0,a1,a2,a3}, {B1,B2,B3}, mu=0, type="ListOfPoles", name="A"}
setmetatable(MA_L, ResponseFunctionMeta)
MB_T = { {A0,A1,A2,A3}, {B0,B1,B2}, mu=0, type="Tri", name="B"}
setmetatable(MB_T, ResponseFunctionMeta)
MC_A = { {A0,A1,A2,A3}, {B0,B1,B2}, mu=0, type="And", name="C"}
setmetatable(MC_A, ResponseFunctionMeta)
MD_Nv = { {A0,av1,av2,av3}, {B1,B2,B3}, mu=0, type="ListOfPoles", name="Dv"}
setmetatable(MD_Nv, ResponseFunctionMeta)
MD_Nc = { {A0,ac1,ac2,ac3}, {B1,B2,B3}, mu=0, type="ListOfPoles", name="Dc"}
setmetatable(MD_Nc, ResponseFunctionMeta)
MD_N = {{A0,B0},val=MD_Nv,con=MD_Nc,mu=0,type="Nat", name="D"}
setmetatable(MD_N, ResponseFunctionMeta)
-- For a more efficient storage, one can convert from Table to Userdata
MA_l = ResponseFunction.ToUserdata(MA_L)
MB_t = ResponseFunction.ToUserdata(MB_T)
MC_a = ResponseFunction.ToUserdata(MC_A)
MD_n = ResponseFunction.ToUserdata(MD_N)
print("MA_L:")
print(MA_L)
print("MA_l:")
print(MA_l)
print("MB_T:")
print(MB_T)
print("MB_t:")
print(MB_t)
print("MC_A:")
print(MC_A)
print("MC_a:")
print(MC_a)
print("MD_N:")
print(MD_N)
print("MD_n:")
print(MD_n)
-- response functions in Quanty are functions that, given
-- a complex number as input w + I gamma/2 return a complex
-- number (single valued functions) or a matrix (matrix functions)
omega = 0.764
gamma = 0.1
print("omega = ", omega)
print("gamma = ", gamma)
print("")
print("MA_L(omega, gamma) = ")
print(MA_L(omega, gamma))
print("MA_l(omega, gamma) = ")
print(MA_l(omega, gamma))
print("")
print("MB_T(omega, gamma) = ")
print(MB_T(omega, gamma))
print("MB_t(omega, gamma) = ")
print(MB_t(omega, gamma))
print("")
print("MC_A(omega, gamma) = ")
print(MC_A(omega, gamma))
print("MC_a(omega, gamma) = ")
print(MC_a(omega, gamma))
print("")
print("MD_N(omega, gamma) = ")
print(MD_N(omega, gamma))
print("MD_n(omega, gamma) = ")
print(MD_n(omega, gamma))
GA_L:
{ { 0 , -1 , -0.5 , 0 , 0.5 , 1 , 1.5 } ,
{ 0.2 , 0.1 , 0.1 , 0.1 , 0.2 , 0.3 } ,
type = ListOfPoles ,
mu = 0 ,
name = A }
GA_l:
ResponseFunction in userdata format use ToTable() in order to get a table form
GB_T:
{ { 0 , 1 , 1 , 1 , 1 , 1 , 1 } ,
{ 1 , 0.5 , 0.5 , 0.5 , 0.5 , 0.5 } ,
type = Tri ,
mu = 0 ,
name = B }
GB_t:
ResponseFunction in userdata format use ToTable() in order to get a table form
GC_A:
{ { 0 , 1 , 1.5 , 2 , 2.5 , 3 , 3.5 } ,
{ 1 , 0.5 , 0.5 , 0.5 , 0.5 , 0.5 } ,
type = And ,
mu = 0 ,
name = C }
GC_a:
ResponseFunction in userdata format use ToTable() in order to get a table form
GD_N:
{ { 0 , 1 } ,
type = Nat ,
val = { { 0 , -1 , -1 , -1 , -1 , -1 , -1 } ,
{ 0.70710678118655 , 0.5 , 0.5 , 0.5 , 0.5 , 0.5 } ,
mu = 0 ,
type = Tri } ,
con = { { 0 , 1 , 1 , 1 , 1 , 1 , 1 } ,
{ 0.70710678118655 , 0.5 , 0.5 , 0.5 , 0.5 , 0.5 } ,
mu = 0 ,
type = Tri } ,
name = D ,
mu = 0 }
GD_n:
ResponseFunction in userdata format use ToTable() in order to get a table form
omega = 0.764
gamma = 0.1
GA_L(omega, gamma) = (-0.52850742098896 - 0.28351791776891 I)
GA_l(omega, gamma) = (-0.52850742098896 - 0.28351791776891 I)
GB_T(omega, gamma) = (-1.6762624946074 - 5.2043002596032 I)
GB_t(omega, gamma) = (-1.6762624946074 - 5.2043002596032 I)
GC_A(omega, gamma) = (1.5075603166492 - 0.20713674761056 I)
GC_a(omega, gamma) = (1.5075603166492 - 0.20713674761056 I)
GD_N(omega, gamma) = (-0.52770560643508 - 2.61282805234 I)
GD_n(omega, gamma) = (-0.52770560643508 - 2.61282805234 I)
MA_L:
{ { { { 0 , 0 , 0 } ,
{ 0 , 0 , 0 } ,
{ 0 , 0 , 0 } } , -1 , 0 , 1 } ,
{ { { 11 , (18 + 6 I) , (30 + 6 I) } ,
{ (18 - 6 I) , 62 , (84 - 3 I) } ,
{ (30 - 6 I) , (84 + 3 I) , 126 } } ,
{ { 13 , 18 , 33 } ,
{ 18 , 61 , 84 } ,
{ 33 , 84 , 126 } } ,
{ { 18 , 18 , 36 } ,
{ 18 , 61 , 84 } ,
{ 36 , 84 , 126 } } } ,
type = ListOfPoles ,
mu = 0 ,
name = A }
MA_l:
ResponseFunction in userdata format use ToTable() in order to get a table form
MB_T:
{ { { { 0 , 0 , 0 } ,
{ 0 , 0 , 0 } ,
{ 0 , 0 , 0 } } ,
{ { 1 , 2 , 3 } ,
{ 2 , 5 , 6 } ,
{ 3 , 6 , 9 } } ,
{ { 2 , 2 , 3 } ,
{ 2 , 5 , 6 } ,
{ 3 , 6 , 9 } } ,
{ { 3 , 2 , 3 } ,
{ 2 , 5 , 6 } ,
{ 3 , 6 , 9 } } } ,
{ { { 1 , 0 , 0 } ,
{ 0 , 1 , 0 } ,
{ 0 , 0 , 1 } } ,
{ { 11 , (18 + 6 I) , (30 + 6 I) } ,
{ (18 - 6 I) , 62 , (84 - 3 I) } ,
{ (30 - 6 I) , (84 + 3 I) , 126 } } ,
{ { 13 , 18 , 33 } ,
{ 18 , 61 , 84 } ,
{ 33 , 84 , 126 } } } ,
type = Tri ,
mu = 0 ,
name = B }
MB_t:
ResponseFunction in userdata format use ToTable() in order to get a table form
MC_A:
{ { { { 0 , 0 , 0 } ,
{ 0 , 0 , 0 } ,
{ 0 , 0 , 0 } } ,
{ { 1 , 2 , 3 } ,
{ 2 , 5 , 6 } ,
{ 3 , 6 , 9 } } ,
{ { 2 , 2 , 3 } ,
{ 2 , 5 , 6 } ,
{ 3 , 6 , 9 } } ,
{ { 3 , 2 , 3 } ,
{ 2 , 5 , 6 } ,
{ 3 , 6 , 9 } } } ,
{ { { 1 , 0 , 0 } ,
{ 0 , 1 , 0 } ,
{ 0 , 0 , 1 } } ,
{ { 11 , (18 + 6 I) , (30 + 6 I) } ,
{ (18 - 6 I) , 62 , (84 - 3 I) } ,
{ (30 - 6 I) , (84 + 3 I) , 126 } } ,
{ { 13 , 18 , 33 } ,
{ 18 , 61 , 84 } ,
{ 33 , 84 , 126 } } } ,
type = And ,
mu = 0 ,
name = C }
MC_a:
ResponseFunction in userdata format use ToTable() in order to get a table form
MD_N:
{ { { { 0 , 0 , 0 } ,
{ 0 , 0 , 0 } ,
{ 0 , 0 , 0 } } ,
{ { 1 , 0 , 0 } ,
{ 0 , 1 , 0 } ,
{ 0 , 0 , 1 } } } ,
type = Nat ,
val = { { { { 0 , 0 , 0 } ,
{ 0 , 0 , 0 } ,
{ 0 , 0 , 0 } } , -0.5 , -1 , -1.5 } ,
{ { { 11 , (18 + 6 I) , (30 + 6 I) } ,
{ (18 - 6 I) , 62 , (84 - 3 I) } ,
{ (30 - 6 I) , (84 + 3 I) , 126 } } ,
{ { 13 , 18 , 33 } ,
{ 18 , 61 , 84 } ,
{ 33 , 84 , 126 } } ,
{ { 18 , 18 , 36 } ,
{ 18 , 61 , 84 } ,
{ 36 , 84 , 126 } } } ,
type = ListOfPoles ,
mu = 0 ,
name = Dv } ,
con = { { { { 0 , 0 , 0 } ,
{ 0 , 0 , 0 } ,
{ 0 , 0 , 0 } } , 0.5 , 1 , 1.5 } ,
{ { { 11 , (18 + 6 I) , (30 + 6 I) } ,
{ (18 - 6 I) , 62 , (84 - 3 I) } ,
{ (30 - 6 I) , (84 + 3 I) , 126 } } ,
{ { 13 , 18 , 33 } ,
{ 18 , 61 , 84 } ,
{ 33 , 84 , 126 } } ,
{ { 18 , 18 , 36 } ,
{ 18 , 61 , 84 } ,
{ 36 , 84 , 126 } } } ,
type = ListOfPoles ,
mu = 0 ,
name = Dc } ,
name = D ,
mu = 0 }
MD_n:
ResponseFunction in userdata format use ToTable() in order to get a table form
omega = 0.764
gamma = 0.1
MA_L(omega, gamma) =
{ { (-49.82074737235 - 16.750435144161 I) , (-39.242754250336 - 13.890672203015 I) , (-85.890426598686 - 30.827754261851 I) } ,
{ (-39.435420350993 - 20.687932234176 I) , (-132.74935751632 - 58.607579693628 I) , (-183.63057392827 - 82.382725361235 I) } ,
{ (-86.083092699343 - 37.625014293012 I) , (-183.53424087794 - 78.984095345655 I) , (-275.37361110465 - 121.02511553017 I) } }
MA_l(omega, gamma) =
{ { (-49.82074737235 - 16.750435144161 I) , (-39.242754250336 - 13.890672203015 I) , (-85.890426598686 - 30.827754261851 I) } ,
{ (-39.435420350993 - 20.687932234176 I) , (-132.74935751632 - 58.607579693628 I) , (-183.63057392827 - 82.382725361235 I) } ,
{ (-86.083092699343 - 37.625014293012 I) , (-183.53424087794 - 78.984095345655 I) , (-275.37361110465 - 121.02511553017 I) } }
MB_T(omega, gamma) =
{ { (0.99841211757801 - 0.4318886700871 I) , (-0.92217346376056 - 0.59364349550167 I) , (0.33618642304746 + 0.56252370645231 I) } ,
{ (-0.51999398150154 + 0.87279523667066 I) , (0.69431808205569 - 0.1748977600005 I) , (-0.34355189835894 - 0.03809026037919 I) } ,
{ (0.13982839704936 - 0.53101630282404 I) , (-0.25718128095213 + 0.17938506335344 I) , (0.080137084707226 - 0.049212538037938 I) } }
MB_t(omega, gamma) =
{ { (0.99841211757801 - 0.4318886700871 I) , (-0.92217346376056 - 0.59364349550167 I) , (0.33618642304746 + 0.56252370645231 I) } ,
{ (-0.51999398150154 + 0.87279523667066 I) , (0.69431808205569 - 0.1748977600005 I) , (-0.34355189835894 - 0.03809026037919 I) } ,
{ (0.13982839704936 - 0.53101630282404 I) , (-0.25718128095213 + 0.17938506335344 I) , (0.080137084707226 - 0.049212538037938 I) } }
MC_A(omega, gamma) =
{ { (0.0033404740201663 - 0.049014208032374 I) , (-0.0092579857609902 - 0.018133779674219 I) , (0.0041464743284782 + 0.021581712320061 I) } ,
{ (0.001131475130102 - 0.019625764066449 I) , (-0.006620607647268 - 0.0094591143626733 I) , (0.0044705980344151 + 0.010254424901895 I) } ,
{ (0.0018776712535675 + 0.024036826455971 I) , (0.0083397043445284 + 0.01003150710377 I) , (-0.0056913744700838 - 0.011590149052798 I) } }
MC_a(omega, gamma) =
{ { (0.0033404740201663 - 0.049014208032374 I) , (-0.0092579857609902 - 0.018133779674219 I) , (0.0041464743284782 + 0.021581712320061 I) } ,
{ (0.001131475130102 - 0.019625764066449 I) , (-0.006620607647268 - 0.0094591143626733 I) , (0.0044705980344151 + 0.010254424901895 I) } ,
{ (0.0018776712535675 + 0.024036826455971 I) , (0.0083397043445284 + 0.01003150710377 I) , (-0.0056913744700838 - 0.011590149052798 I) } }
MD_N(omega, gamma) =
{ { (-12.839446772164 - 21.169048830916 I) , (5.1855777994224 - 3.9320983625761 I) , (-10.184899840804 - 27.575394683943 I) } ,
{ (-3.5000860033155 - 57.291484603566 I) , (7.3025877301526 - 104.46376534286 I) , (1.7613982402315 - 156.19487348125 I) } ,
{ (-18.870563643542 - 80.934780924933 I) , (6.1042301416005 - 129.51518036075 I) , (5.8992212863723 - 214.2825403815 I) } }
MD_n(omega, gamma) =
{ { (-12.839446772164 - 21.169048830916 I) , (5.1855777994224 - 3.9320983625761 I) , (-10.184899840804 - 27.575394683943 I) } ,
{ (-3.5000860033155 - 57.291484603566 I) , (7.3025877301526 - 104.46376534286 I) , (1.7613982402315 - 156.19487348125 I) } ,
{ (-18.870563643542 - 80.934780924933 I) , (6.1042301416005 - 129.51518036075 I) , (5.8992212863723 - 214.2825403815 I) } }
===== Table of contents =====
{{indexmenu>.#2}}