2 % Copyright (C) 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 Examples
20 %> @brief Example to calculate the conductivity through a magnetic barrier.
21 %> @
param filenum The identification number of the filenema
for the exported data (
default is 1).
23 %> EQuUs v4.8 or later
29 %> @brief Example to calculate the conductivity through a magnetic barrier.
30 %> @
param filenum The identification number of the filenema
for the exported data (
default is 1).
33 if ~exist(
'filenum',
'var')
37 filename = mfilename('fullpath');
38 [directory, fncname] = fileparts( filename );
40 % filename containing the input XML
41 inputXML = 'Basic_Input_zigzag_leads.xml';
42 % Parsing the input file and creating data
structures 45 % filename containing the output XML
46 outfilename = [fncname, '_',num2str( filenum )];
50 % width of the junction (number of non-singular
sites in the cross section)
52 % length of the junction (number of unit cells)
55 % creating 1D energy array (in units of eV)
56 % minimum of the energy array
58 % maximum of the energy array
60 %> number of energy points
63 Evec = Emin:(Emax-Emin)/(Enum+1):Emax;
65 % the strength of the magnetic field in Tesla
67 % the cyclotron frequency
69 % class representing the two terminal ribbon structure
73 % The charge of the electron
76 rCC = 1.42*1e-10; %In Angstrom
78 % preallocating the array for the calculated conductance values
79 Conductance = zeros(1,length(Evec));
80 % preallocating the array for the unitarity error
81 DeltaC = zeros(1,length(Evec));
83 % creating output directories
88 % Calculate the transport through the magnetic barrier
91 % plot the calculated results
98 %> @brief Calculates the conductance
101 % find indexes needed to be calculated
102 indexes2calc = find( Conductance == 0 );
105 % perform the transport calculations
106 for idx = 1:length(indexes2calc)
108 % determine the current energy value
109 Energy = Evec(indexes2calc(idx));
111 % creating the
Ribbon class representing the twoterminal setup
114 % calculating dimensionless magnetic field, and the cyclotron frequency
115 phi0 = h/qe; % magnetic flux quantum
116 eta_B = 2*pi/phi0*(rCC)^2*B;
118 homegac = 2.97*sqrt(9/2*eta_B);
121 % Plot the calculated results
122 disp(' ----------------------------------')
123 disp('Plotting conductivity:')
127 % calculating the current conductace
130 disp(' ----------------------------------')
131 disp('Calculating Conductance for the given magentic field')
135 [Conductance_tmp,DeltaC_tmp] =
Transport( Energy, B );
138 % storing the calculated data
139 Conductance(indexes2calc(idx)) = Conductance_tmp;
140 DeltaC(indexes2calc(idx)) = DeltaC_tmp;
143 % exporting the calculated data
144 save( fullfile(outputdir, [outfilename, '.mat']));
145 disp([ num2str(indexes2calc(idx)/length(Evec)*100),' % calculated of the conductance.'])
155 %> @brief Calculates the conductance at a given energy value.
156 %> @
param Energy The energy value.
157 %> @
param B The magnetic field
158 %> @return Returns with teh calculated conductance and the unitarity error.
161 % creating funcfion handles for the magnetic vector potentials
164 % seeting the Energy value in the
Ribbon class
165 cRibbon.setEnergy( Energy )
166 % Calculates the surface Green operator of the scattering region and perform a gauge transformation
167 cRibbon.CalcFiniteGreensFunction( 'gauge_trans', true );
170 Dysonfunc = @()cRibbon.CustomDysonFunc( 'constant_channels', true, 'SelfEnergy', false );
172 % Evaluate the Dyson Eq.
173 cRibbon.FL_handles.DysonEq( 'CustomDyson', Dysonfunc );
175 % Calculating the Scattering matrix
176 S = cRibbon.FL_handles.SmatrixCalc();
178 % Calculate the unitarity error
179 DeltaC = norm(S*S'-eye(size(S)));
181 if DeltaC >= 1e-3 || isnan(DeltaC)
182 disp( ['error of the unitarity of S-matrix: ',num2str(DeltaC)] )
186 % Calculate the conductance
188 Conductance = cRibbon.FL_handles.Conduktance();
189 Conductance = Conductance(1,2);
197 disp( ['E = ', num2str(Energy), ' conductance = ', num2str(Conductance)])
203 %> @brief Creates and set
function handles of the magnetic vector potentials in the
Ribbon class
204 %> @
param B The magnetic field
212 %> @brief Creates the
function handles of the magnetic vector potentials and the gauge field
213 %> @
param B The magnetic field
214 %> @return [1] Function
handle of the vector potential in the leads .
215 %> @return [2] Function
handle of the vector potential in the scattering region.
216 %> @return [3] Function
handle of the scalar potential that transforms vector potential in the scattering center into a vector potential in the leads.
221 % calculating the diemnsionless strength of the magnetic field
222 eta_B = 2*pi/phi0*(rCC)^2*B;
223 % constant vector potential in the systems: stabilizes the numerical computation
226 % lattice constant in zigzag edged graphene riibon is sqrt(3)*rCC
227 lattice_constant = sqrt(3);
229 % creting the funciton handles of the vector potentials
230 hLead = @(x,y)(
Landaux(x,y, eta_B, Aconst, height, lattice_constant));
231 hScatter = @(x,y)(
Landauy(x,y, eta_B));
232 hgauge_field = @(x,y)(
gauge_field(x,y, eta_B, Aconst, height, lattice_constant));
238 %> @brief Sets output directory.
240 resultsdir = 'results';
242 outputdir = [ resultsdir ];
248 %> @brief Creates the plot
252 % creating figure in units of pixels
253 figure1 = figure( 'Units', 'Pixels', 'Visible', 'off');
255 % font size on the figure will be 16 points
258 % determine points to be plotted
259 indexek = logical( (abs(DeltaC) <= 0.5) & (Evec~=0) & ~isnan(DeltaC) );
261 % setting the limits of the x axis
262 x_lim = [min(Evec(indexek)) max(Evec(indexek))];
268 % creating axes of the plot
269 axes_cond = axes('Parent',figure1, ...
271 'FontSize', fontsize,...
274 'Units', 'Pixels', ...
275 'FontName','Times New Roman');
279 plot(Evec(indexek), Conductance(indexek), 'Linewidth', 2, 'color', [0 0 0], 'Parent', axes_cond);
280 plot(Evec(indexek), DeltaC(indexek), 'Linewidth', 1, 'color', [0 1 0], 'Parent', axes_cond);
282 % setting the cyclotron frequencies in the plot
284 nmax = round( (Emax/homegac)^2 );
286 for idx = 1:length(nvec)
287 plot(sqrt([nvec(idx), nvec(idx)])*homegac, [0 max(Conductance(indexek))], 'Linewidth', 0.5, 'color', [0 0 1], 'Parent', axes_cond);
293 xlabel('E [ev]','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_cond);
296 ylabel('\sigma/\sigma_0','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_cond);
299 fig_legend = legend(axes_cond, {
'conductance',
'unitarity error'});%,
'FontSize', fontsize,
'FontName',
'Times New Roman')
300 set(fig_legend,
'FontSize', fontsize,
'FontName',
'Times New Roman',
'Box',
'off',
'Location',
'NorthEast')
302 % setting the position and margins of the plot, removing white
303 % spaces
for release dates greater than 2015
304 ver = version(
'-release');
305 if str2num(ver(1:4)) >= 2016
306 figure1.PaperPositionMode =
'auto';
307 fig_pos = figure1.PaperPosition;
308 figure1.PaperSize = [fig_pos(3) fig_pos(4)];
310 set(axes_cond, 'Position', get(axes_cond, 'OuterPosition') - get(axes_cond, 'TightInset') * [-1 0 1 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1]);
311 Position_figure = get(axes_cond, 'OuterPosition');
312 set(figure1, 'Position', Position_figure);
316 print('-depsc2', fullfile(outputdir,[outfilename, '.eps']))
317 print('-dpdf', fullfile(outputdir,[outfilename, '.pdf']))
function PlotFunction()
Creates the plot.
function Landaux(x, y, eta_B, Aconst, height, lattice_constant)
Vector potential in the Landau gauge parallel to the x direction.
Structure Opt contains the basic computational parameters used in EQuUs.
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 createVectorPotential(B)
Creates the function handles of the magnetic vector potentials and the gauge field.
function Landauy(x, y, eta_B)
Vector potential in the Landau gauge parallel to the y direction.
function magnetic_barrier(filenum)
Example to calculate the conductivity through a magnetic barrier.
function CreateHandlesForMagneticField(B)
Creates and set function handles of the magnetic vector potentials in the Ribbon class.
Structure param contains data structures describing the physical parameters of the scattering center ...
Structure sites contains data to identify the individual sites in a matrix.
function CalculateTransport()
number of energy points
function gauge_field(x, y, eta_B, Aconst, height, lattice_constant)
Scalar gauge field connecting Landaux and Landauy gauges.
function setOutputDir()
Sets output directory.
function structures(name)