Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
documentation:language_reference:functions:createspectra [2026/11/12 17:45] – Maurits W. Haverkortdocumentation:language_reference:functions:createspectra [2026/11/17 07:04] (current) – Maurits W. Haverkort
Line 93: Line 93:
  
 ### ###
-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 //"NE"// $+ 1 = 21$ energies; the second output is the response function, here a list of poles as the space is small.
 ### ###
  
 ==== Input ==== ==== Input ====
 <code Quanty CreateSpectra.Quanty> <code Quanty CreateSpectra.Quanty>
-dofile("../definitions.Quanty")+-- a p shell: 6 spin-orbitals, spin down on the even indices, spin up on the odd ones 
 +NF = 6 
 +NB = 0 
 +IndexDn = {0, 2, 4} 
 +IndexUp = {1, 3, 5} 
 +OppSx = NewOperator("Sx", NF, IndexUp, IndexDn) 
 +OppSz = NewOperator("Sz", NF, IndexUp, IndexDn) 
 +OppLx = NewOperator("Lx", NF, IndexUp, IndexDn) 
 +OppLz = NewOperator("Lz", NF, IndexUp, IndexDn)
 -- 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 104: 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, NB, {{"100000", 1}})
  
 -- calculate < psigrd | T^dag 1/(w-H+i*G/2+E0) T | psigrd > -- calculate < psigrd | T^dag 1/(w-H+i*G/2+E0) T | psigrd >
Line 114: 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 a tri-diagonal matrix (a continued fraction)
--- 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)
 </code> </code>
Line 123: Line 130:
 <file Quanty_Output CreateSpectra.out> <file Quanty_Output CreateSpectra.out>
 #Spectra: 1 #Spectra: 1
-Emin______Emax       3.038900445581886E-04  7.380186796413151E-04 +Emin______Emax       3.038900444039618E-04  7.380186792667644E-04 
-EminPole__EmaxPole   3.473029080665012E-04  6.946058161330025E-04 +EminPole__EmaxPole   3.473029078902421E-04  6.946058157804841E-04 
-dE________Gamma      2.170643175415633E-05  2.170643175415633E-04+dE________Gamma      2.170643174314013E-05  2.170643174314013E-04
 Energy               Re[0]                  Im[0] Energy               Re[0]                  Im[0]
- 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.00092614108817734 } , +{ { { 0 , 0.00034730290789024 , 0.00069460581578048 } , 
-  { 0.0014178581849128 , 0.00016372016094642 } , +  { 6.7010727682788e-07 , 1.3402145536558e-06 } , 
-  mu = 0 , +  name = List of Poles , 
-  name = Matrix , +  type = ListOfPoles , 
-  type = Tri } }+  mu = 0 } }
 </file> </file>
  
Line 231: Line 238:
 ===== Table of contents ===== ===== Table of contents =====
 {{indexmenu>.#1}} {{indexmenu>.#1}}
- 
  
  
  
Print/export