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:
17 %> @addtogroup basic Basic Functionalities
20 %> @brief A
class responsible
for the
Peierls and gauge transformations.
22 %> @brief A
class responsible for the
Peierls and gauge transformations.
26 properties ( Access =
protected )
27 %> String containing the name of the built-in gauge (
'LandauX',
'LandauY').
29 %> The strength of the magnetic field
for the built-in vector potentials.
31 %> Function
handle A = f( x,y) of the vector potential to be used in the calculations (A is a N x 2 vector, where N is the number of the points given by the x and y coordinates.)
37 methods ( Access =
public )
39 %% Contructor of the
class 40 %> @brief Constructor of the
class.
42 %> @
param varargin Cell array of optional parameters. For details see #InputParsing.
43 %> @
return An instance of the
class 47 obj.gauge = []; %
'LandauX',
'LandauY' gauges or []
for load from input files
48 obj.eta = 0; % eta_B = 2*pi/phi0*(rCC)^2*B;
49 obj.Vectorpotential = [];
51 obj.InputParsing( varargin{:} );
53 if isfield( obj.Opt,
'eta' )
54 obj.eta = obj.
Opt.eta;
60 if isempty( obj.Vectorpotential )
61 if isfield( obj.
Opt, 'gauge' )
62 obj.gauge = obj.
Opt.gauge;
66 obj.Vectorpotential = obj.CreateHandleForVectorpotential();
71 %% PeierlsTransformLeads
73 %> @
param Lead An instance of class
#CreateLeadHamiltonians (or a derived class) 74 function PeierlsTransformLeads( obj,
Lead )
76 if ~strcmpi(
class(
Lead),
'CreateLeadHamiltonians' )
77 supClasses = superclasses(
Lead);
79 error(['EQuUs:', class(obj.junction), ':PeierlsTransformLeads'], 'Input
Lead is not valid.');
83 if
Lead.Read( 'MagneticFieldApplied' )
84 obj.display(['EQuUs:',class(obj),':PeierlsTransformLeads: Magnetic field already applied in the
Hamiltonians']);
88 if isempty(obj.Vectorpotential)
89 obj.display(['EQuUs:',class(obj),':PeierlsTransformLeads: Vectorpotential is not set.']);
94 if ~
Lead.Read( 'HamiltoniansCreated' ) ||
Lead.Read( 'HamiltoniansDecimated' )
95 err = MException(['EQuUs:',class(obj),':PeierlsTransformLeads'], '
Hamiltonians in
Lead are not created, or they are decimated. Thus, unable to perform
Peierls transformation.');
96 save('Error_Peierls_PeierlsTransformLeads.mat');
100 H0 =
Lead.Read( 'H0' );
102 H1 =
Lead.Read( 'H1' );
104 H1_transverse =
Lead.Read( 'H1_transverse' );
105 Lead.Clear( 'H1_transverse' );
108 H0_size = size(H0,1)/2;
109 mtx_pair_potential = H0( 1:H0_size, H0_size+1:2*H0_size);
110 H0 = H0( 1:H0_size, 1:H0_size);
111 H1 = H1( 1:H0_size, 1:H0_size);
112 if ~isempty(H1_transverse)
113 H1_transverse = H1_transverse( 1:H0_size, 1:H0_size);
116 if norm(mtx_pair_potential,1) >= 1e-6
117 error( ['EQuUs:',class(obj),':PeierlsTransformLeads'], 'The peierls transformation with nonzero B is forbidden in the superconducting phase. Set the pair potential to zero, or use gauge transformation instead.')
118 mtx_pair_potential = mtx_pair_potential*0;
123 coordinates =
Lead.Read( 'coordinates' );
127 [sor_idx,oszlop_idx,elements] = find(H0);
129 startpoint = [coordinates.x( oszlop_idx ), coordinates.y( oszlop_idx )];
130 endpoint = [coordinates.x( sor_idx ), coordinates.y( sor_idx )];
131 fazis = obj.Peierls_phase(startpoint,endpoint);
133 fazis_mtx_H0 = sparse(sor_idx,oszlop_idx,fazis,size(H0,1), size(H0,2) );
134 elements = exp(1i*fazis).*elements;
135 H0 = sparse(sor_idx,oszlop_idx,elements,size(H0,1), size(H0,2) );
137 Lead.Write( 'fazis_mtx_H0', fazis_mtx_H0);
140 %
Peierls in the coupling of unit cells
141 [sor_idx,oszlop_idx,elements] = find(H1);
142 orientation =
Lead.Read('Lead_Orientation');
143 Hanyadik_Lead =
Lead.Read('Hanyadik_Lead' );
144 if orientation == 1 && ~isempty( Hanyadik_Lead )
145 startpoint = [coordinates.x( oszlop_idx ) , coordinates.y( oszlop_idx )];
146 endpoint = [coordinates.x( sor_idx ) - coordinates.a(1), coordinates.y( sor_idx ) - coordinates.a(2)];
148 startpoint = [coordinates.x( oszlop_idx ) + coordinates.a(1), coordinates.y( oszlop_idx ) + coordinates.a(2)];
149 endpoint = [coordinates.x( sor_idx ), coordinates.y( sor_idx )];
151 fazis = obj.Peierls_phase(startpoint,endpoint);
153 fazis_mtx_H1 = sparse(sor_idx,oszlop_idx,fazis,size(H1,1), size(H1,2) );
154 elements = exp(1i*fazis).*elements;
155 H1 = sparse(sor_idx,oszlop_idx,elements,size(H1,1), size(H1,2) );
157 Lead.Write( 'fazis_mtx_H1', fazis_mtx_H1);
160 %
Peierls in the transverse coupling of unit cells
161 if ~isempty(H1_transverse)
162 [sor_idx,oszlop_idx,elements] = find(H1_transverse);
163 startpoint = [coordinates.x( oszlop_idx ) + coordinates.b(1), coordinates.y( oszlop_idx ) + coordinates.b(2)];
164 endpoint = [coordinates.x( sor_idx ), coordinates.y( sor_idx )];
165 fazis = obj.Peierls_phase(startpoint,endpoint);
167 fazis_mtx_H1t = sparse(sor_idx,oszlop_idx,fazis,size(H1_transverse,1), size(H1_transverse,2) );
168 elements = exp(1i*fazis).*elements;
169 H1_transverse = sparse(sor_idx,oszlop_idx,elements,size(H1_transverse,1), size(H1_transverse,2) );
171 Lead.Write( 'fazis_mtx_H1t', fazis_mtx_H1t);
177 H0 = [H0, mtx_pair_potential; mtx_pair_potential', -conj(H0)];
178 H1 = [H1, zeros(size(H1)); zeros(size(H1')), -conj(H1)];
179 H1_transverse = [H1_transverse, zeros(size(H1_transverse)); zeros(size(H1_transverse')), -conj(H1_transverse)];
183 Lead.Write( 'H0', H0 );
184 Lead.Write( 'H1', H1 );
185 Lead.Write( 'H1adj', H1' );
186 Lead.Write( 'H1_transverse', H1_transverse );
187 Lead.Write( 'MagneticFieldApplied', 1 );
188 %Surface_tmp.Write( 'q', q);
194 %> @brief Algorithm to perform
Peierls transformation in Hamiltonian stored in the
#CreateHamiltonians object. 196 function PeierlsTransform( obj, CreateH )
199 supClasses = superclasses(CreateH);
200 if sum( strcmp( supClasses,
'CreateHamiltonians' ) ) == 0
201 error([
'EQuUs:',
class(obj.junction),
':PeierlsTransform'],
'Input CreateH is not valid.');
205 if CreateH.Read(
'MagneticFieldApplied' )
206 obj.display([
'EQuUs:',
class(obj),
':PeierlsTransform: Magnetic field already applied in the Hamiltonians'], 1);
210 if isempty(obj.Vectorpotential)
211 obj.
display(['EQuUs:',class(obj),':PeierlsTransform: Vectorpotential is not set.']);
216 err = MException(['EQuUs:',class(obj),':PeierlsTransform'], '
Hamiltonians in are not created, or they are decimated. Thus, unable to perform
Peierls transformation.');
217 save('Error_Peierls_PeierlsTransform.mat');
223 Hamiltoni = CreateH.
Read( NameOfH );
224 Hamiltoni_transverse = CreateH.
Read( NameOfH_transverse );
225 CreateH.
Clear( NameOfH );
226 CreateH.
Clear( NameOfH_transverse );
232 if ~isempty(Hamiltoni_transverse)
238 if norm(mtx_pair_potential,1) >= 1e-6
239 error( 'The peierls transformation with nonzero B is forbidden in the superconducting phase. Set the pair potential to zero, or use gauge transformation instead.')
240 mtx_pair_potential = mtx_pair_potential*0;
245 %
Peierls in the scattering region
246 [sor_idx,oszlop_idx,elements] = find(Hamiltoni);
249 fazis = obj.Peierls_phase(startpoint,endpoint);
251 fazis_mtx = sparse(sor_idx,oszlop_idx,fazis,size(Hamiltoni,1), size(Hamiltoni,2) );
252 elements = exp(1i*fazis).*elements;
253 Hamiltoni = sparse(sor_idx,oszlop_idx,elements,size(Hamiltoni,1), size(Hamiltoni,2) );
258 %
Peierls in the transverse coupling of the scattering region
259 if ~isempty(Hamiltoni_transverse)
260 [sor_idx,oszlop_idx,elements] = find(Hamiltoni_transverse);
263 fazis = obj.Peierls_phase(startpoint,endpoint);
265 fazis_mtx_t = sparse(sor_idx,oszlop_idx,fazis,size(Hamiltoni_transverse,1), size(Hamiltoni_transverse,2) );
266 elements = exp(1i*fazis).*elements;
267 Hamiltoni_transverse = sparse(sor_idx,oszlop_idx,elements,size(Hamiltoni_transverse,1), size(Hamiltoni_transverse,2) );
274 Hamiltoni_tmp = sparse([],[],[], size(Hamiltoni,1)*2, size(Hamiltoni,2)*2 );
275 Hamiltoni_transverse_tmp = sparse([],[],[], size(Hamiltoni_transverse,1)*2, size(Hamiltoni_transverse,2)*2 );
281 if ~isempty(Hamiltoni_transverse)
286 Hamiltoni = Hamiltoni_tmp;
287 Hamiltoni_transverse = Hamiltoni_transverse_tmp;
290 CreateH.
Write( NameOfH, Hamiltoni );
291 CreateH.
Write( NameOfH_transverse, Hamiltoni_transverse );
293 %Way2Hamiltonian.
Write( '
q',
q);
296 %% gaugeTransformation
297 %> @brief Algorithm to perform gauge transformation on Green's
function and/or on Hamiltonian.
298 %> @
param mtx The matrix of the Green's
function or the Hamiltonian.
299 %> @
param coordinates An instance of structure
#coordinates containing the site coordinates 300 %> @
param gauge_field Function
handle S = f( x,y) of the gauge transformation. (S is a N x 1 vector, where N is the number of the points given by the x and y
coordinates.)
301 %> @
return Returns with the transformaed matrix.
310 mtx_size = size(mtx,1);
312 warning( [
'EQuUs:',
class(obj.junction),
':gaugeTransformation'],
'The coordinates and matrix elements do not correspond to each other.' )
316 % "u" and "v" like components must be transformed differently in BdG theory
330 ret = Umtx * mtx * Umtx';
334 %% gaugeTransformationOnLead
335 %> @brief Algorithm to perform gauge transformation in the
Hamiltonians of a lead. The transformed matrices are stored within the input class.
336 %> @
param Lead An instance of class
#CreateLeadHamiltonians (or a derived class) 337 %> @
param gauge_field Function
handle S = f( x,y) of the gauge transformation. (S is a N x 1 vector, where N is the number of the points given by the x and y
coordinates.)
340 if ~strcmpi(
class(
Lead),
'CreateLeadHamiltonians' )
341 supClasses = superclasses(
Lead);
343 error(['EQuUs:', class(obj.junction), ':gaugeTransformationOnLead'], 'Input
Lead is not valid.');
359 orientation =
Lead.
Read('Lead_Orientation');
360 Hanyadik_Lead =
Lead.
Read('Hanyadik_Lead' );
363 if orientation == 1 && ~isempty( Hanyadik_Lead )
373 H0size = size(H0, 1);
379 H_tmp = [H0,H1;H1adj,H0];%
380 H_tmp = obj.gaugeTransformation( H_tmp, coordinates_tmp,
gauge_field );
383 H0 = H_tmp(1:H0size,1:H0size);
384 H1 = H_tmp(1:H0size,H0size+1:end);
385 H1adj = H_tmp(H0size+1:end,1:H0size);
391 % gauge transformation of the transverse H1
392 H1_transverse =
Lead.
Read('H1_transverse');
397 H_tmp = [sparse([],[],[],size(H1_transverse,2), size(H1_transverse,1)), H1_transverse; ...
398 H1_transverse', sparse([],[],[],size(H1_transverse,1), size(H1_transverse,2))];
400 H_tmp = obj.gaugeTransformation( H_tmp, coordinates_tmp,
gauge_field );
401 H1_transverse = H_tmp( 1:size(H1_transverse,2), size(H1_transverse,1)+1:end );
402 Lead.
Write( 'H1_transverse', H1_transverse);
406 %gauge transformation of the transverse momentum
407 %
q = Surface_tmp.
Read('
q');
408 % identity_mtx = sparse(1:size(H1_transverse,1),1:size(H1_transverse,1),1, size(H1_transverse,1), size(H1_transverse,2) );
413 % H_tmp = [sparse([],[],[],size(identity_mtx,2), size(identity_mtx,1)), identity_mtx; ...
414 % identity_mtx', sparse([],[],[],size(identity_mtx,1), size(identity_mtx,2))];
416 % H_tmp = gaugeTransformation( H_tmp, coordinates_tmp,
gauge_field );
417 % identity_mtx = H_tmp( 1:size(H1_transverse,2), size(H1_transverse,1)+1:end );
418 %
q =
q - angle( diag(identity_mtx) );
429 %> @brief Creates a clone of the present
object.
430 %> @return Returns with the cloned
object.
433 'Vectorpotential', obj.Vectorpotential);
437 %% setVectorPotential
438 %> @brief Use to set the
handle for the vector potential.
439 %> @
param vectorpot Function
handle A = f( x,y) of the vector potential to be used in the calculations (A is a N x 2 vector, where N is the number of the points given by the x and y
coordinates.)
440 function setVectorPotential( obj, vectorpot )
441 obj.Vectorpotential = vectorpot;
448 methods ( Access = protected )
451 %> @brief Calculates the
Peierls phase along bonds.
454 %> @return Returns with the peierls phases
455 function fazis = Peierls_phase(obj, startpoint, endpoint)
457 if obj.
Opt.Linear_Regression_in_B
458 A1 = obj.Vectorpotential(startpoint(:,1),startpoint(:,2));
459 A2 = obj.Vectorpotential(endpoint(:,1),endpoint(:,2));
460 fazis = 0.5*(A1(:,1)+A2(:,1)).*(endpoint(:,1)-startpoint(:,1)) + 0.5*(A1(:,2)+A2(:,2)).*(endpoint(:,2)-startpoint(:,2));
464 % the following is not vectorized, and is obsolete !!!! TODO
465 fazis = zeros( size(startpoint,1), 1);
466 for idx = 1:length(fazis)
467 if ~(startpoint(1) == endpoint(1))
468 dx = (endpoint(idx,1)-startpoint(idx,1))/100;
469 int_array = startpoint(idx,1):dx:endpoint(idx,1);
470 Ind = max(size(int_array));
475 A_temp = obj.Vectorpotential(x, y_temp(x,startpoint(idx,:),endpoint(idx,:)));
479 fazis(idx) = trapz(int_array,A);
483 if obj.
Opt.my_own_potential
484 fazis = zeros( size(startpoint,1), 1);
485 for idx = 1:length(fazis)
486 if ~(startpoint(idx,2) == endpoint(idx,2) )
487 dy = (endpoint(idx,2)-startpoint(idx,2))/100;
488 int_array = startpoint(idx,2):dy:endpoint(idx,2);
489 Ind = max(size(int_array));
494 A_temp = obj.Vectorpotential(x_temp(y,startpoint(idx,:),endpoint(idx,:)), y);
498 fazis(idx) = fazis(idx) + trapz(int_array,A);
503 function x = x_temp(y,startpoint,endpoint)
504 x = endpoint(1) + (startpoint(1)-endpoint(1))/(endpoint(2)-startpoint(2))*(endpoint(2)-y);
506 function y = y_temp(x,startpoint,endpoint)
507 y = endpoint(2) + (startpoint(2)-endpoint(2))/(endpoint(1)-startpoint(1))*(endpoint(1)-x);
511 %% CreateHandleForVectorpotential
512 %> @brief Creates
function handles for in-built Vector potentials in a gauge given by attribute
#Opt.gauge. 513 %> @
return Returns A
function handle 514 function HandleForA = CreateHandleForVectorpotential( obj )
517 if ~isempty( obj.gauge )
518 if strcmpi( obj.gauge, 'LandauX' )
519 HandleForA = @(x,y)([-obj.eta*y;0]);
520 elseif strcmpi( obj.gauge, 'LandauY' )
521 HandleForA = @(x,y)([0;obj.eta*x]);
532 end % methods protected
536 methods ( Access = protected )
540 %> @brief Parses the optional parameters for the class constructor.
542 %> @
param 'Vectorpotential' Function
handle A = f( x,y) of the vector potential to be used in the calculations (A is a N x 2 vector, where N is the number of the points given by the x and y
coordinates.)
544 p_validating = inputParser;
545 p_validating.addParameter('Vectorpotential', []);
548 obj.Vectorpotential = p_validating.Results.Vectorpotential;
553 end % methods
private function InputParsing(varargin)
Parses the optional parameters for the class constructor.
function CreateClone(varargin)
Creates a clone of the present class.
Property HamiltoniansCreated
A logical value. True if the Hamiltonian was created, false otherwise.
A class containing methodes for displaying several standard messages.
function Write(MemberName, input)
Sets the value of an attribute in the class.
Structure Opt contains the basic computational parameters used in EQuUs.
Class to create and store Hamiltonian of the translational invariant leads.
Property MagneticFieldApplied
A logical value. True if the vector potential was incorporated into the Hamiltonian or false otherwis...
function display(message, nosilent)
Displays output messages on the screen.
Property coordinates
An instance of the structure coordinates.
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 q
A transverse momentum.
Property fazis_mtx_scatter
The matrix of the Peierls phases.
function Clear(MemberName)
Clears the value of an attribute in the class.
A class to calculate the Green functions and self energies of a translational invariant lead The nota...
Property varargin
list of optional parameters (see http://www.mathworks.com/help/matlab/ref/varargin....
Structure param contains data structures describing the physical parameters of the scattering center ...
Property Hscatter_transverse
The matrix of the Hamiltonian corresponding to the transverse coupling.
Property Hscatter
The matrix of the Hamiltonian.
A class responsible for the Peierls and gauge transformations.
Property GaugeTransformationApplied
A logical value. True if a gauge transformation was applied on the Hamiltonians, or false otherwise.
Property HamiltoniansDecimated
A logical value. True if the Hamiltonian was decimated, or false otherwise.
function gauge_field(x, y, eta_B, Aconst, height, lattice_constant)
Scalar gauge field connecting Landaux and Landauy gauges.
Property fazis_mtx_scatter_t
The matrix of the Peierls phases for the transverse coupling.
Structure containing the coordinates and other quantum number identifiers of the sites in the Hamilto...
function Read(MemberName)
Query for the value of an attribute in the class.
function structures(name)
A class to create and store Hamiltonian of the scattering region.