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