Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
NTerminal_Keldysh.m
Go to the documentation of this file.
1 %% Eotvos Quantum Transport Utilities - NTerminal_Keldysh
2 % Copyright (C) 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 utilities Utilities
18 %> @{
19 %> @file NTerminal_Keldysh.m
20 %> @brief A class describing an N-terminal geometry for steady state non-equilibrium calculations.
21 %> @image html two_terminal_structure.jpg
22 %> @image latex two_terminal_structure.jpg
23 %> @}
24 %> @brief A class describing an N-terminal geometry for steady state non-equilibrium calculations.
25 %> @Available
26 %> EQuUs v4.9 or later
27 %> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="avail"></a>Structure described by the class</h2></td></tr>
28 %> @image html two_terminal_structure.jpg
29 %> @image latex two_terminal_structure.jpg
30 %> The drawing represents a two-terminal structure made of two leads, of a scattering region and of two interface regions between the leads and scattering center.
31 %> However, additional lead can be added to the structure.
32 %> Each rectangle describes a unit cell including singular and non-singular sites.
33 %> The scattering center is, on the other hand, represented by a larger rectangle corresponding to the Hamiltonian of the scattering region.
34 %> Arrows indicate the hopping direction stored by the attributes in the corresponding classes (see attributes #CreateLeadHamiltonians.H1 and #InterfaceRegion.Hcoupling for details).
35 %> The orientation of the lead is +1 if the lead is terminated by the interface region in the positive direction, and -1 if the lead is terminated by the interface region in the negative direction.
36 %> (see attribute #CreateLeadHamiltonians.Lead_Orientation for details)
37 %%
39 
40  properties (Access = protected)
41  %> An array containing the bias of the leads in the same unit as other energy scales in the Hamiltonians.
42  bias_leads
43  %> Lesser Green operator projected onto the scattering region
44  lesserG
45  end
46 
47  properties (Access = public)
48 
49  end
50 
51 
52 
53 methods ( Access = public )
54 
55 
56 %% Contructor of the class
57 %> @brief Constructor of the class.
58 %> @param varargin Cell array of optional parameters. For details see #InputParsing.
59 %> @return An instance of the class
60 function obj = NTerminal_Keldysh( varargin )
61  obj = obj@NTerminal();
62  obj = obj@FermiDirac();
63 
64 
65  obj.lesserG = [];
66  obj.bias_leads = [];
67 
68 
69  if strcmpi( class(obj), 'NTerminal_Keldysh')
70  obj.InputParsing( varargin{:} );
71 
72  obj.cCustom_Hamiltonians = [];
73 
74  obj.display(['EQuUs:Utils:', class(obj), ':Creating NTerminal_Keldysh class.'])
75 
76  % exporting calculation parameters into an XML format
77  createOutput( obj.filenameOut, obj.Opt, obj.param );
78 
79  % initializing attributes
80  obj.CreateHandles();
81 
82  % create Hamiltonian of the scattering region (or load from external source)
83  obj.CreateNTerminalHamiltonians();
84  end
85 
86 
87 
88 end
89 
90 
91 %% CustomDysonFunc
92 %> @brief Custom Dyson function for a two terminal arrangement on a two dimensional lattice.
93 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
94 %> @param 'gfininv' The inverse of the Greens function of the scattering region. For default the inverse of the attribute #G is used.
95 %> @param 'constant_channels' Logical value. Set true (default) to keep constant the number of the open channels in the leads for each energy value, or false otherwise.
96 %> @param 'onlyGinverz' Logical value. Set true to calculate only the inverse of the total Green operator, or false (default) to calculate #G as well.
97 %> @param 'recalculateSurface' A vector of the identification numbers of the lead surfaces to be recalculated.
98 %> @param 'decimate' Logical value. Set true (default) to eliminate all inner sites in the Greens function and keep only the selected sites. Set false to omit the decimation procedure.
99 %> @param 'kulso_szabfokok' Array of sites to be kept after the decimation procedure. (Use parameter 'keep_sites' instead)
100 %> @param 'selfEnergy' Logical value. Set true to use the self energies of the leads in the Dyson equation, or false (default) to use the surface Green function instead.
101 %> @param 'keep_sites' Name of sites to be kept in the resulted Green function (Possible values are: 'scatter', 'interface', 'lead').
102 %> @return [1] The calculated Greens function.
103 %> @return [2] The inverse of the Green operator.
104 %> @return [3] An instance of structure #junction_sites describing the sites in the calculated Green operator.
105  function [Gret, Ginverz, junction_sites] = CustomDysonFunc( obj, varargin ) %NEW output
106 
107  p = inputParser;
108  p.addParameter('gfininv', []);
109  p.addParameter('constant_channels', true);
110  p.addParameter('onlyGinverz', false );
111  p.addParameter('recalculateSurface', 1:length(obj.param.Leads) );
112  p.addParameter('decimate', true );
113  p.addParameter('kulso_szabfokok', []); %The list of sites to be left after the decimation procedure
114  p.addParameter('SelfEnergy', false); %set true to calculate the Dyson equation with the self energy
115  p.addParameter('keep_sites', 'lead'); %Name of sites to be kept (scatter, interface, lead)
116 
117  p.parse(varargin{:});
118  gfininv = p.Results.gfininv;
119  constant_channels = p.Results.constant_channels;
120  onlyGinverz = p.Results.onlyGinverz;
121  recalculateSurface = p.Results.recalculateSurface;
122  decimate = p.Results.decimate;
123  kulso_szabfokok = p.Results.kulso_szabfokok;
124  useSelfEnergy = p.Results.SelfEnergy;
125  keep_sites = p.Results.keep_sites;
126 
127 
128  if ~isempty(recalculateSurface)
129 
130  % creating interfaces for the Leads
131  if constant_channels
132  shiftLeads = ones(length(obj.param.Leads),1)*obj.E;
133  else
134  shiftLeads = ones(length(obj.param.Leads),1)*0;
135  end
136 
137  % creating Lead instaces and calculating the retarded surface Green operator/self-energy
138  obj.FL_handles.LeadCalc('shiftLeads', shiftLeads, ...
139  'SelfEnergy', useSelfEnergy, 'SurfaceGreensFunction', ~useSelfEnergy, 'gauge_field', obj.gauge_field, 'leads', recalculateSurface, 'q', obj.q, ...
140  'leadmodel', obj.leadmodel, 'bias_leads', obj.bias_leads, 'T', obj.T, 'CustomHamiltonian', obj.cCustom_Hamiltonians);
141 
142  for idx = 1:length(recalculateSurface)
143  obj.CreateInterface( recalculateSurface(idx) );
144  end
145 
146  end
147 
148  [Gret, Ginverz, junction_sites] = CustomDysonFunc@NTerminal(obj, 'gfininv', gfininv, ...
149  'onlyGinverz', onlyGinverz, ...
150  'recalculateSurface', [], ...
151  'decimate', decimate, ...
152  'kulso_szabfokok', kulso_szabfokok, ...
153  'SelfEnergy', useSelfEnergy, ...
154  'keep_sites', keep_sites);
155 
156 
157  end
158 
159 %% LesserGreenFunction
160 %> @brief Calculates the lesser Green function projected to the surface sites of the central device and the interface regions for eregy given #E.
161 %> (Surface sites of the central device are directly connected to the interface regions.) The calculated Green function is stored by attributes #lesserG and #lesserGinv.
162 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
163 %> @param 'gfininv' The inverse of the Greens function of the scattering region. For default the inverse of the attribute #G is used.
164 %> @param 'constant_channels' Logical value. Set true (default) to keep constant the number of the open channels in the leads for each energy value, or false otherwise.
165 %> @param 'recalculateSurface' A vector of the identification numbers of the lead surfaces to be recalculated.
166 %> @return [1] The calculated lesser Greens operator.
167 %> @return [2] An instance of structure #junction_sites describing the sites in the calculated Green operator.
168  function [Gret, junction_sites] = LesserGreenFunction( obj, varargin )
169 
170  p = inputParser;
171  p.addParameter('gfininv', []);
172  p.addParameter('constant_channels', false);
173  p.addParameter('recalculateSurface', 1:length(obj.param.Leads) );
174  p.parse(varargin{:});
175  gfininv = p.Results.gfininv;
176  constant_channels = p.Results.constant_channels;
177  recalculateSurface = p.Results.recalculateSurface;
178 
179  % evaluate the Dyson equation for the retarded Green operator
180  Dysonfunc = @()(obj.CustomDysonFunc( ...
181  'decimate', false, 'constant_channels', constant_channels, ...
182  'gfininv', gfininv, 'recalculateSurface', recalculateSurface, ...
183  'SelfEnergy', true));
184  [retardedG, junction_sites] = obj.FL_handles.DysonEq( 'CustomDyson', Dysonfunc );
185 
186  % create a global matrix containing the lesser self-energies
187  % and obtaining the lesser self energies of the leads
188  lesser_self_energy = zeros( size(retardedG) );
189  Leads = obj.FL_handles.Read( 'Leads' );
190  leadnum = length( Leads );
191  for idx = 1:leadnum
192  indexes = junction_sites.Leads{idx}.site_indexes;
193  lesser_self_energy( indexes, indexes ) = Leads{idx}.LesserSelfEnergy();
194  end
195 
196  % Calculate the lesser Green operator via
197  % Eq (61) in Adv. Nat. Sci.: Nanosci. Nanotechnol. 5 (2014) 033001
198  Gret = retardedG*lesser_self_energy*retardedG';
199 
200 
201  end
202 
203 %% setEnergy
204 %> @brief Sets the energy for the calculations
205 %> @param Energy The value of the energy in the same units as the Hamiltonian.
206  function setEnergy( obj, Energy )
207  setEnergy@NTerminal( obj, Energy );
208 
209  % resetting the class describing the N-terminal geometry
210  if ~isempty( obj.FL_handles ) && strcmpi(class(obj.FL_handles), 'Transport_Interface_Keldysh')
211  obj.FL_handles.setEnergy( obj.E );
212  end
213 
214  % recreate the Hamiltonian of the scattering region
215  if ~isempty( obj.CreateH ) && strcmpi( class(obj), 'NTerminal_Keldysh' )
216  obj.CreateNTerminalHamiltonians();
217  end
218 
219  end
220 
221 
222 %% setTemperature
223 %> @brief Sets the temperature in the calculations
224 %> @param T The value of the temperature in Kelvins.
225  function setTemperature( obj, T )
226  setTemperature@FermiDirac( obj, T );
227 
228  % setting the temperature in class describing the N-terminal geometry
229  if ~isempty( obj.FL_handles ) && strcmpi(class(obj.FL_handles), 'Transport_Interface_Keldysh')
230  obj.FL_handles.setTemperature( obj.T );
231  end
232 
233  obj.lesserG = [];
234 
235  end
236 
237 
238 end % end methods public
239 
240 
241 
242 methods (Access=protected)
243 
244 %% CreateHandles
245 %> @brief Initializes the attributes of the class.
246  function CreateHandles( obj )
247 
248  % creating classes for managing the magnetic field
249  obj.setHandlesForMagneticField();
250 
251  % create class storing the Hamiltonian of the scattering region
252  obj.CreateH = CreateHamiltonians_Keldysh(obj.Opt, obj.param, 'q', obj.q);
253 
254  % create class for transport calculations specific for steady state non-equilibrium calculations
255  obj.FL_handles = Transport_Interface_Keldysh(obj.E, obj.Opt, obj.param, 'CreateH', obj.CreateH, 'PeierlsTransform', obj.PeierlsTransform_Leads );
256 
257  % read out structure Opt containing the computational parameters
258  obj.Opt = obj.FL_handles.Read( 'Opt' );
259 
260  % creating classes of the interface regions
261  obj.Interface_Regions = cell(length(obj.param.Leads),1);
262  for idx = 1:length(obj.Interface_Regions)
263  Lead_Orientation = obj.param.Leads{idx}.Lead_Orientation;
264  obj.Interface_Regions{idx} = InterfaceRegion(obj.Opt, obj.param, 'Hanyadik_Lead', idx, 'q', obj.q, 'Lead_Orientation', Lead_Orientation);
265  end
266 
267  end
268 
269 
270 %% InputParsing
271 %> @brief Parses the optional parameters for the class constructor.
272 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
273 %> @param 'filenameIn' The input filename containing the computational parameters. (Use parameters 'Op' and 'param' instead)
274 %> @param 'filenameOut' The output filename to export the computational parameters.
275 %> @param 'WorkingDir' The absolute path to the working directoy.
276 %> @param 'CustomHamiltoniansHandle' function handle for the custom Hamiltonians. Has the same inputs as #Custom_Hamiltonians.LoadHamiltonians and output values defined by the example #Hamiltonians.
277 %> @param 'E' The energy value used in the calculations (in the same units as the Hamiltonian).
278 %> @param 'EF' The Fermi energy in the same units as the Hamiltonian. Attribute #E is measured from this value. (Use for equilibrium calculations in the zero temperature limit. Overrides the one comming from the external source)
279 %> @param 'silent' Set true to suppress output messages.
280 %> @param 'leadmodel' A function handle #Lead=f( idx, E, varargin ) of the alternative lead model with equivalent inputs and return values as #Transport_Interface.SurfaceGreenFunctionCalculator and with E standing for the energy.
281 %> @param 'interfacemodel' A function handle f( #InterfaceRegion ) to manually adjus the interface regions. (Usefull when 'leadmodel' is also given. For example see @InterfaceModel)
282 %> @param 'Opt' An instance of the structure #Opt.
283 %> @param 'param' An instance of the structure #param.
284 %> @param 'q' The transverse momentum quantum number.
285 %> @param 'T' The absolute temperature in Kelvins.
286 %> @param 'mu' The Chemical potential in the same unit as other energy scales in the Hamiltonians.
287 %> @param 'mu_leads' An array containing the chemical potentials of the leads in the same unit as other energy scales in the Hamiltonians.
288  function InputParsing( obj, varargin)
289 
290  p = inputParser;
291  p.addParameter('filenameIn', obj.filenameIn, @ischar);
292  p.addParameter('filenameOut', obj.filenameOut, @ischar);
293  p.addParameter('WorkingDir', obj.WorkingDir, @ischar);
294  p.addParameter('CustomHamiltoniansHandle', obj.CustomHamiltoniansHandle); %function handle for the custom Hamiltonians
295  p.addParameter('E', obj.E, @isscalar);
296  p.addParameter('silent', obj.silent);
297  p.addParameter('leadmodel', obj.leadmodel); %individual physical model for the contacts
298  p.addParameter('interfacemodel', obj.interfacemodel); %individual physical model for the interface regions
299  p.addParameter('Opt', obj.Opt);
300  p.addParameter('param', obj.param);
301  p.addParameter('q', obj.q);
302  p.addParameter('T', obj.T);
303  p.addParameter('EF', obj.EF);
304  p.addParameter('bias_leads', obj.bias_leads);
305 
306  p.parse(varargin{:});
307 
308 
309  InputParsing@NTerminal( obj, 'filenameIn', p.Results.filenameIn, ...
310  'filenameOut', p.Results.filenameOut, ...
311  'WorkingDir', p.Results.WorkingDir, ...
312  'CustomHamiltoniansHandle', p.Results.CustomHamiltoniansHandle, ...
313  'E', p.Results.E, ...
314  'EF', p.Results.EF, ...
315  'silent', p.Results.silent, ...
316  'leadmodel', p.Results.leadmodel, ...
317  'interfacemodel', p.Results.interfacemodel, ...
318  'q', p.Results.q, ...
319  'Opt', p.Results.Opt, ...
320  'param', p.Results.param);
321 
322  InputParsing@FermiDirac( obj, 'T', p.Results.T, ...
323  'mu', 0);
324 
325 
326  % setting the bias in the leads
327  if isempty( p.Results.bias_leads )
328  obj.bias_leads = zeros( size( obj.param.Leads ) );
329  else
330  obj.bias_leads = p.Results.bias_leads;
331  end
332 
333  end
334 
335 end % methods private
336 
337 end
A class describing an N-terminal geometry for equilibrium calculations mostly in the zero temperature...
Definition: NTerminal.m:38
function LoadHamiltonians(varargin)
Obtain the Hamiltonians from the external source.
A class describing the Fermi Dirac distribution of fermionic particles.
Definition: FermiDirac.m:25
Structure Opt contains the basic computational parameters used in EQuUs.
Definition: structures.m:60
Class to create and store Hamiltonian of the translational invariant leads.
Property H1
The coupling Hamiltonian between the unit cells.
function Transport(Energy, B)
Calculates the conductance at a given energy value.
A class to evaluate the Dyson equation and to calculate the scattering matrix for equilibrium process...
function Hamiltonians(varargin)
Function to create the custom Hamiltonians for the 1D chain.
A class to evaluate the Dyson equation derived from class Transport_Interface with specific modificat...
function createOutput(filename, Opt, param)
This function creates an output file containing the running parameters.
A class to import custom Hamiltonians provided by other codes or created manually
Property Hcoupling
Coupling Hamiltonian from the interface region to the scattering region.
A class describing the interface region between the scattering region and a lead.
A class to calculate the Green functions and self energies of a translational invariant lead The nota...
Definition: Lead.m:29
function()
function InterfaceModel(Interface_Region)
Method to adjust the Hamiltonians of the interface regions.
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
Property Lead_Orientation
The orientation of the lead. Set +1 is the "incoming" direction of the propagating states is defined ...
A class describing an N-terminal geometry for steady state non-equilibrium calculations.
site_indexes
An array containing the site indexes of the given system part.
Definition: structures.m:191
Structure sites contains data to identify the individual sites in a matrix.
Definition: structures.m:187
sites Leads
Structure sites describing the geometry of the leads.
Definition: structures.m:178
function SurfaceGreenFunctionCalculator(idx, varargin)
Calculates the surface Green's function or the self energy of a Lead.
A class to handle the Hamiltonian of the central region in Keldysh formalism.
Structure junction_sites contains data to identify the individual sites of the leads,...
Definition: structures.m:176