1 %% Calculates the
self-consitent spectrum of a graphene quantum dot
2 % Compare results to Fig.2 in 2014 Nanotechnology 25 465201.
3 % Copyright (C) 2017 Peter Rakyta, Ph.D.
5 % This program is free software: you can redistribute it and/or modify
6 % it under the terms of the GNU General Public License as published by
7 % the Free Software Foundation, either version 3 of the License, or
8 % (at your option) any later version.
10 % This program is distributed in the hope that it will be useful,
11 % but WITHOUT ANY WARRANTY; without even the implied warranty of
12 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 % GNU General Public License
for more details.
15 % You should have received a copy of the GNU General Public License
16 % along with
this program. If not, see http:
18 %> @addtogroup Examples
21 %> @brief Example to calculate the
self-consitent spectrum of a graphene quantum dot
22 %> @
param filenum The identification number of the filenema
for the exported data (
default is 1).
24 %> S. Krompiewski, Nanotechnology 25 465201 (2014).
26 %> EQuUs v4.9 or later
32 %> @brief Example to calculate the
self-consitent spectrum of a graphene quantum dot
33 %> @
param filenum The identification number of the filenema
for the exported data (
default is 1).
36 if ~exist(
'filenum',
'var')
40 filename = mfilename('fullpath');
41 [directory, fncname] = fileparts( filename );
43 % filename containing the input XML
44 inputXML = 'Input.xml';
45 % Parsing the input file and creating data
structures 47 % The hopping amplitude between the
sites 48 vargamma =
param.scatter.vargamma;
51 % Strength of the self-consitent intercation in the Hubbard model
53 % Zeeman energy for the initial iteration to bring the system out of the trivial solution
54 Zeeman_energy = 0.5*vargamma;
59 % width of the junction
61 % length of the junction
63 % filename containing the output XML
64 outfilename = [fncname,'_',num2str( filenum )];
67 % false to supress output messages
70 % the calculated energy eigenvalues in the non-interacting and in the self-consistent cases
73 eig_no_interaction = [];
76 % Class for self-consistent iterations
79 % creating output directories
82 % Creates the class for self-consistent iterations
85 % create the an instance of class
Ribbon describing the structure
86 cRibbon =
Ribbon('width', width, 'height', height, 'EF', EF, 'silent', silent, '
Opt',
Opt, '
param',
param, 'filenameOut', fullfile(outputdir, [outfilename, '.xml']) );
88 % Calculates the self-consistent spectrum of graphene island
94 % export the calculeted data
95 save( [outputdir, filesep, outfilename,'.mat']);
99 %> @brief Calculates the self-consistent spectrum of a graphene island
102 % creating an array of band filling factors for which the
103 %calculation shall be performed
104 filling_factor = floor(width*(2*height-1)/2)*2;
105 filling_factors = filling_factor-8:2:filling_factor+10;
107 % preallocating arrays for the eienenergies
108 eig_num = length(filling_factors);
109 eig_spinup = zeros(eig_num,1);
110 eig_no_interaction = zeros(eig_num,1);
112 % calculating the non-interacting eigenvalues
114 % creating the Hamiltonian of the scattering region
115 cRibbon.CreateScatter();
116 CreateH = cRibbon.CreateH;
117 ScatterPot(CreateH, 0); %removing the unecessary
sites from the Hamiltonian
118 Hscatter = CreateH.Read('Hscatter');
119 eig_no_interaction = eig(Hscatter);
120 eig_no_interaction = eig_no_interaction(filling_factors)/vargamma;
122 % calculating the self-consistent eigenvalues
124 % calculate the sel-consistent potential
127 % creating the Hamiltonian of the scattering region
128 cRibbon.CreateScatter();
129 CreateH = cRibbon.CreateH;
131 Hscatter = CreateH.Read('Hscatter');
132 Hscatter_Self_consistent = Hscatter + diag(pot);
134 % calculate the self-consistent energy eigenvalues
135 eigvals = eig(Hscatter_Self_consistent)/vargamma;
136 eig_spinup = eigvals(filling_factors);
144 %> @brief Calculates the self-consistent potential of a graphene island
146 % reset the self-consistent class to forget previous iterations, but keep the last calculated density
147 cSelfConsistent.Reset();
149 % Do the self-consistent iterations with
function handle pointing to a Stoner model
150 cSelfConsistent.runSelfConsistentIterations( @()
DensityCalc(filling_factor) );
158 %> @brief Calculates the density using the predefined graphene lattice framework (
Ribbon class)
162 cDensity =
Density(
Opt, 'T', T, 'scatterPotential', @(CreateH, E)(
ScatterPot(CreateH, E)), 'junction', cRibbon);
164 % Calculate the density
165 [density_data, junction_sites_spinup] = cDensity.DensityCalcSmall(filling_factor);
170 %> @brief Stoner model in the scattering region (and removing unnecessary
sites from the scattering region)
174 % determine
sites to be removed to reproduce the scattering region in 2014 Nanotechnology 25 465201
175 CreateH.Write('kulso_szabfokok', []);
177 coordinates = CreateH.Read('coordinates');
181 indexes2remove = ~(y<max_y);
182 CreateH.RemoveSites( indexes2remove )
185 if isempty(cSelfConsistent.density)
187 coordinates = CreateH.Read('coordinates');
189 % adding Zeeman term at the edges the first iteration to bring the
190 %system put of the trivial solution
194 lattice_constant = norm(coordinates.a);
195 ret = (exp(-(x-min_x).^2/(2*lattice_constant^2)) - exp(-(x-max_x).^2/(2*lattice_constant^2)) )*Zeeman_energy;
196 ret(~coordinates.spinup) = -ret(~coordinates.spinup);
201 % if isempty(cSelfConsistent.density_spinup) && spin==1
202 % density_scatter_spindown =cSelfConsistent. density_spindown(junction_sites_spindown.Scatter.site_indexes);
203 % ret = ret + U*(density_scatter_spindown);
204 % elseif isempty(cSelfConsistent.density_spindown) && spin==-1
205 % density_scatter_spinup = cSelfConsistent.density_spinup(junction_sites_spinup.Scatter.site_indexes);
206 % ret = ret + U*(density_scatter_spinup);
209 % Stoner interaction model of Nanotechnology 25 (2014) 465201
210 coordinates = CreateH.Read('coordinates');
211 ret = zeros(size(coordinates.x));
213 scatter_density = cSelfConsistent.density(cSelfConsistent.
junction_sites.Scatter.site_indexes);
215 density_scatter_spinup = scatter_density(cSelfConsistent.
junction_sites.Scatter.coordinates.spinup);
216 density_scatter_spindown = scatter_density(~cSelfConsistent.
junction_sites.Scatter.coordinates.spinup);
218 ret(coordinates.spinup) = 0.5*U*(density_scatter_spinup-density_scatter_spindown);
219 ret(~coordinates.spinup) = -0.5*U*(density_scatter_spinup-density_scatter_spindown);
227 %> @brief Creates the plot
230 % creating figure in units of pixels
231 figure1 = figure( 'Units', 'Pixels', 'Visible', 'off');
233 % font size on the figure will be 16 points
236 % creating axes of the plot
237 axes1 = axes('Parent',figure1, ...
239 'FontSize', fontsize,...
241 'Units', 'Pixels', ...
242 'FontName','Times New Roman');
246 xlabel('Band filling','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes1);
249 ylabel('E [\gamma]','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes1);
251 % reserve a variable for legend titles
254 % plot the non-interacting and self-consistent data
255 number_of_states = width*(2*height-1)*2;
256 if ~isempty( eig_no_interaction )
257 plot(filling_factors/number_of_states, eig_no_interaction, 'bo', 'Parent', axes1)
258 legend_labels{end+1} =
'U = 0';
261 if ~isempty( eig_spinup )
262 plot(filling_factors/number_of_states, eig_spinup,
'rx',
'Parent', axes1)
263 legend_labels{end+1} = [
'U = ', num2str(U/vargamma),
'\gamma spin up'];
267 fig_legend = legend(axes1, legend_labels);
268 set(fig_legend,
'FontSize', fontsize*0.8,
'FontName',
'Times New Roman',
'Box',
'off',
'Location',
'SouthEast')
270 % set the paper position in releases greater than 2016
271 ver = version(
'-release');
272 if str2num(ver(1:4)) >= 2016
273 % setting the position and margins of the plot, removing white spaces
274 figure1.PaperPositionMode =
'auto';
275 fig_pos = figure1.PaperPosition;
276 figure1.PaperSize = [fig_pos(3) fig_pos(4)];
279 set(axes1, 'Position', get(axes1, 'OuterPosition') - get(axes1, 'TightInset') * [-1 0 1 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1]);
280 Position_figure = get(axes1, 'OuterPosition');
281 set(figure1, 'Position', Position_figure);
285 print('-depsc2', fullfile(outputdir,[outfilename, '.eps']))
286 print('-dpdf', fullfile(outputdir,[outfilename, '.pdf']))
297 %> @brief Sets output directory.
299 resultsdir = 'results';
300 mkdir(fullfile(directory, resultsdir) );
301 outputdir = resultsdir;
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 ...
A class to evaluate self-consistent potentials depending on electron (spin resolved) densities.
function DensityCalc(filling_factor)
Calculates the density using the predefined graphene lattice framework (Ribbon class)
function CalcSelfconsistentPotential(filling_factor)
Calculates the self-consistent potential of a graphene island.
function CalcSelfConsistentSpectrum()
Calculates the self-consistent spectrum of a graphene island.
function ScatterPot(CreateH, E)
Stoner model in the scattering region (and removing unnecessary sites from the scattering region)
function Self_Consistent_Spectrum(filenum)
Example to calculate the self-consitent spectrum of a graphene quantum dot.
A class to calculate the onsite desnity useful for self-consistent calculations.
Structure param contains data structures describing the physical parameters of the scattering center ...
Structure sites contains data to identify the individual sites in a matrix.
function PlotFunction()
Creates the plot.
function structures(name)
Structure junction_sites contains data to identify the individual sites of the leads,...