Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| documentation:language_reference:functions:createspectra [2025/11/20 03:29] – external edit 127.0.0.1 | documentation:language_reference:functions:createspectra [2026/11/17 07:04] (current) – Maurits W. Haverkort | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ### | ### | ||
| - | CreateSpectra($O_1$, | + | CreateSpectra($O_1$, |
| \begin{equation} | \begin{equation} | ||
| \langle \psi | O_2^{\dagger} \frac{1}{(\omega + \mathrm{i} \Gamma/2 + E_0 - O_1)} O_2 | \psi \rangle, | \langle \psi | O_2^{\dagger} \frac{1}{(\omega + \mathrm{i} \Gamma/2 + E_0 - O_1)} O_2 | \psi \rangle, | ||
| \end{equation} | \end{equation} | ||
| with $E_0 = \langle \psi | O_1 | \psi \rangle$ and returns the result as a spectrum object and as a tri-diagonal matrix. $O_1$ and $O_2$ are allowed to be tables of operators or tables of wavefunctions. CreateSpectra can take a fourth element specifying options. | with $E_0 = \langle \psi | O_1 | \psi \rangle$ and returns the result as a spectrum object and as a tri-diagonal matrix. $O_1$ and $O_2$ are allowed to be tables of operators or tables of wavefunctions. CreateSpectra can take a fourth element specifying options. | ||
| + | ### | ||
| + | |||
| + | ### | ||
| + | CreateSpectra($O_1$, | ||
| ### | ### | ||
| Line 14: | Line 18: | ||
| * $O_2$ : Operator or a list of operators | * $O_2$ : Operator or a list of operators | ||
| * $\psi$ : Wavefunction or a list of Wavefunctions | * $\psi$ : Wavefunction or a list of Wavefunctions | ||
| + | * // | ||
| * Possible options are: | * Possible options are: | ||
| * " | * " | ||
| - | * " | + | * " |
| + | * " | ||
| * " | * " | ||
| * " | * " | ||
| * " | * " | ||
| * " | * " | ||
| - | * " | + | * " |
| * " | * " | ||
| * " | * " | ||
| + | * " | ||
| + | * " | ||
| + | * " | ||
| + | * " | ||
| + | * " | ||
| + | * " | ||
| + | * " | ||
| + | * " | ||
| + | |||
| + | ### | ||
| + | The two thresholds answer different questions. //epsilon// controls the wave-functions: | ||
| + | ### | ||
| + | |||
| + | ### | ||
| + | The orthonormalization of a block of wave-functions is built from the overlap matrix $S_{ij} = \langle \psi_i | \psi_j \rangle$, in which a singular value $s$ enters as $s^2$. A singular value below $3 \sqrt{\epsilon_{\mathrm{machine}}} \, s_{\mathrm{max}} \approx 4.5 \cdot 10^{-8} s_{\mathrm{max}}$ can therefore not be distinguished from the rounding error of $S$, and is removed whatever // | ||
| + | ### | ||
| ===== Output ===== | ===== Output ===== | ||
| - | * //G// : Spectrum object. In the case that both a list of operators $\{O_2^a, | + | * //S// : Spectrum object. In the case that both a list of operators $\{O_2^a, |
| - | * //T// : List representing | + | * //G// : Response function object. Response functions are lists that contain the pole energies and residues in one of the different formats. Create spectra outputs either |
| + | * With hybridisation functions two more results follow, //S0// and //G0//: the spectrum and the response function of $O_1$ without the baths, as CreateSpectra($O_1$, | ||
| + | * With " | ||
| + | |||
| + | ===== Hybridisation functions ===== | ||
| + | |||
| + | ### | ||
| + | A hybridisation function $\Delta_i(\omega) = A_0 + \sum_n W_n / (\omega - \epsilon_n)$ stands for a bath of free particles. Every residue is written as $W_n = L_n^{\dagger} L_n$, and every row $\mu$ of $L_n$ is a bath mode $b_{\mu}$ at energy $\epsilon_n$ that couples to the operators $V_{i,j}$ that follow $\Delta_i$ in the list: | ||
| + | \begin{equation} | ||
| + | H_{\mathrm{aux}} = O_1 + \sum_{i} \sum_{jj' | ||
| + | \end{equation} | ||
| + | CreateSpectra returns the spectrum of $H_{\mathrm{aux}}$ from $O_2 |\psi\rangle$, | ||
| + | ### | ||
| + | |||
| + | ### | ||
| + | The operators $V_{i,j}$ can be any operators on the orbitals of $O_1$. An annihilation operator couples to an empty band of fermions: the electron moves from the system into the bath. A filled band is given in the hole picture, with the energies of its hybridisation function inverted by [[documentation: | ||
| + | ### | ||
| + | |||
| + | ### | ||
| + | " | ||
| + | ### | ||
| + | |||
| + | ### | ||
| + | The states of $O_1$ that the baths reach are those of the Krylov space of $O_1$ with the operators $V$ applied to them. That is exact whenever the $V$ reach the whole sector the spectrum lives in, and keeps the first two moments right otherwise. | ||
| + | ### | ||
| + | |||
| + | ### | ||
| + | The hybridisation needs " | ||
| + | ### | ||
| + | |||
| + | ==== On an energy mesh ==== | ||
| + | |||
| + | ### | ||
| + | " | ||
| + | ### | ||
| + | |||
| + | ### | ||
| + | The residues are calculated from the imaginary part of the response function off the real axis; the page of [[documentation: | ||
| + | ### | ||
| ===== Example ===== | ===== Example ===== | ||
| ### | ### | ||
| - | description text | + | A $p$ electron with its spin and orbital moment down, in a magnetic field of 6 tesla along $z$. The transition operator is a field of 20 tesla along $x$, which turns the moment. The spectrum is calculated on a mesh of //" |
| ### | ### | ||
| ==== Input ==== | ==== Input ==== | ||
| <code Quanty CreateSpectra.Quanty> | <code Quanty CreateSpectra.Quanty> | ||
| - | dofile("../ | + | -- a p shell: 6 spin-orbitals, |
| + | NF = 6 | ||
| + | NB = 0 | ||
| + | IndexDn = {0, 2, 4} | ||
| + | IndexUp = {1, 3, 5} | ||
| + | OppSx = NewOperator("Sx", NF, IndexUp, IndexDn) | ||
| + | OppSz = NewOperator(" | ||
| + | OppLx = NewOperator(" | ||
| + | OppLz = NewOperator(" | ||
| -- define an Hamiltonian (in this case a magnetic field of 6 tesla in the z direction) | -- define an Hamiltonian (in this case a magnetic field of 6 tesla in the z direction) | ||
| H = 6 * EnergyUnits.Tesla.value * (2*OppSz + OppLz) | H = 6 * EnergyUnits.Tesla.value * (2*OppSz + OppLz) | ||
| Line 44: | Line 112: | ||
| T = 20 * EnergyUnits.Tesla.value * (2*OppSx + OppLx) | T = 20 * EnergyUnits.Tesla.value * (2*OppSx + OppLx) | ||
| -- define a ground-state (in this case a p electron with spin and angular momentum down) | -- define a ground-state (in this case a p electron with spin and angular momentum down) | ||
| - | psigrd = psim1dn | + | psigrd = NewWavefunction(NF, |
| -- calculate < psigrd | T^dag 1/ | -- calculate < psigrd | T^dag 1/ | ||
| Line 54: | Line 122: | ||
| print(spec) | print(spec) | ||
| - | -- the spectrum represented as a continued fraction | + | -- the response function: for a small space a list of poles (energies relative to E0, and |
| - | -- spectri contains {a,b,E0} | + | -- residues), otherwise |
| - | -- and the spectrum is a[1] + b[1]^2 / (w + E0 + i G/2 - a[2] - b[2]^2 / (w + E0 + i G/2 - a[3] - b[3]^2 / ... )) | + | |
| print(spectri) | print(spectri) | ||
| </ | </ | ||
| Line 63: | Line 130: | ||
| <file Quanty_Output CreateSpectra.out> | <file Quanty_Output CreateSpectra.out> | ||
| #Spectra: 1 | #Spectra: 1 | ||
| - | Emin______Emax | + | Emin______Emax |
| - | EminPole__EmaxPole | + | EminPole__EmaxPole |
| - | dE________Gamma | + | dE________Gamma |
| - | Energy | + | Energy |
| - | 3.038900445582E-04 -5.313499244491392E-03 -6.207216396406420E-03 | + | 3.038900444040E-04 -5.313499241794743E-03 -6.207216393256202E-03 |
| - | 3.255964763123E-04 -4.530120135703289E-03 -6.919966484421555E-03 | + | 3.255964761471E-04 -4.530120133404213E-03 -6.919966480909610E-03 |
| - | 3.473029080665E-04 -3.515600809214091E-03 -7.272899174061652E-03 | + | 3.473029078902E-04 -3.515600807429891E-03 -7.272899170370590E-03 |
| - | 3.690093398207E-04 -2.517203983251221E-03 -7.171656631527070E-03 | + | 3.690093396334E-04 -2.517203981973720E-03 -7.171656627887393E-03 |
| - | 3.907157715748E-04 -1.782244773628827E-03 -6.719544484357337E-03 | + | 3.907157713765E-04 -1.782244772724323E-03 -6.719544480947109E-03 |
| - | 4.124222033290E-04 -1.413455673284595E-03 -6.131215006631856E-03 | + | 4.124222031197E-04 -1.413455672567255E-03 -6.131215003520210E-03 |
| - | 4.341286350831E-04 -1.372258888529464E-03 -5.591509432157396E-03 | + | 4.341286348628E-04 -1.372258887833031E-03 -5.591509429319654E-03 |
| - | 4.558350668373E-04 -1.564713253998241E-03 -5.201614330859017E-03 | + | 4.558350666059E-04 -1.564713253204134E-03 -5.201614328219152E-03 |
| - | 4.775414985914E-04 -1.902890978987316E-03 -5.000149700104968E-03 | + | 4.775414983491E-04 -1.902890978021582E-03 -5.000149697567347E-03 |
| - | 4.992479303456E-04 -2.322043353835751E-03 -4.998296710798989E-03 | + | 4.992479300922E-04 -2.322043352657292E-03 -4.998296708262308E-03 |
| - | 5.209543620998E-04 -2.774954571317865E-03 -5.203039821220997E-03 | + | 5.209543618354E-04 -2.774954569909549E-03 -5.203039818580406E-03 |
| - | 5.426607938539E-04 -3.219375361758718E-03 -5.628003383025635E-03 | + | 5.426607935785E-04 -3.219375360124855E-03 -5.628003380169370E-03 |
| - | 5.643672256081E-04 -3.603346747444065E-03 -6.295735047500588E-03 | + | 5.643672253216E-04 -3.603346745615335E-03 -6.295735044305445E-03 |
| - | 5.860736573622E-04 -3.848348813887564E-03 -7.231512606316196E-03 | + | 5.860736570648E-04 -3.848348811934494E-03 -7.231512602646139E-03 |
| - | 6.077800891164E-04 -3.831631961478373E-03 -8.442956473257584E-03 | + | 6.077800888079E-04 -3.831631959533789E-03 -8.442956468972709E-03 |
| - | 6.294865208705E-04 -3.379188728845951E-03 -9.875468445796350E-03 | + | 6.294865205511E-04 -3.379188727130987E-03 -9.875468440784456E-03 |
| - | 6.511929526247E-04 -2.302467572417779E-03 -1.134374714025916E-02 | + | 6.511929522942E-04 -2.302467571249260E-03 -1.134374713450211E-02 |
| - | 6.728993843788E-04 -5.224385625615705E-04 -1.249103108669947E-02 | + | 6.728993840373E-04 -5.224385622964269E-04 -1.249103108036016E-02 |
| - | 6.946058161330E-04 1.757800404607050E-03 -1.289786046880420E-02 | + | 6.946058157805E-04 1.757800403714946E-03 -1.289786046225842E-02 |
| - | 7.163122478872E-04 4.046100622038835E-03 -1.236518601314671E-02 | + | 7.163122475236E-04 4.046100619985394E-03 -1.236518600687127E-02 |
| - | 7.380186796413E-04 5.850339581477893E-03 -1.108758309628370E-02 | + | 7.380186792668E-04 5.850339578508793E-03 -1.108758309065665E-02 |
| - | { { { 0 , -0.00081037345215517 | + | { { { 0 , 0.00034730290789024 |
| - | { 0.0014178581849128 | + | { 6.7010727682788e-07 |
| - | | + | |
| - | | + | |
| - | | + | |
| </ | </ | ||
| + | |||
| + | ===== Example with a hybridisation function ===== | ||
| + | |||
| + | ### | ||
| + | One orbital with spin and a Hubbard $U$, holding one electron, hybridises with an empty band that is given as a hybridisation function of three poles per spin. The electron addition spectrum is calculated with the hybridisation function by Lanczos, with the hybridisation function on an energy mesh, and with the band written out as six more orbitals, restricted to at most one electron, which is the space the hybridisation function stands for at " | ||
| + | ### | ||
| + | |||
| + | ==== Input ==== | ||
| + | <code Quanty CreateSpectraHybridisation.Quanty> | ||
| + | ed, U = -0.5, 2.0 | ||
| + | ek = { 0.6, 1.0, 1.4} -- energies of the bath poles | ||
| + | Vk = { 0.2, 0.3, 0.2} -- hybridisation strength of each pole | ||
| + | |||
| + | -- the orbital alone, mode 0 spin down and mode 1 spin up | ||
| + | NF = 2 | ||
| + | Hsys = ed * (NewOperator(NF, | ||
| + | + U * NewOperator(NF, | ||
| + | psi = NewWavefunction(NF, | ||
| + | Cr = {NewOperator(NF, | ||
| + | |||
| + | -- Delta(w) = sum_k Vk^2 / (w - ek), the same for both spins, coupled through the | ||
| + | -- annihilation operators: an electron of the orbital moves into the empty band | ||
| + | W = {} | ||
| + | for k = 1, 3 do W[k] = Matrix.New({{Vk[k]^2, | ||
| + | Delta = ResponseFunction.New({{Matrix.Zero(2), | ||
| + | Hybridisation = {{Delta, {NewOperator(NF, | ||
| + | |||
| + | Opt = {{" | ||
| + | S, G = CreateSpectra(Hsys, | ||
| + | OptM = {{" | ||
| + | SM, GM = CreateSpectra(Hsys, | ||
| + | |||
| + | -- the same with the band as modes 2 .. 7 (2k spin down, 2k+1 spin up), empty to start | ||
| + | -- with and restricted to at most one electron | ||
| + | NFb = 8 | ||
| + | Hb = ed * (NewOperator(NFb, | ||
| + | + U * NewOperator(NFb, | ||
| + | for k = 1, 3 do | ||
| + | for s = 0, 1 do | ||
| + | local b = 2*k + s | ||
| + | Hb = Hb + ek[k] * NewOperator(NFb, | ||
| + | + Vk[k] * (NewOperator(NFb, | ||
| + | end | ||
| + | end | ||
| + | psib = NewWavefunction(NFb, | ||
| + | Crb = {NewOperator(NFb, | ||
| + | Sb, Gb = CreateSpectra(Hb, | ||
| + | | ||
| + | |||
| + | print(" | ||
| + | for w = 0, 4, 0.5 do | ||
| + | print(string.format(" | ||
| + | -Complex.Im(Gb(w, | ||
| + | end | ||
| + | </ | ||
| + | |||
| + | ==== Result ==== | ||
| + | < | ||
| + | omega explicit bath hybridisation | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | |||
| + | ### | ||
| + | Without the band the spectrum would be a single line at $\epsilon_d + U = 1.5$; the band pushes it into the two peaks near $0.5$ and $2$ and spreads a little weight in between. The hybridisation function gives the spectrum of the explicit band exactly. The mesh differs from both by the splitting of the poles over the mesh of spacing $0.01$, seen here at a broadening of $0.1$ and largest on the sharp peaks. The calculation prints some lines of progress output, left out here. | ||
| + | ### | ||
| ===== Table of contents ===== | ===== Table of contents ===== | ||
| {{indexmenu> | {{indexmenu> | ||
| + | |||
| + | |||
| + | |||