Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
JosephsonCurrent.m
Go to the documentation of this file.
1 % DC Josephson current through a one-dimensional chain
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 JosephsonCurrent.m
20 %> @brief Example to calculate DC Josephson current through a one-dimensional chain.
21 %> @param filenum The identification number of the filenema for the exported data (default is 1).
22 %> @reference
23 %> E. Perfetto, G. Stefanucci, and M. Cini, Equilibrium and time-dependent Josephson current in one-dimensional superconducting junctions, Phys. Rev. B 80, 205408 (2009)
24 %> @Available
25 %> EQuUs v4.5 or later
26 %> @expectedresult
27 %> @image html JosephsonCurrent.jpg
28 %> @image latex JosephsonCurrent.jpg
29 %> @}
30 %
31 %> @brief Example to calculate DC Josephson current through a one-dimensional chain.
32 %> @param filenum The identification number of the filenema for the exported data (default is 1).
33 function JosephsonCurrent( filenum )
34 
35 if ~exist('filenum', 'var')
36  filenum = 1;
37 end
38 
39 filename = mfilename('fullpath');
40 [directory, fncname] = fileparts( filename );
41 
42  % filename containing the input XML
43  inputXML = 'Input_PRB_80_205408.xml';
44  % Parsing the input file and creating data structures
45  [Opt, param] = parseInput( fullfile( directory, inputXML ) );
46 
47  % filename containing the output data
48  outfilename = [fncname,'_',num2str( filenum )];
49  % the output folder
50  outputdir = [];
51 
52  % The Fermi energy in the calculations
53  EF = 1e-6; % in eV
54  % number of energy points on the integration contour
55  Edb = 1111;
56 
57  % The width of the 1D chain
58  width = 1;
59  % The length of the 1D chain
60  height = 8;
61 
62  % number of phase difference points on the CPR curve
63  phi_db = 40;
64  % spacing between the phase difference points
65  deltaPhi = pi/(phi_db+1);
66  % 1D array containing the superconducting phase difference values
67  DeltaPhi_vec = 0:deltaPhi:pi;
68  %DeltaPhi_vec = [pi/3];
69 
70  % *** define the variables storing the output values ***
71 
72  % results calculated by the scattering technique
73  currentvec_continuum_scattering = [];
74  current_surf = [];
75  % results calculated by the complex integration method (with Ribbon class)
76  currentvec_continuum = [];
77  currentvec_ABS = [];
78  currentvec_NBS = [];
79  currentvec_1range = [];
80  % results calculated by the complex integration method (with NTerminal class)
81  currentvec_TwoTerminal = [];
82 
83  % creating output directories
84  setOutputDir();
85 
86  % Calculates the current using the predefined square lattice framework (Ribbon class)
88 
89  % Calculates the current using custom Hamiltonians (TwoTerminal class and CustomHamiltonians class)
91 
92 
94 %> @brief Calculates the current using the predefined square lattice framework (Ribbon class)
96 
97  % setting the phase difference of the superconducting pair potentials
98  param.Leads{1}.pair_potential = abs(param.Leads{1}.pair_potential);
99  param.Leads{2}.pair_potential = abs(param.Leads{2}.pair_potential)*exp(1i*DeltaPhi_vec(1));
100 
101  % creating the Ribbon structure describing the junction
102  cRibbon = Ribbon( 'EF', EF, 'width', width, 'height', height, 'silent', true, 'Opt', Opt, 'param', param, 'filenameOut', fullfile(outputdir, [outfilename,'_twoTerminal.xml']));
103 
104  SNSJosephson_handles = SNSJosephson( Opt, 'junction', cRibbon, 'gfininvfromHamiltonian', false);
105  % continuum contribution
106 
107  % calculate the contribution of the scattering states via the scattering method
108  if isempty(currentvec_continuum_scattering)
109  [currentvec_continuum_scattering, current_surf] = SNSJosephson_handles.CurrentCalc_continuum( DeltaPhi_vec, 'Edb', Edb );
110  save( fullfile(outputdir,[outfilename,'.mat']));
111  PlotFunction();
112  end
113 
114  if isempty(currentvec_continuum)
115  currentvec_continuum = SNSJosephson_handles.CurrentCalc_discrete( DeltaPhi_vec, 'range', 'CONT', 'Edb', Edb );
116  save( fullfile(outputdir,[outfilename,'.mat']));
117  PlotFunction();
118  end
119 
120  % contribution from Andreev bound states
121  if isempty(currentvec_ABS)
122  currentvec_ABS = SNSJosephson_handles.CurrentCalc_discrete( DeltaPhi_vec, 'range', 'ABS', 'Edb', Edb );
123  save( fullfile(outputdir,[outfilename,'.mat']));
124  PlotFunction();
125  end
126 
127  % contribution from normal bound states
128  if isempty(currentvec_NBS)
129  currentvec_NBS = SNSJosephson_handles.CurrentCalc_discrete( DeltaPhi_vec, 'range', 'NBS', 'Edb', Edb );
130  save( fullfile(outputdir,[outfilename,'.mat']));
131  PlotFunction();
132  end
133 
134  % all the contributions calculated at once
135  if isempty(currentvec_1range)
136  currentvec_1range = SNSJosephson_handles.CurrentCalc_discrete( DeltaPhi_vec, 'range', 'ALL', 'Edb', Edb );
137  save( fullfile(outputdir,[outfilename,'.mat']));
138  PlotFunction();
139  end
140 
141 
142 
143 
144  end
145 
146 
148 %> @brief Calculates the current using custom Hamiltonians (see the documentation of classes #NTerminal and #Custom_Hamiltonians)
150 
151  % setting the phase difference of the superconducting pair potentials
152  param.Leads{1}.pair_potential = abs(param.Leads{1}.pair_potential);
153  param.Leads{2}.pair_potential = abs(param.Leads{2}.pair_potential)*exp(1i*DeltaPhi_vec(1));
154 
155  % set the parameters to use external source for Hamiltonians
156  Opt.Lattice_Type = [];
157  Opt.custom_Hamiltonians = 'Custom';
158 
159  % create an instance of class NTerminal
160  cNTerminal = NTerminal('Opt', Opt, 'param', param, 'filenameOut', fullfile(outputdir, [outfilename,'_twoTerminal.xml']), 'WorkingDir', directory, 'EF', EF, 'CustomHamiltoniansHandle', @Hamiltonians );
161 
162  % create an instance of class SNSJosephson to calculate the DC Josephson current
163  cSNSJosephson = SNSJosephson( Opt, 'gfininvfromHamiltonian', true, 'junction', cNTerminal);
164 
165  % perform the calculations
166  currentvec_TwoTerminal = cSNSJosephson.CurrentCalc_discrete(DeltaPhi_vec, 'Edb', Edb, 'range', 'ALL');
167 
168  % plot the results
169  PlotFunction();
170 
171  end
172 
173 
174 %% Hamiltonians
175 %> @brief Function to create the custom Hamiltonians for the 1D chain
176 %> @param varargin Cell array of optional parameters identical to #Custom_Hamiltonians.LoadHamiltonians.
177 %> @return [1] Cell array of Hamiltonians of one slab in the leads
178 %> @return [2] Cell array of overlap integrals of one slab in the leads
179 %> @return [3] Cell array of couplings between the slabs of the leads
180 %> @return [4] Cell array of overlap integrals between the slabs of the leads
181 %> @return [5] Cell array of transverse coupling between the unit cells of the lead
182 %> @return [6] Cell array of #coordinates of the leads
183 %> @return [7] Hamiltonian of the scattering region
184 %> @return [8] Overlap integrals of the scattering region
185 %> @return [9] Transverse coupling for the scattering region
186 %> @return [10] Overlap integrals for the transverse coupling in the scattering region
187 %> @return [11] #coordinates of the scattering region
188 %> @return [12] Cell array of couplings between the scattering region and the leads
189 %> @return [13] Cell array of overlap integrals between the scattering region and the leads
190  function [H0, S0, H1, S1, H1_transverse, coordinates, Hscatter, Sscatter, Hscatter_transverse, Sscatter_transverse, coordinates_scatter, Hcoupling, Scoupling] = Hamiltonians( varargin )
191  p = inputParser;
192  p.addParameter('q', []);
193  p.parse(varargin{:});
194 
195  q = p.Results.q;
196 
197  S0 = cell(2,1);
198  S1 = cell(2,1);
199  Sscatter = [];
200  Scoupling = cell(2,1);
201 
202  coordinates = cell(2,1);
203  coordinates{1} = structures('coordinates');
204  coordinates{2} = structures('coordinates');
205  coordinates_scatter = structures('coordinates');
206 
207  [Opt, param] = parseInput('Input_PRB_80_205408.xml');
208 
209  H0 = cell(2,1);
210  H0{1} = param.Leads{1}.epsilon;
211  H0{2} = param.Leads{2}.epsilon;
212 
213  H1 = cell(2,1);
214  H1{1} = param.Leads{1}.vargamma;
215  H1{2} = param.Leads{2}.vargamma;
216 
217  H1_transverse = cell(2,1);
218  H1_transverse{1} = [];
219  H1_transverse{2} = [];
220 
221  Hscatter_transverse = [];
222  Sscatter_transverse = [];
223 
224 
225  dim = height;
226  Hscatter = sparse(1:dim, 1:dim, param.scatter.epsilon, dim, dim) + ...
227  sparse(1:dim-1, 2:dim, param.scatter.vargamma, dim, dim) + ...
228  sparse(2:dim, 1:dim-1, param.scatter.vargamma, dim, dim);
229 
230  Hcoupling = cell(2,1);
231  Hcoupling{1} = sparse(1, 1, param.Leads{1}.vargamma, 1, dim);
232  Hcoupling{2} = sparse(1, dim, param.Leads{2}.vargamma, 1, dim);
233 
234 
235  end
236 
237 
238 
239 
240 %% PlotFunction
241 %> @brief Creates the plot
242  function PlotFunction()
243 
244  % creating figure in units of pixels
245  figure1 = figure( 'Units', 'Pixels', 'Visible', 'off');
246 
247  % font size on the figure will be 16 points
248  fontsize = 16;
249 
250 
251  % creating axes of the plot
252  axes1 = axes('Parent',figure1, ...
253  'Visible', 'on',...
254  'FontSize', fontsize,...
255  'Box', 'on',...
256  'Units', 'Pixels', ...
257  'FontName','Times New Roman');
258  hold on;
259 
260  % Create xlabel
261  xlabel('\Delta\phi/\pi','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes1);
262 
263  % Create ylabel
264  ylabel('I','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes1);
265 
266  % define the variable for the legends
267  legend_labels = [];
268 
269  % plot the data
270  if ~isempty( currentvec_continuum )
271  indexes = logical( currentvec_continuum );
272  plot(DeltaPhi_vec(indexes)/pi, currentvec_continuum(indexes), 'b-', 'Parent', axes1)
273  legend_labels{end+1} = 'CONT';
274  end
275 
276  if ~isempty( currentvec_continuum_scattering )
277  indexes = logical( currentvec_continuum_scattering );
278  plot(DeltaPhi_vec(indexes)/pi, currentvec_continuum_scattering(indexes), 'b--', 'Parent', axes1)
279  legend_labels{end+1} = 'CONT S-matrix';
280  end
281 
282  if ~isempty( currentvec_ABS )
283  indexes = ~isnan( currentvec_ABS );
284  plot(DeltaPhi_vec(indexes)/pi, currentvec_ABS(indexes), 'Linestyle', '-', 'Color', [0 0.83 0], 'Parent', axes1)
285  legend_labels{end+1} = 'Andreev bound states';
286  end
287 
288  if ~isempty( currentvec_NBS )
289  indexes = ~isnan( currentvec_NBS );
290  plot(DeltaPhi_vec(indexes)/pi, currentvec_NBS(indexes), 'r-', 'Parent', axes1)
291  legend_labels{end+1} = 'Normal bound states';
292  end
293 
294  if (~isempty( currentvec_NBS )) && (~isempty( currentvec_continuum )) && (~isempty( currentvec_NBS ))
295  total = currentvec_continuum+currentvec_ABS+currentvec_NBS;
296  indexes = ~isnan( total );
297  plot(DeltaPhi_vec(indexes)/pi, total, 'k-', 'Parent', axes1)
298  legend_labels{end+1} = 'Total current';
299  end
300 
301 
302  if ~isempty( currentvec_1range )
303  indexes = ~isnan( currentvec_1range );
304  plot(DeltaPhi_vec(indexes)/pi, currentvec_1range(indexes), 'c-', 'Parent', axes1)
305  legend_labels{end+1} = 'ALL';
306  end
307 
308 
309  if ~isempty( currentvec_TwoTerminal )
310  indexes = ~isnan( currentvec_TwoTerminal );
311  plot(DeltaPhi_vec(indexes)/pi, currentvec_TwoTerminal(indexes), 'Color', [0.8 0 0.6], 'Parent', axes1)
312  legend_labels{end+1} = 'TwoTerminal';
313  end
314 
315 
316  % setting the legends
317  fig_legend = legend(axes1, legend_labels);
318  set(fig_legend, 'FontSize', fontsize, 'FontName','Times New Roman', 'Box', 'off', 'Location', 'NorthEast')
319 
320  %set the position of the axis
321  figure_pos = get( figure1, 'Position' );
322  OuterPosition = get(axes1, 'OuterPosition');
323  OuterPosition(1) = 0;
324  OuterPosition(2) = 0;
325  OuterPosition(3) = figure_pos(3);
326  OuterPosition(4) = figure_pos(4);
327  set(axes1, 'OuterPosition', OuterPosition);
328 
329 
330 
331  % set the paper position in releases greater than 2016
332  ver = version('-release');
333  if str2num(ver(1:4)) >= 2016
334  % setting the position and margins of the plot, removing white spaces
335  figure1.PaperPositionMode = 'auto';
336 
337  fig_pos = figure1.PaperPosition;
338  figure1.PaperSize = [fig_pos(3) fig_pos(4)];
339  end
340 
341 
342  % export the figures
343  print('-depsc2', fullfile(outputdir,[outfilename, '.eps']))
344  print('-dpdf', fullfile(outputdir,[outfilename, '.pdf']))
345  close(figure1)
346 
347 
348 
349 
350  end
351 
352 
353 
354 %% setOutputDir
355 %> @brief Sets output directory.
357  resultsdir = 'results';
358  mkdir(fullfile(directory, resultsdir) );
359  outputdir = resultsdir;
360  end
361 
362 
363 
364 
365 end
Property varargin
cell array of optional parameters. (For details see InputParsing)
Definition: UtilsBase.m:48
A class describing an N-terminal geometry for equilibrium calculations mostly in the zero temperature...
Definition: NTerminal.m:38
function LoadHamiltonians(varargin)
Obtain the Hamiltonians from the external source.
Lattice_Type
String describing the preprogrammed lattice type. See the documentation of lattice types for details.
Definition: structures.m:80
lead_param Leads
A list of structures lead_param containing the physical parameters for the scattering region.
Definition: structures.m:49
Structure Opt contains the basic computational parameters used in EQuUs.
Definition: structures.m:60
function setOutputDir()
Sets output directory.
A class for calculations on a ribbon of finite width for equilibrium calculations mostly in the zero ...
Definition: Ribbon.m:34
Property version
The current version of the package.
function currentVSDeltaPhi_TwoTerminal()
Calculates the current using custom Hamiltonians (see the documentation of classes NTerminal and Cust...
function Hamiltonians(varargin)
Function to create the custom Hamiltonians for the 1D chain.
function PlotFunction()
Creates the plot.
Property EF
The Fermi energy. Attribute E is measured from this value. (Use for equilibrium calculations in the z...
Definition: NTerminal.m:58
A class to calculate the DC Josephson current.
Definition: SNSJosephson.m:24
A class to import custom Hamiltonians provided by other codes or created manually
custom_Hamiltonians
Set 'siesta' to import Hamiltonians from Siesta, 'custom' to use custom defined Hamiltonians.
Definition: structures.m:96
function()
function CurrentCalc_discrete(DeltaPhi_vec, varargin)
Calculates the Josephson current using the method in PRB 93, 224510 (2016)
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
function SNSJosephson(Opt, varargin)
Constructor of the class.
scatter_param scatter
An instance of the structure scatter_param containing the physical parameters for the scattering regi...
Definition: structures.m:47
Property Opt
An instance of structure Opt.
Definition: Messages.m:31
function currentVSDeltaPhi()
Calculates the current using the predefined square lattice framework (Ribbon class)
function NTerminal(varargin)
Constructor of the class.
function parseInput(filename)
This function parses the input file containing the input parameters.
function JosephsonCurrent(filenum)
Example to calculate DC Josephson current through a one-dimensional chain.
function structures(name)