2 % Copyright (C) 2009-2015 Peter Rakyta, Ph.D.
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.
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.
14 % You should have received a copy of the GNU General Public License
15 % along with
this program. If not, see http:
18 %> An
object for combining multiple ribbon parts of equal width and from the same material in a two terminal setup.
22 properties ( Access =
private )
23 %> An instance of structure coordinates.
29 %> the list of the ribbon
interface to be combained (
Ribbon objects)
32 Interface_Regions_all = {};
37 methods ( Access =
public )
38 %% Contructor of the
class 39 %> @brief Constructor of the
class.
41 %> @
param varargin Cell array of optional parameters. For details see #InputParsing.
42 %> @
return An instance of the
class 48 obj.InputParsing( varargin{:} );
53 %> @brief Calculates the transport through the two terminal setup on two dimensional lattices. Use
for development pupose only.
54 %> @
param Energy The energy value.
55 %> @
param varargin Cell array of optional parameters:.
56 %> @
return Conductance The conductance tensor
57 %> @
return ny Array of the open channel in the leads.
58 %> @
return DeltaC Error of the unitarity.
59 %> @
return S The scattering matrix.
60 function [Conductance,ny,DeltaC] =
Transport( obj, Energy )
61 obj.setEnergy( Energy )
63 obj.CalcFiniteGreensFunction(
'onlyGinv',
true);
65 Surface_sc = cell(2,1);
66 ribbon_tmp = obj.Ribbons{1};
67 Surface_sc{1} = ribbon_tmp.Scatter_UC.CreateClone();
68 Surface_sc{1}.ShiftCoordinates( -1 )
69 ribbon_tmp = obj.Ribbons{end};
70 total_height = obj.getTotalHeight();
71 Surface_sc{2} = ribbon_tmp.Scatter_UC.CreateClone();
72 Surface_sc{2}.ShiftCoordinates( total_height )
75 Dysonfunc = @()(obj.CustomDysonFunc(
'constant_channels',
false,
'gfininv', obj.Ginv ));
77 obj.FL_handles.DysonEq(
'CustomDyson', Dysonfunc );
79 err = MException(
'CombineRibbons:Transport',
'Error occured in calculating the Greens function');
80 err = addCause(err, errCause);
81 save(
'Error_CombineRibbons_Transport.mat');
87 [S,ny] = obj.FL_handles.SmatrixCalc();
89 norma = norm(S*S
'-eye(sum(ny))); 92 disp( ['error of the unitarity of S-matrix:
',num2str(norma)] ) 96 disp( ['openchannels
do not match:
',num2str(ny)] ) 100 conductance = obj.FL_handles.Conduktance(); 101 conductance = abs([conductance(1,:), conductance(2,:)]); 102 DeltaC = std(conductance); 104 C = mean(conductance); 107 disp( ['conductance =
', num2str(C), ' open_channels=
', num2str(ny(1)), ' DeltaC =
', num2str(DeltaC)]) 113 %> @brief Gets the coordinates of the central region 114 %> @return coordinates Coordinates of the surface sites of the central region. 115 %> @return coordinates_interface Coordinates of the interface region. 116 function [coordinates, coordinates_interface] = getCoordinates( obj ) 117 if isempty( obj.Ribbons ) 119 coordinates_interface = []; 123 [coordinates, coordinates_interface] = obj.Ribbons{1}.getCoordinates(); 128 %> @brief Sets the energy for the calculations 129 %> @param Energy The value of the energy in the same units as the Hamiltonian. 130 function setEnergy( obj, Energy ) 132 setEnergy@Ribbon( obj, Energy ); 134 for idx = 1:length(obj.Ribbons) 135 ribbon_loc = obj.Ribbons{idx}; 136 ribbon_loc.setEnergy( Energy ) 144 %% CalcFiniteGreensFunctionFromHamiltonian 145 %> @brief Calculates the Green operator of the scattering region from the whole Hamiltonian. 146 %> @param varargin Cell array of optional parameters:. 147 function CalcFiniteGreensFunctionFromHamiltonian( obj, varargin ) 149 p.addParameter('gauge_trans
', false); % logical: true if want to perform gauge transformation on the Green's
function and
Hamiltonians 150 p.addParameter(
'E', [], @isscalar); %The energy to be used in the ribbons
151 p.addParameter(
'onlyGinv',
false ); %
152 p.addParameter(
'ContactPotInterface', []);
153 p.addParameter(
'PotInScatter', []);
154 p.parse(varargin{:});
156 gauge_trans = p.Results.gauge_trans;
158 onlyGinv = p.Results.onlyGinv;
159 ContactPotInterface = p.Results.ContactPotInterface;
160 PotInScatter = p.Results.PotInScatter;
162 obj.CalcFiniteGreensFunction(
'E', E,
'gauge_trans', gauge_trans,
'onlyGinv', onlyGinv,
'ContactPotInterface', ContactPotInterface,
'gfininvfromHamiltonian',
true,
'PotInScatter', PotInScatter )
166 %% CalcFiniteGreensFunction
167 %> @brief Calculates the Green
operator of the scattering region by the fast way (see PRB 90, 125428 (2014)).
168 %> @
param varargin Cell array of optional parameters:.
169 function CalcFiniteGreensFunction( obj, varargin )
171 p.addParameter(
'gauge_trans',
false); % logical:
true if want to perform gauge transformation on the Green
's function and Hamiltonians 172 p.addParameter('E
', []); %The energy to be used in the ribbons 173 p.addParameter('onlyGinv
', false ); 174 p.addParameter('ContactPotInterface
', []); 175 p.addParameter('gfininvfromHamiltonian
', false); %Not added to the documentation 176 p.addParameter('PotInScatter
', []); 177 p.parse(varargin{:}); 179 gauge_trans = p.Results.gauge_trans; 181 onlyGinv = p.Results.onlyGinv; 182 ContactPotInterface = p.Results.ContactPotInterface; 183 gfininvfromHamiltonian = p.Results.gfininvfromHamiltonian; 184 PotInScatter = p.Results.PotInScatter; 190 for idx = 1:length( obj.Ribbons ) 191 ribbon_tmp = obj.Ribbons{idx}; 192 ribbon_tmp.setEnergy( E ); 196 % creating the interface regions if needed 197 if ~isempty( obj.Interface_Regions ) 198 obj.createInterfaceRegions() 201 for idx = 1:length(obj.Ribbons) 202 obj.attachRibbon( obj.Ribbons{idx}, 'onlyGinv
', onlyGinv, 'gfininvfromHamiltonian
', gfininvfromHamiltonian, 'PotInScatter
', PotInScatter ); 207 % gauge transformation of the vector potential in the effective Hamiltonians 210 % gauge transformation on Green's
function 211 if ~isempty(obj.Ginv) && ~isempty(obj.PeierlsTransform_Scatter) && isempty(obj.q)
212 % gauge transformation on the inverse Green
's function 213 obj.Ginv = obj.PeierlsTransform_Scatter.gaugeTransformation( obj.Ginv, coordinates_scatter, obj.gauge_field ); 216 err = MException('CombineRibbons:CalcFiniteGreensFunction
', 'Unable to perform gauge transformation
'); 217 err = addCause(err, errCause); 218 save('Error_CombineRibbons_CalcFiniteGreensFunction.mat
') 226 %% setHandlesForMagneticField 227 %> @brief Sets the function handles of the vector potential and gauge transformation. 228 %> @param varargin Cell array of optional parameters:. % 229 function setHandlesForMagneticField( obj, varargin ) 231 setHandlesForMagneticField@Ribbon( obj, varargin{:} ); 233 % other Ribbon classes in the list 234 for idx = 1:length(obj.Ribbons) 235 obj.Ribbons{idx}.setHandlesForMagneticField('scatter
', hscatter, 'lead
', hscatter);%hlead, 'gauge_field', gauge_field ); 241 %> @brief Creates a clone of the present object. 242 %> @return Returns with the cloned object. 243 function ret = CreateClone( obj ) 244 Ribbons_cloned = cell(size(obj.Ribbons)); 245 for idx = 1:length(Ribbons_cloned) 246 Ribbons_cloned{idx} = obj.Ribbons{idx}.CreateClone(); 249 ret = CombineRibbons('Ribbons
', Ribbons_cloned); 256 %> @brief Gets the total height of the ribbon structure. 257 %> @return Returns with the total height (length) of the scattering region in units of the lattice vector. 258 function ret = getTotalHeight( obj ) 259 heights = obj.getHeights(); 260 ret = sum( heights ); 262 if length(heights) == 1 266 % accounting for the coupling between the ribbons 267 if ~isempty( heights ) 268 ret = ret + length(obj.Ribbons )-1; 271 % accounting for the interface regions 272 for idx = 2:length( obj.Ribbons ) 273 ribbon_tmp = obj.Ribbons{idx}; 274 if ~isempty(ribbon_tmp.Interface_Regions) 283 %> @brief Adds a Ribbon part to the system. 284 %> @param ribbon2add An instance of the ribbon class. 285 %> @param varargin Cell array of optional parameters:. 286 function addRibbon( obj, ribbon2add, varargin ) 289 p.addParameter('shiftcoordinates
', true ); 290 p.parse(varargin{:}); 291 shiftcoordinates = p.Results.shiftcoordinates; 294 ribbon2add.setEnergy( obj.E ); 297 % checking if the width of the ribbons is equal 298 if obj.checkwidth( ribbon2add ) == -1 299 err = MException('CombineRibbons:ribbon2add
', 'widths of the ribbons are not identical.
'); 300 save('Error_CombineRibbons_ribbon2add.mat
'); 306 % shift the coordinates 308 total_height = obj.getTotalHeight(); 309 if ~isempty(obj.Ribbons) 310 total_height = total_height + 1; % 1 for the coupling length 311 if ~isempty(ribbon2add.Interface_Regions) 312 total_height = total_height + 1; 315 ribbon2add.ShiftCoordinates( total_height ); 319 obj.Ribbons{end+1} = ribbon2add; 321 obj.height = obj.getTotalHeight(); 330 methods ( Access = protected ) 336 %> @brief Returns an array of the heights of the ribbon parts. 337 %> @return Returns Returns an array of the heights of the ribbon parts. 338 function ret = getHeights( obj ) 339 ribbonnum = length( obj.Ribbons ); 340 ret = zeros( ribbonnum, 1); 341 for idx = 1:ribbonnum 342 ribbon_tmp = obj.Ribbons{idx}; 343 ret(idx) = ribbon_tmp.height; 356 %> @brief Attach the next ribbon to the ribbon sequence for the calculation of the surface Greens function. 357 %> @param ribbon_tmp An instance of the ribbon class. 358 %> @param varargin Cell array of optional parameters:. 359 function attachRibbon( obj, ribbon_tmp, varargin ) 362 p.addParameter('onlyGinv
', false ); 363 p.addParameter('decimate
', true ); 364 p.addParameter('gfininvfromHamiltonian
', false); 365 p.addParameter('PotInScatter
', []); 367 p.parse(varargin{:}); 369 onlyGinv = p.Results.onlyGinv; 370 decimate = p.Results.decimate; 371 gfininvfromHamiltonian = p.Results.gfininvfromHamiltonian; 372 PotInScatter = p.Results.PotInScatter; 375 if isempty(obj.Ginv) && isempty(obj.G) 376 if gfininvfromHamiltonian 377 ribbon_tmp.CalcFiniteGreensFunctionFromHamiltonian( 'onlyGinv
', true, 'gauge_trans
', false, 'PotInScatter
', PotInScatter ); 379 ribbon_tmp.CalcFiniteGreensFunction( 'onlyGinv
', true, 'gauge_trans
', false ); 381 [~,obj.Ginv] = ribbon_tmp.GetFiniteGreensFunction(); 382 obj.coordinates = ribbon_tmp.getCoordinates(); 385 if isnan(rcond(obj.G) ) || abs( rcond(obj.G) ) < 1e-15 386 obj.Ginv = obj.inv_SVD( G ); 388 obj.Ginv = inv(obj.G); 392 size_gfin = size(obj.Ginv); 393 if gfininvfromHamiltonian 394 ribbon_tmp.CalcFiniteGreensFunctionFromHamiltonian( 'onlyGinv
', true, 'gauge_trans
', false ); 396 ribbon_tmp.CalcFiniteGreensFunction( 'onlyGinv
', true, 'gauge_trans
', false ); 398 [~,gfininv_tmp] = ribbon_tmp.GetFiniteGreensFunction(); 399 size_gfin_tmp = size( gfininv_tmp); 401 Surface_sc = ribbon_tmp.Scatter_UC.CreateClone(); 403 if isempty( ribbon_tmp.Interface_Regions ) 405 H1_sc_tmp = Surface_sc.Read( 'H1
' ); 406 H1adj_sc_tmp = Surface_sc.Read( 'H1adj
' ); 407 size_H1_sc_tmp = size(H1_sc_tmp); 409 H1_sc = zeros(size_gfin(1), size_gfin_tmp(2) ); 410 H1adj_sc = zeros(size_gfin_tmp(1), size_gfin(2) ); 412 H1_sc(end-size_H1_sc_tmp(1)+1:end, 1:size_H1_sc_tmp(2)) = H1_sc_tmp; 415 H1adj_sc( 1:size_H1_sc_tmp(2), end-size_H1_sc_tmp(1)+1:end) = H1adj_sc_tmp; 418 obj.Ginv = [obj.Ginv, -H1_sc; -H1adj_sc, gfininv_tmp]; 420 coordinates_tmp = ribbon_tmp.getCoordinates(); 421 fnames = fieldnames(obj.coordinates); 422 for idx = 1:length( fnames ) 424 if strcmp( fname, 'a
' ) 427 obj.coordinates.(fname) = [obj.coordinates.(fname); coordinates_tmp.(fname)]; 435 H0_interface = ribbon_tmp.Interface_Regions{1}.Read('H0
'); 436 H1_interface_tmp = ribbon_tmp.Interface_Regions{1}.Read('H1
'); 437 H1adj_interface_tmp = ribbon_tmp.Interface_Regions{1}.Read('H1adj
'); 438 size_interface = size(H0_interface,1); 439 size_H1_interface_tmp = size( H1_interface_tmp ); 441 % ribbon_tmp -> interface 442 H1_sc_tmp = Surface_sc.Read( 'H1
' ); 443 H1adj_sc_tmp = Surface_sc.Read( 'H1adj
' ); 444 size_H1_sc_tmp = size(H1_sc_tmp); 446 H1_sc = zeros(size_interface, size_gfin_tmp(2) ); 447 H1adj_sc = zeros(size_gfin_tmp(1), size_interface ); 449 H1_sc(end-size_H1_sc_tmp(1)+1:end, 1:size_H1_sc_tmp(2)) = H1_sc_tmp; 452 H1adj_sc( 1:size_H1_sc_tmp(2), end-size_H1_sc_tmp(1)+1:end ) = H1adj_sc_tmp; 455 % interface -> other ribbons 456 H1_interface = zeros(size_gfin(1), size_interface ); 457 H1adj_interface = zeros( size_interface, size_gfin(2) ); 459 H1_interface(end-size_H1_interface_tmp(1)+1:end, 1:size_H1_interface_tmp(2)) = H1_interface_tmp; 460 H1_interface_tmp = []; 462 H1adj_interface(1:size_H1_interface_tmp(2), end-size_H1_interface_tmp(1)+1:end ) = H1adj_interface_tmp; 463 H1adj_interface_tmp = []; 466 obj.Ginv = [ obj.Ginv, -H1_interface, zeros(size_gfin(1),size_gfin_tmp(2)); ... 467 -H1adj_interface, obj.E*eye(size(H0_interface))-H0_interface, -H1_sc; ... 468 zeros(size_gfin_tmp(1),size_gfin(2)), -H1adj_sc, gfininv_tmp]; 471 [coordinates_tmp, coordinates_iterface] = ribbon_tmp.getCoordinates(); 472 fnames = fieldnames(obj.coordinates); 473 for idx = 1:length( fnames ) 475 if strcmp( fname, 'a
' ) 478 obj.coordinates.(fname) = [obj.coordinates.(fname); coordinates_iterface{1}.(fname); coordinates_tmp.(fname)]; 488 size_gfininv = size(obj.Ginv,1); 489 M = Surface_sc.Read('M
'); 491 gfin_tmp = inv(obj.Ginv); 492 gfin_tmp = [gfin_tmp(1:M, 1:M), gfin_tmp(1:M, size_gfininv-M+1:size_gfininv); ... 493 gfin_tmp(size_gfininv-M+1:size_gfininv ,1:M), gfin_tmp(size_gfininv-M+1:size_gfininv, size_gfininv-M+1:size_gfininv)]; 494 obj.Ginv = inv(gfin_tmp); 496 names = fieldnames(obj.coordinates); 497 for idx = 1:length(names) 498 if strcmp(names{idx}, 'a
') || strcmp(names{idx}, 'b
') 502 array_tmp = obj.coordinates.(names{idx}); 503 if isempty(array_tmp) 506 array_tmp = array_tmp( [1:M, size_gfininv-M+1:size_gfininv]); 507 obj.coordinates.(names{idx}) = array_tmp; 510 % kulso_szabfokok = [1:M, size_gfininv-M+1:size_gfininv]; 511 % [gfininv, coordinates] = ribbon.DecimationFunction( kulso_szabfokok, gfininv, 'coordinates
', coordinates); 520 if isnan(rcond(obj.Ginv) ) || abs( rcond(obj.Ginv) ) < 1e-15 521 obj.G = obj.inv_SVD( obj.Ginv ); 523 obj.G = inv(obj.Ginv); 535 %% createInterfaceRegions 536 %> @brief Creates instances of class Surface_Green_function describing an interface region between the leads and the ribbon parts. The created interface is stored within the attribute Interface_Regions_all. 537 function createInterfaceRegions( obj ) 539 Idx = length(obj.Ribbons) + 1; 540 obj.Interface_Regions_all = cell(Idx,1); 542 % crating the interface region between the leads and the scattring region 543 obj.Interface_Regions_all{1} = obj.Interface_Regions{1}; 544 obj.Interface_Regions_all{Idx} = obj.Interface_Regions{2}; 546 % creating the interface regions between the combined ribbons 547 for idx = 1:length(obj.Ribbons) 548 ribbon_tmp = obj.Ribbons{idx}; 549 if isempty( obj.Interface_Regions_all{idx+1} ) 550 obj.Interface_Regions_all{idx+1} = ribbon_tmp.Scatter_UC.CreateClone(); 552 obj.Ribbons{idx}.setInterfaceRegions( {obj.Interface_Regions_all{idx}, obj.Interface_Regions_all{idx+1}} ); 555 ribbon_tmp = obj.Ribbons{1}; 556 obj.Scatter_UC = ribbon_tmp.Scatter_UC; 557 obj.CreateInterface(1); 558 ribbon_tmp = obj.Ribbons{end}; 559 obj.Scatter_UC = ribbon_tmp.Scatter_UC; 560 obj.CreateInterface(2); 562 % Decimating the interface regions 563 for idx = 2:length(obj.Ribbons) 564 obj.Ribbons{idx}.CreateInterface(1) 572 %> @brief Checks the width of the added ribbon. 573 %> @param ribbon_tmp An instance of class Ribbon 574 %> @return Returns with true if the width of the added ribbon is consitent with the previous ones. 575 function ret = checkwidth( obj, ribbon_tmp ) 577 % checking if the width of the ribbons is equal 578 if isempty(obj.width) 579 obj.width = ribbon_tmp.width; 581 elseif obj.width ~= ribbon_tmp.width 591 end % protected methods 594 methods (Access=private) 598 %> @brief Parses the optional parameters for the class constructor. 599 %> @param varargin Cell array of optional parameters: 600 %> @param 'Ribbons
' Cell array of classes #Ribbon to be combined. 601 function InputParsing( obj, varargin ) 604 p.addParameter('Ribbons
', []); 606 p.parse(varargin{:}); 608 Ribbons = p.Results.Ribbons; 612 for idx = 1:length(Ribbons) 613 ribbon_tmp = Ribbons{idx}; 616 names = properties('Ribbon'); 617 for jdx = 1:length(names); 618 obj.(names{jdx}) = ribbon_tmp.(names{jdx}); 620 obj.Opt = ribbon_tmp.getOpt(); 621 obj.param = ribbon_tmp.param; 623 % checking if the width of the ribbons is equal 624 if obj.checkwidth( ribbon_tmp ) == -1 625 err = MException('CombineRibbons:InputParsing
', 'widths of the ribbons are not identical.
'); 626 save('Error_CombineRibbons_InputParsing.mat
'); 632 obj.addRibbon( ribbon_tmp ); 636 save('Error_CombineRibbons_InputParsing.mat
'); 642 end % private methods A class to calculate the Green functions and self energies of a translational invariant lead.
Structure Opt contains the basic computational parameters used in EQuUs.
Structure open_channels describes the open channel in the individual leads.
A class for calculations on a ribbon of finite width for equilibrium calculations mostly in the zero ...
function Transport(Energy, B)
Calculates the conductance at a given energy value.
function Hamiltonians(varargin)
Function to create the custom Hamiltonians for the 1D chain.
Property Ribbons
the list of the ribbon interface to be combained (Ribbon objects)
Structure param contains data structures describing the physical parameters of the scattering center ...
function gauge_field(x, y, eta_B, Aconst, height, lattice_constant)
Scalar gauge field connecting Landaux and Landauy gauges.
An object for combining multiple ribbon parts of equal width and from the same material in a two term...
function structures(name)