Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
magnetic_ribbon.m
Go to the documentation of this file.
1 % Transport through graphene ribbon in magnetic field - Based on EQuUs v4.7
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 Examples
18 %> @{
19 %> @file magnetic_ribbon.m
20 %> @brief Example to calculate the conductivity through a ribbon in a magnetic field.
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_ribbon.jpg
26 %> @image latex magnetic_ribbon.jpg
27 %> @}
28 %
29 %
30 %> @brief Example to calculate the conductivity through a ribbon in a magnetic field.
31 %> @param filenum The identification number of the filenema for the exported data (default is 1).
32 function magnetic_ribbon( filenum )
33 
34 if ~exist('filenum', 'var')
35  filenum = 1;
36 end
37 
38 filename = mfilename('fullpath');
39 [directory, fncname] = fileparts( filename );
40 
41  %> filename containing the input XML
42  inputXML = 'Basic_Input_zigzag_leads.xml';
43  %> Parsing the input file and creating data structures
44  [Opt, param] = parseInput( fullfile( directory, inputXML ) );
45 
46  %> filename containing the output XML
47  outfilename = [fncname, '_',num2str( filenum )];
48  %> the output folder
49  outputdir = [];
50 
51  %> length of the junction (number of unit cells)
52  height = 300;
53  % width of the junction
54  width = 200;
55 
56  % creating 1D energy array (in units of eV)
57  % minimum of the energy array
58  Emin = 0.001;
59  % maximum of the energy array
60  Emax = 0.6;
61  %> number of energy points
62  Enum = 200;
63  % the energy array
64  Evec = Emin:(Emax-Emin)/(Enum+1):Emax;
65 
66  % the strength of the magnetic field in Tesla
67  B = 40e-0; %in Tesla
68  % the cyclotron frequency
69  homegac = [];
70 
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 
79  % preallocating the array for the calculated conductance values
80  Conductance = zeros(1,length(Evec));
81  % preallocating the array for the unitarity errors
82  DeltaC = zeros(1,length(Evec));
83  % preallocating the array for the difference between the calculations using the self energies and the surface Green function
84  Difference = zeros(1,length(Evec));
85  % class representing the two terminal ribbon structure
86  cRibbon = [];
87 
88  %> creating output directories
89  setOutputDir();
90 
91  %> Calculate the transport through the magnetic barrier
93 
94  %> plot the calculated results
95  PlotFunction();
96 
97 
98 
99 
101 %> @brief Calculates the conductance values
103 
104  for idx = 1:length(Evec)
105  % determine the current energy value
106  Energy = Evec(idx);
107 
108  %> creating the Ribbon class representing the twoterminal setup
109  cRibbon = Ribbon('width', width, 'height', height, 'Opt', Opt, 'param', param, 'filenameOut', fullfile( outputdir, [outfilename, '.xml']) );
110 
111  % calculating dimensionless magnetic field, and the cyclotron frequency
112  phi0 = h/qe; % magnetic flux quantum
113  eta_B = 2*pi/phi0*(rCC)^2*B;
114  if B>1e-8
115  homegac = 2.97*sqrt(9/2*eta_B);
116  end
117 
118  % Plot the calculated results
119  disp(' ----------------------------------')
120  disp('Plotting conductivity:')
121  PlotFunction();
122 
123  % calculating the current conductace
124  disp(' ')
125  disp(' ')
126  disp(' ----------------------------------')
127  disp('Calculating Conductance for the given magentic field')
128 
129 
130  tic
131  [Conductance_tmp,DeltaC_tmp] = Transport( Energy, B, false );
132  [Conductance_tmp_selfEnergy] = Transport( Energy, B, true );
133  toc
134 
135  % storing the calculated data
136  Conductance(idx) = Conductance_tmp;
137  DeltaC(idx) = DeltaC_tmp;
138  Difference(idx) = Conductance_tmp - Conductance_tmp_selfEnergy;
139 
140 
141  % exporting the calculated data
142  save( fullfile(outputdir,[outfilename, '.mat']) );
143  disp([ num2str(idx/length(Evec)*100),' % calculated of the conductance.'])
144  disp( ' ' )
145 
146  end
147 
148  end
149 
150 %% Transport
151 %> @brief Calculates the conductance for a given energy
152 %> @param Energy The energy value.
153 %> @param B The magnetic field
154 %> @param selfEnergy Logical value. Set true to use the self energy in the calculations or false to use the surface Green operator.
155  function [Conductance,DeltaC] = Transport( Energy, B, selfEnergy )
156 
157  % creating funcfion handles for the magnetic vector potentials
159 
160  % seeting the Energy value in the Ribbon class
161  cRibbon.setEnergy( Energy )
162 
163  % Calculates the surface Green operator of the scattering region
164  cRibbon.CalcFiniteGreensFunction();
165 
166  % creating function handle for the Dyson Eq.
167  Dysonfunc = @()cRibbon.CustomDysonFunc( 'constant_channels', false, 'SelfEnergy', selfEnergy );
168 
169  % Evaluate the Dyson Eq.
170  cRibbon.FL_handles.DysonEq( 'CustomDyson', Dysonfunc );
171 
172  % Calculating the Scattering matrix
173  [S,open_channels] = cRibbon.FL_handles.SmatrixCalc();
174 
175  % Calculate the unitarity error
176  DeltaC = norm(S*S'-eye(sum(open_channels)));
177 
178  if DeltaC >= 1e-3 || isnan(DeltaC)
179  disp( ['error of the unitarity of S-matrix: ',num2str(DeltaC)] )
180  end
181 
182  if open_channels(1) ~= open_channels(2)
183  disp( 'openchannels do not match' )
184  end
185 
186  % Calculate the conductance
187  try
188  conductance = cRibbon.FL_handles.Conduktance();
189  catch
190  Conductance = NaN;
191  DeltaC = NaN;
192  return
193  end
194 
195  Conductance = conductance(1,2);
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  hLandauy = createVectorPotential( B );
207  cRibbon.setHandlesForMagneticField('scatter', hLandauy, 'lead', hLandauy );
208  end
209 
210 
212 %> @brief Creates the function handle of the magnetic vector potential
213 %> @param B The magnetic field
214 %> @return Returns with the function handle.
215  function hLandauy = createVectorPotential( B )
216 
217  phi0 = h/qe;
218  eta_B = 2*pi/phi0*(rCC)^2*B;
219 
220  % creting the funciton handles of the vector potential
221  hLandauy = @(x,y)([zeros(size(x,1),1),eta_B*x]);
222 
223  end
224 
225 
226 
227 %% setOutputDir
228 %> @brief Sets output directory.
230  resultsdir = 'results';
231  mkdir(resultsdir );
232  outputdir = fullfile( directory, resultsdir );
233  end
234 
235 
236 
237 
238  %% PlotFunction
239 %> @brief Creates the plot
241 
242 
243  % creating figure in units of pixels
244  figure1 = figure( 'Units', 'Pixels', 'Visible', 'off');
245 
246  % font size on the figure will be 16 points
247  fontsize = 16;
248 
249  % determine points to be plotted
250  indexek = logical( (abs(DeltaC) <= 0.5) & (Evec~=0) & ~isnan(DeltaC) );
251 
252  % setting the limits of the x axis
253  x_lim = [min(Evec(indexek)) max(Evec(indexek))];
254 
255  if norm(x_lim) == 0
256  x_lim = [0 1];
257  end
258 
259  % creating axes of the plot
260  axes_cond = axes('Parent',figure1, ...
261  'Visible', 'on',...
262  'FontSize', fontsize,...
263  'xlim', x_lim,...
264  'Box', 'on',...
265  'Units', 'Pixels', ...
266  'FontName','Times New Roman');
267  hold on;
268 
269  % plot the data
270  numerics = plot(Evec(indexek), Conductance(indexek), 'Linewidth', 2, 'color', [0 0 0], 'Parent', axes_cond);
271  try
272  plot(Evec(indexek), DeltaC(indexek), 'Linewidth', 1, 'color', [0 1 0], 'Parent', axes_cond);
273  plot(Evec(indexek), Difference(indexek), 'Linewidth', 1, 'color', [1 0 0], 'Parent', axes_cond);
274  catch
275  disp('No DeltaC data present')
276  end
277 
278  % setting the cyclotron frequencies in the plot
279  if ~isempty(homegac)
280  nmax = round( (Emax/homegac)^2 );
281  nvec = 1:nmax;
282  for idx = 1:length(nvec)
283  plot(sqrt([nvec(idx), nvec(idx)])*homegac, [0 max(Conductance(indexek))], 'Linewidth', 0.5, 'color', [0 0 1], 'Parent', axes_cond);
284  end
285  end
286 
287 
288 
289 
290  % Create xlabel
291  xlabel('E [ev]','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_cond);
292 
293  % Create ylabel
294  ylabel('\sigma/\sigma_0','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_cond);
295 
296  % set the legends
297  fig_legend = legend(axes_cond, {'conductance', 'unitarity error', '"Surface Green Func - Self energy"'});
298  set(fig_legend, 'FontSize', fontsize, 'FontName','Times New Roman', 'Box', 'off', 'Location', 'NorthEast')
299 
300  % setting the position and margins of the plot, removing white
301  % spaces for release dates greater than 2015
302  ver = version('-release');
303  if str2num(ver(1:4)) >= 2016
304  fig = gcf;
305  fig.PaperPositionMode = 'auto';
306  fig_pos = fig.PaperPosition;
307  fig.PaperSize = [fig_pos(3) fig_pos(4)];
308 
309  set(gca, 'Position', get(gca, 'OuterPosition') - get(gca, 'TightInset') * [-1 0 1 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1]);
310  Position_figure = get(axes_cond, 'OuterPosition');
311  set(figure1, 'Position', Position_figure);
312  end
313 
314  % export the figures
315  print('-depsc2', fullfile(outputdir,[outfilename, '.eps']))
316  print('-dpdf', fullfile(outputdir,[outfilename, '.pdf']))
317  close(figure1)
318 
319 
320  end
321 
322 
323 
324 
325 end
Structure Opt contains the basic computational parameters used in EQuUs.
Definition: structures.m:60
Structure open_channels describes the open channel in the individual leads.
Definition: structures.m:159
A class for calculations on a ribbon of finite width for equilibrium calculations mostly in the zero ...
Definition: Ribbon.m:34
function CreateHandlesForMagneticField(B)
Creates and set function handles of the magnetic vector potentials in the Ribbon class.
function Transport(Energy, B, selfEnergy)
creating the Ribbon class representing the twoterminal setup
function createVectorPotential(B)
Creates the function handle of the magnetic vector potential.
function()
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
function magnetic_ribbon(filenum)
Example to calculate the conductivity through a ribbon in a magnetic field.
function parseInput(filename)
This function parses the input file containing the input parameters.
function setOutputDir()
Sets output directory.
function structures(name)
function CalculateTranspor()
filename containing the input XML
function PlotFunction()
Creates the plot.