Eötvös Quantum Utilities  v4.8.141
Providing the Horsepowers in the Quantum Realm
Lead.m
Go to the documentation of this file.
1 %% Eotvos Quantum Transport Utilities - Lead
2 % Copyright (C) 2009-2016 Peter Rakyta, Ph.D.
3 %
4 % This program is free software: you can redistribute it and/or modify
5 % it under the terms of the GNU General Public License as published by
6 % the Free Software Foundation, either version 3 of the License, or
7 % (at your option) any later version.
8 %
9 % This program is distributed in the hope that it will be useful,
10 % but WITHOUT ANY WARRANTY; without even the implied warranty of
11 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 % GNU General Public License for more details.
13 %
14 % You should have received a copy of the GNU General Public License
15 % along with this program. If not, see http://www.gnu.org/licenses/.
16 %
17 %> @addtogroup basic Basic Functionalities
18 %> @{
19 %> @file Lead.m
20 %> @brief A class to calculate the Green functions and self energies of a translational invariant lead
21 %> @}
22 %> @brief A class to calculate the Green functions and self energies of a translational invariant lead
23 %> The notations and the structure of the Hamiltonian is defined accroding to the following image:
24 %> @image html Lead_Hamiltonian.jpg
25 %> @image latex Lead_Hamiltonian.jpg
26 %> @Available
27 %> EQuUs v4.8 or later
28 %%
30 
31 
32 properties ( Access = protected )
33  %>function handle to calculate the self energy
34  SelfEnergyCalc
35  %>Function handle to calculate the retarded infinite Greens function.
36  GinfCalc
37  %>The normalization matrix in the Greens function.
38  Normamtx
39  %>The inverse of the normalization matrix.
40  invNormamtx
41  %>The matrix of the surface Greens function of the semi-infinite ribbon.
42  gsurf
43  %>The inverse of the retarded surface Greens function.
44  gsurfinv
45  %>The matrix of the retarded Greens function of the infinite ribbon.
46  ginf
47  %>The matrix of the retarded surface Greens function of a finite ribbon.
48  gfin
49  %>The inverse of the retarded surface Greens function of a finite ribbon.
50  gfininv
51  %>The retarded self-energy of the semi-infinite ribbon.
52  Sigma
53 end
54 
55 
56 
57 
58 
59 methods ( Access = public )
60 %% Lead
61 %> @brief Constructor of the class.
62 %> @param Opt An instance of the structure #Opt.
63 %> @param param An instance of structure #param.
64 %> @param varargin Cell array of optional parameters. For details see #EigenProblemLead.EigenProblemLead.
65 %> @return An instance of the class
66  function obj = Lead(Opt, param, varargin)
67  obj = obj@EigenProblemLead( Opt, param, varargin{:} );
68  end
69 
70 %% InfGreenFunction
71 %> @brief Calculates the Green function of the infinite lead for eregy #E between slabs z1 and z2. The calculated Greens function is stored by attribute #ginf.
72 %> @param z1 The index of the first slab.
73 %> @param z2 The index of the second slab.
74 %> @param varargin Optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
75 %> @param 'z1points' Array of sites in the slab z1 to include in the calculations. By default each site in the given slab is included.
76 %> @param 'z2points' Array of sites in the slab z2 to include in the calculations. By default each site in the given slab is included.
77 %> @return Return with the Green function of the infinite lead between the given slabs.
78  function ret = InfGreenFunction(obj, z1,z2, varargin)
79  obj.szetvalaszto();
80 
81  p = inputParser;
82  if z1 >= z2
83  p.addParameter('z1points', 1:size(obj.modusmtx_p,1));
84  p.addParameter('z2points', 1:size(obj.modusmtx_p,2));
85  else
86  p.addParameter('z1points', 1:size(obj.modusmtx_m,1));
87  p.addParameter('z2points', 1:size(obj.modusmtx_m,2));
88  end
89  p.parse(varargin{:});
90 
91  z1points = p.Results.z1points;
92  z2points = p.Results.z2points;
93 
94  obj.ginf = obj.GinfCalc(z1, z2, z1points, z2points);
95  ret = obj.ginf;
96 
97 % d_modusmtx_m = [];
98 % d_modusmtx_p = [];
99  end
100 
101 end
102 
103 methods ( Access = protected )
104 %% GinfCalcWithDualModes
105 %> @brief Calculates the Green function of the infinite ribbon with dual modes. The calculated Greens function is stored by attribute #ginf.
106 %> @param z1 The index of the first slab.
107 %> @param z2 The index of the second slab.
108 %> @param z1points Site indexes in the slab at z1.
109 %> @param z2points Site indexes in the slab at z2.
110 %> @return Return with the Greens function of the infinite lead between the given slabs.
111  function ginf = GinfCalcWithDualModes(obj, z1, z2, z1points, z2points)
112  obj.NormamtxSzamolo();
113  obj.ginf = 0;
114 
115  if z1 >= z2
116  ginf = obj.modusmtx_p(z1points,:)*diag(obj.expk_p.^(obj.Lead_Orientation*(z1-z2)))*obj.d_modusmtx_p;
117  else
118 % for idx = 1:M
119 % xi_m = modusmtx_m(z1points,idx);
120 % d_xi_m = d_modusmtx_m(idx,:);
121 % ginf = ginf + xi_m*d_xi_m*exp(1i*k_m(idx)*Lead_Orientation*(z1-z2));
122 % end
123  ginf = obj.modusmtx_m(z1points,:)*diag(obj.expk_m.^(obj.Lead_Orientation*(z1-z2)))*obj.d_modusmtx_m;
124  end
125 
126  ginf = ginf*obj.invNormamtx(:,z2points);
127  end
128  %--------------------------------------------------------------------------
129 
130 %% GinfCalcWithLeftModes
131 %> @brief Calculates the Green function of the infinite ribbon with with the left-sided modes. The calculated Greens function is stored by attribute #ginf.
132 %> @param z1 The index of the first slab.
133 %> @param z2 The index of the second slab.
134 %> @param z1points Site indexes in the slab at z1.
135 %> @param z2points Site indexes in the slab at z2.
136 %> @return Return with the Greens function of the infinite lead between the given slabs.
137  function ginf = GinfCalcWithLeftModes(obj, z1, z2, z1points, z2points)
138 
139  if z1 >= z2
140  ginf = obj.modusmtx_p(z1points,:)*diag(obj.expk_p.^(obj.Lead_Orientation*(z1-z2))./(1i*obj.vcsop_p*obj.Lead_Orientation))*obj.modusmtx_p_left(:,z2points);
141  else
142  ginf = obj.modusmtx_m(z1points,:)*diag(obj.expk_m.^(obj.Lead_Orientation*(z1-z2))./(-1i*obj.vcsop_m*obj.Lead_Orientation))*obj.modusmtx_m_left(:,z2points);
143  end
144 
145  end
146  %--------------------------------------------------------------------------
147 
148 end
149 
150 
151 methods ( Access = public )
152 
153 %% Gamma
154 %> @brief Calculates the effective coupling of the lead to the scattering region according to Eq (3) in Eur. Phys. J. B 53, 537-549 (2006)
155 %> @return Return with the matrix of the effective coupling.
156  function ret = Gamma( obj )
157  if isempty( obj.Sigma )
158  obj.SelfEnergy();
159  end
160 
161  ret = 1i*( obj.Sigma - (obj.Sigma)' );
162 
163 
164  end
165 %% SelfEnergy
166 %> @brief Calculates the retarded self energy of the semi-infinite lead according to Eq (36) of Ref PRB 78, 035407 (2008). The calculated self energy is stored by attribure #Sigma.
167 %> @return Returns with the calculated self energy.
168  function ret = SelfEnergy( obj )
169  obj.szetvalaszto();
170 
171  obj.Sigma = obj.SelfEnergyCalc();
172  ret = obj.Sigma;
173 
174  end
175 
176 
177 end
178 
179 
180 methods ( Access = protected )
181 
182 %% SelfEnergyCalcWithDualModes
183 %> @brief Calculates the self energy with dual modes according to Eqs (17) and (36) in PRB 78 035407
184 %> @return Return with the self energy.
185  function Sigma = SelfEnergyCalcWithDualModes( obj )
186  %>Eq (17) and (36) in PRB 78 035407
187  %>g00 = inv(Normamtx)
188  obj.NormamtxSzamolo();
189  [~, K1_eff, K1adj_eff] = obj.Get_Effective_Hamiltonians();
190  Sigma = obj.modusmtx_m*diag(obj.expk_m.^(-obj.Lead_Orientation))*obj.d_modusmtx_m;
191  if obj.Lead_Orientation == 1
192  Sigma = K1adj_eff*Sigma;
193  else
194  Sigma = K1_eff*Sigma;
195  end
196  end
197  %--------------------------------------------------------------------------
198 
199 %% SelfEnergyCalcWithLeftModes
200 %> @brief Calculates the self energy with the left-sided modes according to Eqs (20), (17) and (36) in PRB 78 035407
201 %> @return Return with the self energy.
202  function Sigma = SelfEnergyCalcWithLeftModes( obj )
203  %>Eq (20), (17) and (36) in PRB 78 035407
204  %>g00 = inv(Normamtx)
205  obj.NormamtxSzamolo();
206  [~, K1_eff, K1adj_eff] = obj.Get_Effective_Hamiltonians();
207  Sigma = obj.modusmtx_m*diag(obj.expk_m.^(-obj.Lead_Orientation)./(-1i*obj.vcsop_m*obj.Lead_Orientation))*obj.modusmtx_m_left;
208  if obj.Lead_Orientation == 1
209  Sigma = K1adj_eff*Sigma*obj.Normamtx;
210  else
211  Sigma = K1_eff*Sigma*obj.Normamtx;
212  end
213  end
214  %--------------------------------------------------------------------------
215 
216 end
217 
218 methods ( Access = public )
219 
220 %% FiniteGreenFunction
221 %> @brief Calculates the Green function of a finite piece of the lead for eregy #E between slabs z1 and z2. The calculated Greens function is stored by attribute #gfin.
222 %> @param z1 The index of the first slab.
223 %> @param z2 The index of the second slab.
224 %> @param varargin Optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
225 %> @param 'onlygfininv' If true, only the inverse of the Green function is calculated. (Default value is false)
226 %> @return Return with the Green function of the infinite lead between the given slabs.
227  function ret = FiniteGreenFunction(obj, z1,z2, varargin)
228 
229  p = inputParser;
230  p.addParameter('onlygfininv', false );
231 
232  p.parse(varargin{:});
233  onlygfininv = p.Results.onlygfininv;
234 
235  obj.szetvalaszto();
236  obj.NormamtxSzamolo();
237 
238  Neff = obj.Get_Neff();
239  obj.gfin = zeros(4*Neff,4*Neff);
240 
241  if z1 >= z2
242  points = 1:size(obj.modusmtx_p,1);
243  dpoints = 1:size(obj.modusmtx_p,1);
244  else
245  points = 1:size(obj.modusmtx_m,1);
246  dpoints = 1:size(obj.modusmtx_m,1);
247  end
248 
249  gtmp = obj.GinfCalc(z1-1, z1-1, points, dpoints);
250  obj.gfin(1:Neff,1:Neff) = gtmp;
251  obj.gfin(1+Neff:2*Neff, 1+Neff:2*Neff) = gtmp;
252  obj.gfin(1+2*Neff:3*Neff, 1+2*Neff:3*Neff) = gtmp;
253  obj.gfin(1+3*Neff:4*Neff, 1+3*Neff:4*Neff) = gtmp;
254 
255  gtmp = obj.GinfCalc(z1-1, z1, points, dpoints);
256  obj.gfin(1:Neff,1+Neff:2*Neff) = gtmp;
257  obj.gfin(1+2*Neff:3*Neff,1+3*Neff:4*Neff) = gtmp;
258 
259  gtmp = obj.GinfCalc(z1, z1-1, points, dpoints);
260  obj.gfin(1+Neff:2*Neff,1:Neff) = gtmp;
261  obj.gfin(1+3*Neff:4*Neff, 1+2*Neff:3*Neff) = gtmp;
262 
263  gtmp = obj.GinfCalc(z1-1, z2, points, dpoints);
264  obj.gfin(1:Neff,1+2*Neff:3*Neff) = gtmp;
265 
266  gtmp = obj.GinfCalc(z2, z1-1, points, dpoints);
267  obj.gfin(1+2*Neff:3*Neff,1:Neff) = gtmp;
268 
269  gtmp = obj.GinfCalc(z1-1, z2+1, points, dpoints);
270  obj.gfin(1:Neff,1+3*Neff:4*Neff) = gtmp;
271 
272  gtmp = obj.GinfCalc(z2+1, z1-1, points, dpoints);
273  obj.gfin(1+3*Neff:4*Neff,1:Neff) = gtmp;
274 
275  gtmp = obj.GinfCalc(z1, z2, points, dpoints);
276  obj.gfin(1+Neff:2*Neff,1+2*Neff:3*Neff) = gtmp;
277 
278  gtmp = obj.GinfCalc(z2, z1, points, dpoints);
279  obj.gfin(1+2*Neff:3*Neff,1+Neff:2*Neff) = gtmp;
280 
281  gtmp = obj.GinfCalc(z1, z2+1, points, dpoints);
282  obj.gfin(1+Neff:2*Neff,1+3*Neff:4*Neff) = gtmp;
283 
284  gtmp = obj.GinfCalc(z2+1, z1, points, dpoints);
285  obj.gfin(1+3*Neff:4*Neff,1+Neff:2*Neff) = gtmp;
286 
287  rcond_gfin = rcond(obj.gfin);
288  if isnan(rcond_gfin) || abs( rcond_gfin ) < 1e-15
289  obj.display( 'EQuUs:Lead:FiniteGreenFunction: Regularizing gfin by SVD',1);
290  obj.gfininv = obj.inv_SVD( obj.gfin );
291  else
292  obj.gfininv = inv(obj.gfin);
293  end
294  obj.gfininv = obj.gfininv( 1+Neff:3*Neff, 1+Neff:3*Neff );
295 
296  if onlygfininv
297  ret = [];
298  else
299  rcond_gfinin = rcond(obj.gfininv);
300  if isnan(rcond_gfinin ) || abs( rcond_gfinin ) < 1e-15
301  obj.display( 'EQuUs:Lead:FiniteGreenFunction: Regularizing gfininv by SVD',1);
302  obj.gfin = obj.inv_SVD( obj.gfininv );
303  else
304  obj.gfin = inv(obj.gfininv);
305  end
306  obj.gfininv = [];
307  ret = obj.gfin;
308  end
309 
310  end
311 
312 %% SurfaceGreenFunction
313 %> @brief Calculates the surface Green function of a semi-infinite lead for eregy #E. The calculated Green function is stored in attribute #gsurf.
314 %> @param varargin Optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
315 %> @param 'OnlyInverse' If true (default), only the inverse of the Green function is calculated.
316 %> @param 'CalcInverse' If true (default), the inverse of the Green function is also calculated.
317  function SurfaceGreenFunction( obj, varargin )
318 
319  p = inputParser;
320  p.addParameter('OnlyInverse', true );
321  p.addParameter('CalcInverse', true );
322  p.parse(varargin{:});
323  OnlyInverse = p.Results.OnlyInverse;
324  CalcInverse = p.Results.CalcInverse;
325 
326  obj.szetvalaszto();
327  obj.NormamtxSzamolo();
328  if obj.Opt.usingDualModes
329  obj.GsurfSzamoloWithDualModes();
330  else
331  obj.GsurfSzamoloWithLeftModes();
332  end
333 
334  if ~CalcInverse
335  return
336  end
337 
338  rcond_gsurf = rcond(obj.gsurf);
339  if isnan(rcond_gsurf) || abs( rcond_gsurf ) < 1e-15
340  obj.display( ['EQuUs:', class(obj), ':SurfaceGreenFunction: Regularizing gsurf by SVD'],1);
341  obj.gsurfinv = obj.inv_SVD( obj.gsurf );
342  else
343  obj.gsurfinv = inv(obj.gsurf);
344  end
345 
346  if OnlyInverse
347  obj.gsurf = [];
348  end
349 
350  end
351 
352 end
353 
354 methods ( Access = protected )
355 
356 %> @brief Calculates the surface Green function with dual modes. The calculated Green function is stored by attribute #gsurf.
357  function GsurfSzamoloWithDualModes( obj )
358 
359  %test for the self energy
360 % obj.SelfEnergy();
361 % [K0_eff] = obj.Get_Effective_Hamiltonians();
362 % gsurf2 = -inv(K0_eff + obj.Sigma);
363 %
364 
365  gsurf_m = obj.modusmtx_m*diag(obj.expk_m.^(-obj.Lead_Orientation))*obj.d_modusmtx_m;
366  gsurf_p = obj.modusmtx_p*diag(obj.expk_p.^(obj.Lead_Orientation))*obj.d_modusmtx_p;
367 
368 
369  %gsurf = (eye(M) - gsurf_p*gsurf_m)*inv(Normamtx);
370  obj.gsurf = (eye(obj.Get_Neff()) - gsurf_m*gsurf_p)*obj.invNormamtx;
371 
372  end
373  %--------------------------------------------------------------------------
374 
375 
376 %> @brief Calculates the surface Green function with the left-sided modes according to Eq (33) in PRB 78, 035407 (2008). The calculated Green function is stored by attribute #gsurf.
377  function GsurfSzamoloWithLeftModes( obj )
378  Neff = obj.Get_Neff();
379  points = 1:Neff;
380  dpoints = 1:Neff;
381 
382  %>right SGF Eq (33) in PRB 78, 035407 (2008)
383  %>g00 = inv(Normamtx)
384 % g01 = GinfCalc(0, 1, points, dpoints);
385 % g10 = GinfCalc(1, 0, points, dpoints);
386 % gsurfR = invNormamtx - g10*Normamtx*g01;
387 
388  %>left SGF Eq (33) in PRB 78, 035407 (2008)
389  %>g00 = inv(Normamtx)
390  g0m1 = obj.GinfCalc(0, -1, points, dpoints);
391  gm10 = obj.GinfCalc(-1, 0, points, dpoints);
392  obj.gsurf = obj.invNormamtx - gm10*obj.Normamtx*g0m1;
393 
394 
395  end
396  %--------------------------------------------------------------------------
397 
398 end
399 
400 methods ( Access = public )
401 
402 %% NormamtxSzamolo
403 %> @brief The normalization matrix to calculate the Green function. The calculated normalization matrix is stored by attribute #Normamtx.
404  function NormamtxSzamolo( obj )
405 
406  if ~isempty(obj.Normamtx) && ~isempty(obj.invNormamtx)
407  return
408  elseif obj.Opt.usingDualModes
409  obj.NormamtxSzamoloWithDualModes();
410  else
411  obj.NormamtxSzamoloWithLeftModes();
412  end
413  end
414 
415 end
416 
417 
418 methods ( Access = protected )
419 %% NormamtxSzamoloWithDualModes
420 %> @brief Calculates the normalization matrix to calculate the Green function using the dual modes. The calculated normalization matrix is stored by attribute #Normamtx.
421  function NormamtxSzamoloWithDualModes(obj)
422 
423  obj.calcDualModes();
424  obj.Normamtx = 0;
425  obj.invNormamtx = 0;
426 
427 
428  obj.Normamtx = (obj.modusmtx_p*diag(obj.expk_p.^(-1))*obj.d_modusmtx_p - ...
429  obj.modusmtx_m*diag(obj.expk_m.^(-1))*obj.d_modusmtx_m)*obj.Lead_Orientation;
430 
431  [~, ~, K1adj_eff] = obj.Get_Effective_Hamiltonians();
432  obj.Normamtx = K1adj_eff*obj.Normamtx;
433 
434  try
435  rcond_Normamtx = rcond(obj.Normamtx);
436  if isnan(rcond_Normamtx) || abs( rcond_Normamtx ) < 1e-15
437  obj.display( 'EQuUs:Lead:NormamtxSzamoloWithDualModes: Regularizing Normamtx by SVD',1);
438  obj.invNormamtx = obj.inv_SVD( obj.Normamtx );
439  else
440  obj.invNormamtx = obj.Normamtx\(eye(size(obj.Normamtx)));%inv(Normamtx);
441  end
442  catch errCause
443  err = MException('EQuUs:Lead:NormamtxSzamoloWithDualModes', 'The inversion of the Normamtx failed');
444  err = addCause(err, errCause);
445  save('Error_Lead_NormamtxSzamoloWithDualModes.mat');
446  throw(err);
447  end
448  end
449  %---------------------------------------------------------------
450 %% NormamtxSzamoloWithLeftModes
451 %> @brief Calculates the normalization matrix to calculate the Green function using the left-sided modes. The calculated normalization matrix is stored by attribute #Normamtx.
452  function NormamtxSzamoloWithLeftModes(obj)
453 
454  obj.invNormamtx = obj.InfGreenFunction(0,0);
455  rcond_invNormamtx = rcond(obj.invNormamtx);
456  if isnan(rcond_invNormamtx) || abs( rcond_invNormamtx ) < 1e-15
457  obj.display( 'EQuUs:Lead:NormamtxSzamoloWithLeftModes: Regularizing invNormamtx by SVD',1);
458  obj.Normamtx = obj.inv_SVD( obj.invNormamtx );
459  else
460  obj.Normamtx = obj.invNormamtx\(eye(size(obj.invNormamtx)));
461  end
462 
463 
464  end
465 
466 %% calcDualModes
467 %> @brief Calculates the dual modes. The dual modes is stored by attributes #d_modusmtx_m and #d_modusmtx_p.
468  function calcDualModes( obj )
469  if isempty(obj.d_modusmtx_m)
470  obj.display('EQuUs:Lead:calcDualModes: Calculating dual modes for m')
471  if obj.Opt.usingDualModes
472  obj.d_modusmtx_m = obj.CalcDualModesEigenvec( obj.modusmtx_m ); %a dualis modusok
473  else
474  obj.d_modusmtx_m = obj.CalcDualModesEigenvecWithLeftModes( obj.modusmtx_m_left, -obj.vcsop_m*obj.Lead_Orientation ); %a dualis modusok
475  end
476  end
477 
478  if isempty(obj.d_modusmtx_p)
479  obj.display('EQuUs:Lead:calcDualModes: Calculating dual modes for p')
480  if obj.Opt.usingDualModes
481  obj.d_modusmtx_p = obj.CalcDualModesEigenvec( obj.modusmtx_p ); %a dualis modusok
482  else
483  obj.d_modusmtx_p = obj.CalcDualModesEigenvecWithLeftModes( obj.modusmtx_p_left, obj.vcsop_p*obj.Lead_Orientation ); %a dualis modusok
484  end
485  end
486 
487 % obj.display('modusmtx inverse',1);
488 % obj.display(num2str(norm( obj.d_modusmtx_m*obj.modusmtx_m - eye(obj.Get_Neff()) )), 1);
489 % obj.display(num2str(norm( obj.d_modusmtx_p*obj.modusmtx_p - eye(obj.Get_Neff()) )), 1);
490  end
491 
492 
493 %% CalcDualModesEigenvec
494 %> @brief Calculates the dual modes by inverting the right-sided eigenvectors.
495 %> @param modusmtx The right-sided eigenvectors.
496 %> @return Returns with the calculated dual modes.
497  function d_modes = CalcDualModesEigenvec( obj, modusmtx )
498  try
499  rcond_modusmtx = rcond(modusmtx);
500  if isnan(rcond_modusmtx ) || abs( rcond_modusmtx ) < 1e-15
501  obj.display( 'EQuUs:Lead:CalcDualModesEigenvec: Regularizing modusmtx by SVD',1);
502  d_modes = obj.inv_SVD( modusmtx );
503  else
504  d_modes = (modusmtx)\eye(size(modusmtx)); % a dualis modusok
505  end
506 
507  catch errCause
508  err = MException('EQuUs::Lead::CalcDualModesEigenvec', 'The calculation of the dual wavefunctions failed.');
509  err = addCause(err, errCause);
510  save('Error_Lead_CalcDualModesEigenvec.mat');
511  throw(err);
512  end
513 
514  end
515 
516 %% CalcDualModesEigenvecWithLeftModes
517 %> @brief Calculates the dual modes using the left-sided eigenvectors.
518 %> @param modusmtx_left The left-sided eigenvectors.
519 %> @param vcsop The group velocities.
520 %> @return Returns with the calculated dual modes
521  function d_modes = CalcDualModesEigenvecWithLeftModes( obj, modusmtx_left, vcsop )
522  %>Eq (20) in PRB 78, 035407 (2008)
523  d_modes = diag(1./(1i*vcsop))*modusmtx_left*obj.Normamtx;
524  end
525 
526 
527 %% Initialize
528 %> @brief Initializes class attributes.
529  function Initialize(obj)
530 
531  Initialize@EigenProblemLead(obj);
532 
533  if obj.Opt.usingDualModes
534  obj.display( 'EQuUs:Lead:Initialize: Using dual modes in the calculations.');
535  obj.GinfCalc = @(z1, z2, z1points, z2points)(obj.GinfCalcWithDualModes(z1, z2, z1points, z2points));
536  obj.SelfEnergyCalc = @()(obj.SelfEnergyCalcWithDualModes);
537  else
538  obj.display( 'EQuUs:Lead:Initialize: Using left-sided modes in the calculations.');
539  obj.GinfCalc = @(z1, z2, z1points, z2points)(obj.GinfCalcWithLeftModes(z1, z2, z1points, z2points));
540  obj.SelfEnergyCalc = @()(obj.SelfEnergyCalcWithLeftModes);
541  end
542  end
543 
544 end
545 
546 methods ( Access = public )
547 
548 %% TrukkosSajatertekek
549 %> @brief Calculates the wave numbers corresponding to the propagating states at given energy. The calculated wave numbers are stored in attribute #expk. The normalization matrix is set to empty.
550 %> @param E The energy value used in the calculations.
551  function TrukkosSajatertekek(obj, E)
552  TrukkosSajatertekek@EigenProblemLead(obj, E);
553  obj.Normamtx = [];
554  obj.invNormamtx = [];
555  end
556 
557 %% ShiftLead
558 %> @brief Shifts the on-site energies in the leads by a given energy. The normalization matrix is set to empty.
559 %> @param Energy The enrgy value.
560  function ShiftLead( obj, Energy )
561  ShiftLead@EigenProblemLead( obj, Energy );
562  obj.Normamtx = [];
563  end
564 
565 %% AddPotential
566 %> @brief Adds on-site potential to the Hamiltonian H0.
567 %> @param V The potential calculated on the sites. The normalization matrix is set to empty.
568  function AddPotential( obj, V )
569 
570  AddPotential@EigenProblemLead( obj, V );
571  obj.Normamtx = [];
572  end
573 
574 %% Unitary_Transform
575 %> @brief Transforms the effective Hamiltonians and the calculated surface Green operator and selfenergy by a unitary transformation
576 %> @param Umtx The matrix of the unitary transformation.
577  function Unitary_Transform(obj, Umtx)
578  Unitary_Transform@EigenProblemLead( obj, Umtx );
579 
580  if ~isempty(obj.gsurfinv)
581  obj.gsurfinv = Umtx*obj.gsurfinv*Umtx';
582  end
583 
584  if ~isempty(obj.Sigma)
585  obj.Sigma = Umtx*obj.Sigma*Umtx';
586  end
587 
588  if ~isempty(obj.Normamtx)
589  obj.Normamtx = Umtx*obj.Normamtx*Umtx';
590  end
591 
592  end
593 
594 %% CreateClone
595 %> @brief Creates a clone of the present Lead object.
596 %> @return Returns with the cloned object.
597 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
598 %> @param 'empty' Set true to create an empty clone, or false (default) to clone all atributes.
599  function ret = CreateClone( obj, varargin )
600 
601  p = inputParser;
602  p.addParameter('empty', false );
603 
604  p.parse(varargin{:});
605  empty = p.Results.empty;
606 
607  ret = Lead(obj.Opt, obj.param,...
608  'Hanyadik_Lead', obj.Hanyadik_Lead,...
609  'Lead_Orientation', obj.Lead_Orientation, ...
610  'q', obj.q);
611 
612  if empty
613  return
614  end
615 
616  meta_data = metaclass(obj);
617 
618  for idx = 1:length(meta_data.PropertyList)
619  prop_name = meta_data.PropertyList(idx).Name;
620  if strcmpi( prop_name, 'SelfEnergyCalc' ) || strcmpi( prop_name, 'GinfCalc' )
621  continue
622  elseif strcmpi( prop_name, 'next_SVD_cycle' )
623  if ~isempty( obj.next_SVD_cycle )
624  ret.next_SVD_cycle = obj.next_SVD_cycle.CreateClone();
625  end
626  else
627  ret.Write( prop_name, obj.(prop_name));
628  end
629  end
630 
631  end
632 
633 %% Reset
634 %> @brief Resets all elements in the object.
635  function Reset( obj )
636 
637  if strcmpi( class(obj), 'Lead' )
638  meta_data = metaclass(obj);
639 
640  for idx = 1:length(meta_data.PropertyList)
641  prop_name = meta_data.PropertyList(idx).Name;
642  if strcmp(prop_name, 'Opt') || strcmp( prop_name, 'param') || strcmp(prop_name, 'varargin')
643  continue
644  end
645  obj.Clear( prop_name );
646  end
647  end
648 
649  obj.Initialize();
650 
651  end
652 
653 %% Write
654 %> @brief Sets the value of an attribute in the class.
655 %> @param MemberName The name of the attribute to be set.
656 %> @param input The value to be set.
657  function Write(obj, MemberName, input)
658 
659  if strcmp(MemberName, 'param') || strcmp(MemberName, 'params')
660  Write@CreateLeadHamiltonians( obj, MemberName, input );
661  return
662  else
663  try
664  obj.(MemberName) = input;
665  catch
666  error(['EQuUs:', class(obj), ':Read'], ['No property to write with name: ', MemberName]);
667  end
668  end
669 
670  end
671 %% Read
672 %> @brief Query for the value of an attribute in the class.
673 %> @param MemberName The name of the attribute to be set.
674 %> @return Returns with the value of the attribute.
675  function ret = Read(obj, MemberName)
676 
677  if strcmpi(MemberName, 'd_modusmtx_p')
678  obj.calcDualModes()
679  ret = obj.d_modusmtx_p;
680  return
681  elseif strcmpi(MemberName, 'd_modusmtx_m')
682  obj.calcDualModes()
683  ret = obj.d_modusmtx_m;
684  return
685  else
686  try
687  ret = obj.(MemberName);
688  catch
689  error(['EQuUs:', class(obj), ':Read'], ['No property to read with name: ', MemberName]);
690  end
691  end
692 
693 
694  end
695 %% Clear
696 %> @brief Clears the value of an attribute in the class.
697 %> @param MemberName The name of the attribute to be cleared.
698  function Clear(obj, MemberName)
699  try
700  obj.(MemberName) = [];
701  catch
702  error(['EQuUs:', class(obj), ':Clear'], ['No property to clear with name: ', MemberName]);
703  end
704 
705  end
706 
707 end
708 
709 %------------------------------------------------------------------
710 end % Global End
Structure Opt contains the basic computational parameters used in EQuUs.
Definition: structures.m:120
Class to create and store Hamiltonian of the translational invariant leads.
function Transport(Energy, B)
creating the Ribbon class representing the twoterminal setup
function EigenProblemLead(Opt, param, varargin)
Constructor of the class.
A class containing common basic functionalities.
A class to calculate the Green functions and self energies of a translational invariant lead The nota...
Definition: Lead.m:29
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
Property Sigma
The retarded self-energy of the semi-infinite ribbon.
Definition: Lead.m:63
Structure sites contains data to identify the individual sites in a matrix.
Definition: structures.m:247
Class to solve the eigenproblem of a translational invariant leads and calculate the group velocities...