Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
magnetic_barrier.m
Go to the documentation of this file.
1 % Transport through magnetic barrier
2 % Copyright (C) 2015 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 Examples
18 %> @{
19 %> @file magnetic_barrier.m
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).
22 %> @Available
23 %> EQuUs v4.8 or later
24 %> @expectedresult
25 %> @image html magnetic_barrier.jpg
26 %> @image latex magnetic_barrier.jpg
27 %> @}
28 %
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).
31 function magnetic_barrier( filenum )
32 
33 if ~exist('filenum', 'var')
34  filenum = 1;
35 end
36 
37 filename = mfilename('fullpath');
38 [directory, fncname] = fileparts( filename );
39 
40  % filename containing the input XML
41  inputXML = 'Basic_Input_zigzag_leads.xml';
42  % Parsing the input file and creating data structures
43  [Opt, param] = parseInput( fullfile( directory, inputXML ) );
44 
45  % filename containing the output XML
46  outfilename = [fncname, '_',num2str( filenum )];
47  % the output folder
48  outputdir = [];
49 
50  % width of the junction (number of non-singular sites in the cross section)
51  width = 160;
52  % length of the junction (number of unit cells)
53  height = 300;
54 
55  % creating 1D energy array (in units of eV)
56  % minimum of the energy array
57  Emin = 0.001;
58  % maximum of the energy array
59  Emax = 0.6;
60  %> number of energy points
61  Enum = 200;
62  % the energy array
63  Evec = Emin:(Emax-Emin)/(Enum+1):Emax;
64 
65  % the strength of the magnetic field in Tesla
66  B = 40e-0;
67  % the cyclotron frequency
68  homegac = [];
69  % class representing the two terminal ribbon structure
70  cRibbon = [];
71  % Planck contant
72  h = 6.626e-34;
73  % The charge of the electron
74  qe = 1.602e-19;
75  % atomic distance
76  rCC = 1.42*1e-10; %In Angstrom
77 
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));
82 
83  % creating output directories
84  setOutputDir();
85 
86 
87 
88  % Calculate the transport through the magnetic barrier
90 
91  % plot the calculated results
92  PlotFunction();
93 
94 
95 
96 
98 %> @brief Calculates the conductance
100 
101  % find indexes needed to be calculated
102  indexes2calc = find( Conductance == 0 );
103 
104 
105  % perform the transport calculations
106  for idx = 1:length(indexes2calc)
107 
108  % determine the current energy value
109  Energy = Evec(indexes2calc(idx));
110 
111  % creating the Ribbon class representing the twoterminal setup
112  cRibbon = Ribbon('Opt', Opt, 'param', param, 'width', width, 'height', height );
113 
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;
117  if B>1e-8
118  homegac = 2.97*sqrt(9/2*eta_B);
119  end
120 
121  % Plot the calculated results
122  disp(' ----------------------------------')
123  disp('Plotting conductivity:')
124  PlotFunction();
125 
126 
127  % calculating the current conductace
128  disp(' ')
129  disp(' ')
130  disp(' ----------------------------------')
131  disp('Calculating Conductance for the given magentic field')
132 
133 
134  tic
135  [Conductance_tmp,DeltaC_tmp] = Transport( Energy, B );
136  toc
137 
138  % storing the calculated data
139  Conductance(indexes2calc(idx)) = Conductance_tmp;
140  DeltaC(indexes2calc(idx)) = DeltaC_tmp;
141 
142 
143  % exporting the calculated data
144  save( fullfile(outputdir, [outfilename, '.mat']));
145  disp([ num2str(indexes2calc(idx)/length(Evec)*100),' % calculated of the conductance.'])
146  disp( ' ' )
147 
148 
149 
150  end
151 
152  end
153 
154 %% Transport
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.
159  function [Conductance,DeltaC] = Transport( Energy, B )
160 
161  % creating funcfion handles for the magnetic vector potentials
163 
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 );
168 
169  % creating function handle for the Dyson Eq.
170  Dysonfunc = @()cRibbon.CustomDysonFunc( 'constant_channels', true, 'SelfEnergy', false );
171 
172  % Evaluate the Dyson Eq.
173  cRibbon.FL_handles.DysonEq( 'CustomDyson', Dysonfunc );
174 
175  % Calculating the Scattering matrix
176  S = cRibbon.FL_handles.SmatrixCalc();
177 
178  % Calculate the unitarity error
179  DeltaC = norm(S*S'-eye(size(S)));
180 
181  if DeltaC >= 1e-3 || isnan(DeltaC)
182  disp( ['error of the unitarity of S-matrix: ',num2str(DeltaC)] )
183  end
184 
185 
186  % Calculate the conductance
187  try
188  Conductance = cRibbon.FL_handles.Conduktance();
189  Conductance = Conductance(1,2);
190  catch
191  Conductance = NaN;
192  DeltaC = NaN;
193 
194  return
195  end
196 
197  disp( ['E = ', num2str(Energy), ' conductance = ', num2str(Conductance)])
198 
199  end
200 
201 
203 %> @brief Creates and set function handles of the magnetic vector potentials in the Ribbon class
204 %> @param B The magnetic field
206  [hLead, hScatter, gauge_field ] = createVectorPotential( B );
207  cRibbon.setHandlesForMagneticField('scatter', hScatter, 'lead', hLead, 'gauge_field', gauge_field );
208  end
209 
210 
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.
217  function [hLead, hScatter, hgauge_field ] = createVectorPotential( B )
218 
219  phi0 = h/qe;
220 
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
224  Aconst = 0.1;
225 
226  % lattice constant in zigzag edged graphene riibon is sqrt(3)*rCC
227  lattice_constant = sqrt(3);
228 
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));
233 
234  end
235 
236 
237 %% setOutputDir
238 %> @brief Sets output directory.
240  resultsdir = 'results';
241  mkdir(resultsdir );
242  outputdir = [ resultsdir ];
243  end
244 
245 
246 
247 %% PlotFunction
248 %> @brief Creates the plot
250 
251 
252  % creating figure in units of pixels
253  figure1 = figure( 'Units', 'Pixels', 'Visible', 'off');
254 
255  % font size on the figure will be 16 points
256  fontsize = 16;
257 
258  % determine points to be plotted
259  indexek = logical( (abs(DeltaC) <= 0.5) & (Evec~=0) & ~isnan(DeltaC) );
260 
261  % setting the limits of the x axis
262  x_lim = [min(Evec(indexek)) max(Evec(indexek))];
263 
264  if norm(x_lim) == 0
265  x_lim = [0 1];
266  end
267 
268  % creating axes of the plot
269  axes_cond = axes('Parent',figure1, ...
270  'Visible', 'on',...
271  'FontSize', fontsize,...
272  'xlim', x_lim,...
273  'Box', 'on',...
274  'Units', 'Pixels', ...
275  'FontName','Times New Roman');
276  hold on;
277 
278  % plot the data
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);
281 
282  % setting the cyclotron frequencies in the plot
283  if ~isempty(homegac)
284  nmax = round( (Emax/homegac)^2 );
285  nvec = 1:nmax;
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);
288  end
289  end
290 
291 
292  % Create xlabel
293  xlabel('E [ev]','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_cond);
294 
295  % Create ylabel
296  ylabel('\sigma/\sigma_0','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_cond);
297 
298  % set the legends
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')
301 
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)];
309 
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);
313  end
314 
315  % export the figures
316  print('-depsc2', fullfile(outputdir,[outfilename, '.eps']))
317  print('-dpdf', fullfile(outputdir,[outfilename, '.pdf']))
318  close(figure1);
319 
320 
321  end
322 
323 
324 
325 
326 end
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.
Definition: structures.m:60
A class for calculations on a ribbon of finite width for equilibrium calculations mostly in the zero ...
Definition: Ribbon.m:34
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.
function()
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
Structure sites contains data to identify the individual sites in a matrix.
Definition: structures.m:187
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 parseInput(filename)
This function parses the input file containing the input parameters.
function setOutputDir()
Sets output directory.
function structures(name)