Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
SpectralDensity.m
Go to the documentation of this file.
1 % Spectral density function in superconductor-graphene-superconductor junctions.
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 SpectralDensity.m
20 %> @brief Example to calculate the spectral density function in a superconductor-graphene-superconductor junction.
21 %> @param filenum The identification number of the filenema for the exported data (default is 1).
22 %> @Available
23 %> EQuUs v4.7 or later
24 %> @expectedresult
25 %> @image html SpectralDensity.jpg
26 %> @image latex SpectralDensity.jpg
27 %> @}
28 %
29 %> @brief Example to calculate the spectral density function in a superconductor-graphene-superconductor junction.
30 %> @param filenum The identification number of the filenema for the exported data (default is 1).
31 %%
32 function SpectralDensity( 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  % The width of the unit cell
52  width = 2;
53  % The length of the graphene strip
54  height = 1016;
55 
56  % setting the output directory
57  setOutputDir()
58 
59  % outfilename to export the running parameters
60  outputXML = fullfile(outputdir, [outfilename, '.xml']);
61 
62  % carbon-carbon atom distance
63  rCC = 1.42e-10;
64  % the phase difference between the superconducting contacts
65  deltaPhi = 1.4043;
66  % The Fermi energy in the scattering region
67  EF = 0.08; %In EV
68  % imaginary part of the Fermi energy
69  eta = 1e-6;
70  % parameter for the doping profile
71  surfacePotential = 0.1; %in eV
72 
73  % setting the phase of the superconducting pair potentials
74  param.Leads{1}.pair_potential = abs(param.Leads{1}.pair_potential);
75  param.Leads{2}.pair_potential = abs(param.Leads{2}.pair_potential)*exp(1i*deltaPhi);
76 
77 
78  % creating array containing the pair potentials in the leads
79  Delta = [param.Leads{1}.pair_potential, param.Leads{2}.pair_potential ];
80 
81  % setting the energy and tranverse momentum grids for the calculations
82  [Evec, qvec] = setVectors();
83 
84  % An instance of class Ribbon describing the junction
85  cRibbon = [];
86 
87  % The calculated density of states
88  density_of_states = zeros( length(Evec), length(qvec));
89 
90  % calculate the density of states
92 
93 
94 
95 
97 %> @brief Calculate the density of states
98  function CalculateSpectralDensity()
99 
100  % determine indexes to be calculated
101  indexes = logical( density_of_states(1,:) );
102  index2calc = 1:length(indexes);
103  index2calc = index2calc( ~indexes );
104 
105 
106  % Do the calculations
107  for idx = 1:length(index2calc)
108  q = qvec(index2calc(idx));
109 
110  disp(' ')
111  disp(' ')
112  disp(' ----------------------------------')
113  disp(['Calculating Greens function for the transverse momentum q=', num2str(q)])
114 
115  % temporary array to store the calculated DOS
116  Rho = zeros( length(Evec), 1);
117 
118  % Creating an instance of Ribbon class with the current transverse momentum q
119  cRibbon = Ribbon('width', width, 'height', height, 'E', 0, 'EF', EF, ...
120  'Opt', Opt, 'param', param, 'filenameOut', outputXML, 'q', q);
121 
122  for jdx=1:length(Evec)
123  Energy = Evec(jdx);
124 
125  % setting the current energy
126  cRibbon.setEnergy( Energy+1i*eta );
127 
128  % Calculates the DOS for the given energy and transverse momentum quantum number
129  [Atot, G] = cRibbon.CalcSpectralFunction( Energy+1i*eta, 'constant_channels',false, ...
130  'gfininvfromHamiltonian', true, 'PotInScatter', @SurfacePot, ...
131  'decimateDyson', false);
132 
133  Rho(jdx) = Atot;
134 
135  end
136 
137  density_of_states(:,index2calc(idx)) = Rho;
138 
139  % calculated data are plotted at each step
140  PlotFunction( )
141 
142  % exporting the calculated data
143  save( [outputdir,'/',outfilename, '.mat'], 'qvec', 'Evec', 'width', 'height', 'EF', 'density_of_states' );
144 
145  % displaying the status of the calculations
146  disp([ num2str(index2calc(idx)/length(qvec)*100),' % calculated of the density of states.'])
147  end
148 
149 
150 
151  end
152 
153 
154 %% SetVectors
155 %> @brief Sets the energy and transverse quantum number grid points
156 %> @return [1] 1D array of the energy points.
157 %> @return [2] 1D array of the transverse momentum points.
158  function [Evec, qvec] = setVectors()
159  Evec = (0:max(abs(Delta))/70:1.1*max(abs(Delta)));
160  vargamma = param.scatter.vargamma;
161  qmax = (abs(EF)+max(abs(Evec)))/(vargamma/2)*1.7;
162  qvec = (-qmax:qmax/70:qmax); % in units of (3r_CC)^-1
163 
164  end
165 
166 %% ScatterPotetial
167 %> @brief Potential in the scattering region (transversally translational invariant)
168 %> @param An instance of structure #coordinates containing the position of the sites
169 %> @return An array of the on-site potential.
170  function ret = SurfacePot( coordinates )
171  if isempty(surfacePotential)
172  ret = 0;
173  return;
174  end
175 
176  lattice_const = norm(coordinates.a);
177 
178  lambda = 15*lattice_const; %transition length of the pn potential in units of rCC
179  y1 = 0.15*height*lattice_const;
180  y2 = height*lattice_const - y1;
181 
182  y = coordinates.y;
183 
184 
185  ret = surfacePotential*( tanh((y-y1)/lambda) - tanh((y-y2)/lambda) )/2;
186  end
187 
188 %% setOutputDir
189 %> @brief sets the output directory
190  function setOutputDir()
191  resultsdir = 'results';
192  mkdir(resultsdir );
193  outputdir = resultsdir;
194  end
195 
196 %% PlotFunction
197 %> @brief plot the calculated data
199 
200 % ********************** plot the DOS ***********************
201 
202  % determine points to be plotted
203  indexes = logical( density_of_states(1,:));
204 
205  if length(qvec(indexes)) < 2
206  return
207  end
208 
209  % creating figure in units of pixels
210  figure1 = figure( 'Units', 'Pixels', 'Visible', 'off', 'Colormap', ...
211  [0.0416666679084301 0 0;0.0833333358168602 0 0;0.125 0 0;0.16666667163372 0 0;0.20833332836628 0 0;0.25 0 0;0.291666656732559 0 0;0.333333343267441 0 0;0.375 0 0;0.416666656732559 0 0;0.458333343267441 0 0;0.5 0 0;0.541666686534882 0 0;0.583333313465118 0 0;0.625 0 0;0.666666686534882 0 0;0.708333313465118 0 0;0.75 0 0;0.791666686534882 0 0;0.833333313465118 0 0;0.875 0 0;0.916666686534882 0 0;0.958333313465118 0 0;1 0 0;1 0.0416666679084301 0;1 0.0833333358168602 0;1 0.125 0;1 0.16666667163372 0;1 0.20833332836628 0;1 0.25 0;1 0.291666656732559 0;1 0.333333343267441 0;1 0.375 0;1 0.416666656732559 0;1 0.458333343267441 0;1 0.5 0;1 0.541666686534882 0;1 0.583333313465118 0;1 0.625 0;1 0.666666686534882 0;1 0.708333313465118 0;1 0.75 0;1 0.791666686534882 0;1 0.833333313465118 0;1 0.875 0;1 0.916666686534882 0;1 0.958333313465118 0;1 1 0;1 1 0.0625;1 1 0.125;1 1 0.1875;1 1 0.25;1 1 0.3125;1 1 0.375;1 1 0.4375;1 1 0.5;1 1 0.5625;1 1 0.625;1 1 0.6875;1 1 0.75;1 1 0.8125;1 1 0.875;1 1 0.9375;1 1 1]);
212 
213  % font size on the figure will be 16 points
214  fontsize = 12;
215 
216  % define the colorbar limits
217  colbarlimits = [min(min(log(density_of_states))) max(max(log(density_of_states)))];
218 
219  % define the axis limits
220  x_lim = [min(qvec) max(qvec)];
221  y_lim = [min(Evec) max(Evec)]/min(abs(Delta));
222 
223 
224  axes_DOS = axes('Parent',figure1, ...
225  'Visible', 'on',...
226  'FontSize', fontsize,...
227  'xlim', x_lim,...
228  'ylim', y_lim,...
229  'CLim', colbarlimits, ...
230  'Box', 'on',...
231  'Units', 'Pixels', ...
232  'FontName','Times New Roman');
233  hold on;
234 
235  % plot the data
236  [X,Y] = meshgrid( qvec(indexes), Evec );
237  levelnum = 50;
238  density_of_states2plot = log(density_of_states(:,indexes));
239  db=1;
240  contour(X(1:db:end,1:db:end), Y(1:db:end,1:db:end)/min(abs(Delta)), density_of_states2plot(1:db:end,1:db:end), levelnum ,'LineStyle','none','Fill','on',... 'LevelList',[0.2391 0.2866 0.3342 0.3817 0.4293 0.4769 0.5244 0.572 0.6195 0.6671 0.7147 0.7622 0.8098 0.8573 0.9049 0.9524],...
241  'Parent', axes_DOS);
242 
243  % Create xlabel
244  xlabel('q [1/(3r_{CC})]','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_DOS);
245 
246  % Create ylabel
247  ylabel('E [\Delta]','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_DOS);
248 
249 
250 
251 
252 
253 % ********************** plot potential ************************
254  coordinates = structures('coordinates');
255  coordinates.y = 0:0.01:height*sqrt(3);
256  coordinates.a = [0, sqrt(3)];
257 
258  % determine the potential across the svócattering region
259  pot = SurfacePot( coordinates );
260 
261  % position dependent local doping
262  lead_shift = param.Leads{1}.epsilon;
263  mu = EF - lead_shift - pot;
264 
265  x_lim = [ min(coordinates.y-fix(height/4)*coordinates.a(2)) max(coordinates.y+fix(height/4)*coordinates.a(2))]*rCC*1e10;
266  y_lim = [ min(mu) max(mu)];
267 
268  axes_pot = axes('Parent',figure1, ...
269  'Visible', 'on',...
270  'FontSize', fontsize,...
271  'xlim', x_lim,...
272  'ylim', y_lim,...
273  'Box', 'on',...
274  'Units', 'Pixels', ...
275  'FontName','Times New Roman');
276  hold on;
277 
278 
279  % plot the data
280  plot( coordinates.y*rCC*1e10, mu, 'LineWidth', 2, 'parent', axes_pot);
281  plot( [min(coordinates.y)*rCC*1e10, min(coordinates.y)*rCC*1e10], y_lim, 'LineStyle', '--', 'color', [0 0 0], 'parent', axes_pot )
282  plot( [max(coordinates.y)*rCC*1e10, max(coordinates.y)*rCC*1e10], y_lim, 'LineStyle', '--', 'color', [0 0 0], 'parent', axes_pot )
283 
284 
285  % setting the xlabel and ylabel
286  xlabel('x [A]', 'FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_pot);
287  ylabel('doping level [ev]' ,'FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes_pot);
288 
289  % det the position of the figure
290  figure_pos = get( figure1, 'Position' );
291  figure_pos(4) = figure_pos(4)/2;
292  set( figure1, 'Position', figure_pos);
293 
294 
295  %set the position of the axes_DOS
296  OuterPosition = get(axes_DOS, 'OuterPosition');
297  OuterPosition(1) = 0;
298  OuterPosition(2) = 0;
299  OuterPosition(3) = figure_pos(3)/2;
300  OuterPosition(4) = figure_pos(4);
301  set(axes_DOS, 'OuterPosition', OuterPosition);
302  Position_DOS = get(axes_DOS, 'OuterPosition') - get(axes_DOS, 'TightInset') * [-1 0 1 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1];
303  %set(axes_DOS, 'Position', Position_DOS);
304 
305  %set the position of the axes_pot
306  OuterPosition = get(axes_pot, 'OuterPosition');
307  OuterPosition(1) = figure_pos(3)/2;
308  OuterPosition(2) = 0;
309  OuterPosition(3) = figure_pos(3)/2;
310  OuterPosition(4) = figure_pos(4);
311  set(axes_pot, 'OuterPosition', OuterPosition);
312  Position_pot = get(axes_pot, 'OuterPosition') - get(axes_pot, 'TightInset') * [-1 0 1 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1];
313  %set(axes_pot, 'Position', Position_pot);
314 
315  % set the paper position in releases greater than 2016
316  ver = version('-release');
317  if str2num(ver(1:4)) >= 2016
318  % setting the position and margins of the plot, removing white spaces
319  figure1.PaperPositionMode = 'auto';
320  fig_pos = figure1.PaperPosition;
321  figure1.PaperSize = [fig_pos(3) fig_pos(4)/2];
322  end
323 
324 
325  % export the figures
326  try
327  print('-depsc2', fullfile(outputdir, [outfilename,'.eps']))
328  print('-dpdf', fullfile(outputdir,[outfilename, '.pdf']))
329  catch errCause
330  disp('Failed to export figure');
331  disp( errCause.identifier );
332  disp( errCause.stack(1) );
333  end
334  close(figure1)
335 
336 
337  end
338 
339 
340 
341 
342 
343 end
Property filenameOut
Output filename to export the computational parameters.
Definition: NTerminal.m:98
function setOutputDir()
sets the output directory
lead_param Leads
A list of structures lead_param containing the physical parameters for the scattering region.
Definition: structures.m:49
Property G
Green operator of the scattering region.
Definition: NTerminal.m:49
function setEnergy(Energy)
Sets the energy for the calculations.
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 SpectralDensity(filenum)
Example to calculate the spectral density function in a superconductor-graphene-superconductor juncti...
Property EF
The Fermi energy. Attribute E is measured from this value. (Use for equilibrium calculations in the z...
Definition: NTerminal.m:58
Structure containg the energy resolved density of states.
Definition: structures.m:196
Property height
height (length) of the scattering region (number of unit cells)
Definition: Ribbon.m:51
function setVectors()
Sets the energy and transverse quantum number grid points.
Property q
The transverse momentum quantum number.
Definition: NTerminal.m:61
function()
Property width
width of the scattering region (number of the nonsingular atomic sites in the cross section)
Definition: Ribbon.m:48
function PlotFunction()
plot the calculated data
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
function CalculateSpectralDensity()
Calculate the density of states.
function parseInput(filename)
This function parses the input file containing the input parameters.
function SurfacePot(coordinates)
Potential in the scattering region (transversally translational invariant)
Property E
The energy used in the calculations.
Definition: NTerminal.m:55
function CalcSpectralFunction(Energy, varargin)
Calculates the spectral density and the Green operator.
function structures(name)