1 % DC Josephson current through a one-dimensional chain
2 % Copyright (C) 2015 Peter Rakyta, Ph.D.
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.
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.
14 % You should have received a copy of the GNU General Public License
15 % along with
this program. If not, see http:
17 %> @addtogroup Examples
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).
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)
25 %> EQuUs v4.5 or later
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).
35 if ~exist(
'filenum',
'var')
39 filename = mfilename('fullpath');
40 [directory, fncname] = fileparts( filename );
42 % filename containing the input XML
43 inputXML = 'Input_PRB_80_205408.xml';
44 % Parsing the input file and creating data
structures 47 % filename containing the output data
48 outfilename = [fncname,'_',num2str( filenum )];
52 % The Fermi energy in the calculations
54 % number of energy points on the integration contour
57 % The width of the 1D chain
59 % The length of the 1D chain
62 % number of phase difference points on the CPR curve
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];
70 % *** define the variables storing the output values ***
72 % results calculated by the scattering technique
73 currentvec_continuum_scattering = [];
75 % results calculated by the complex integration method (with
Ribbon class)
76 currentvec_continuum = [];
79 currentvec_1range = [];
80 % results calculated by the complex integration method (with
NTerminal class)
81 currentvec_TwoTerminal = [];
83 % creating output directories
86 % Calculates the current using the predefined square lattice framework (
Ribbon class)
89 % Calculates the current using custom
Hamiltonians (TwoTerminal class and CustomHamiltonians class)
94 %> @brief Calculates the current using the predefined square lattice framework (
Ribbon class)
97 % setting the phase difference of the superconducting pair potentials
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']));
104 SNSJosephson_handles =
SNSJosephson(
Opt,
'junction', cRibbon,
'gfininvfromHamiltonian',
false);
105 % continuum contribution
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']));
114 if isempty(currentvec_continuum)
115 currentvec_continuum = SNSJosephson_handles.CurrentCalc_discrete( DeltaPhi_vec,
'range',
'CONT',
'Edb', Edb );
116 save( fullfile(outputdir,[outfilename,
'.mat']));
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']));
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']));
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']));
151 % setting the phase difference of the superconducting pair potentials
155 % set the parameters to use external source
for Hamiltonians 160 cNTerminal =
NTerminal(
'Opt',
Opt,
'param',
param,
'filenameOut', fullfile(outputdir, [outfilename,
'_twoTerminal.xml']),
'WorkingDir', directory,
'EF',
EF,
'CustomHamiltoniansHandle', @
Hamiltonians );
162 % create an instance of
class SNSJosephson to calculate the DC Josephson current
163 cSNSJosephson =
SNSJosephson(
Opt,
'gfininvfromHamiltonian',
true,
'junction', cNTerminal);
165 % perform the calculations
166 currentvec_TwoTerminal = cSNSJosephson.
CurrentCalc_discrete(DeltaPhi_vec,
'Edb', Edb,
'range',
'ALL');
175 %> @brief Function to create the custom
Hamiltonians for the 1D chain
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 )
192 p.addParameter(
'q', []);
200 Scoupling = cell(2,1);
202 coordinates = cell(2,1);
205 coordinates_scatter =
structures(
'coordinates');
217 H1_transverse = cell(2,1);
218 H1_transverse{1} = [];
219 H1_transverse{2} = [];
221 Hscatter_transverse = [];
222 Sscatter_transverse = [];
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);
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);
241 %> @brief Creates the plot
244 % creating figure in units of pixels
245 figure1 = figure(
'Units',
'Pixels',
'Visible',
'off');
247 % font size on the figure will be 16 points
251 % creating axes of the plot
252 axes1 = axes(
'Parent',figure1, ...
254 'FontSize', fontsize,...
256 'Units',
'Pixels', ...
257 'FontName',
'Times New Roman');
261 xlabel(
'\Delta\phi/\pi',
'FontSize', fontsize,
'FontName',
'Times New Roman',
'Parent', axes1);
264 ylabel(
'I',
'FontSize', fontsize,
'FontName',
'Times New Roman',
'Parent', axes1);
266 % define the variable
for the legends
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';
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';
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';
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';
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';
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';
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';
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')
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);
331 % set the paper position in releases greater than 2016
333 if str2num(ver(1:4)) >= 2016
334 % setting the position and margins of the plot, removing white spaces
335 figure1.PaperPositionMode =
'auto';
337 fig_pos = figure1.PaperPosition;
338 figure1.PaperSize = [fig_pos(3) fig_pos(4)];
343 print('-depsc2', fullfile(outputdir,[outfilename, '.eps']))
344 print('-dpdf', fullfile(outputdir,[outfilename, '.pdf']))
355 %> @brief Sets output directory.
357 resultsdir = 'results';
358 mkdir(fullfile(directory, resultsdir) );
359 outputdir = resultsdir;
Property varargin
cell array of optional parameters. (For details see InputParsing)
A class describing an N-terminal geometry for equilibrium calculations mostly in the zero temperature...
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.
lead_param Leads
A list of structures lead_param containing the physical parameters for the scattering region.
Structure Opt contains the basic computational parameters used in EQuUs.
function setOutputDir()
Sets output directory.
A class for calculations on a ribbon of finite width for equilibrium calculations mostly in the zero ...
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...
A class to calculate the DC Josephson current.
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.
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 ...
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...
Property Opt
An instance of structure Opt.
function currentVSDeltaPhi()
Calculates the current using the predefined square lattice framework (Ribbon class)
function NTerminal(varargin)
Constructor of the class.
function JosephsonCurrent(filenum)
Example to calculate DC Josephson current through a one-dimensional chain.
function structures(name)