Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
Self_Consistent_Spectrum.m
Go to the documentation of this file.
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.
4 %
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.
9 %
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.
14 %
15 % You should have received a copy of the GNU General Public License
16 % along with this program. If not, see http://www.gnu.org/licenses/.
17 %
18 %> @addtogroup Examples
19 %> @{
20 %> @file Self_Consistent_Spectrum.m
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).
23 %> @reference
24 %> S. Krompiewski, Nanotechnology 25 465201 (2014).
25 %> @Available
26 %> EQuUs v4.9 or later
27 %> @expectedresult
28 %> @image html Self_Consistent_Spectrum.jpg
29 %> @image latex Self_Consistent_Spectrum.jpg
30 %> @}
31 %
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).
34 function Self_Consistent_Spectrum( filenum )
35 
36 if ~exist('filenum', 'var')
37  filenum = 1;
38 end
39 
40 filename = mfilename('fullpath');
41 [directory, fncname] = fileparts( filename );
42 
43  % filename containing the input XML
44  inputXML = 'Input.xml';
45  % Parsing the input file and creating data structures
46  [Opt, param] = parseInput( fullfile( directory, inputXML ) );
47  % The hopping amplitude between the sites
48  vargamma = param.scatter.vargamma;
49 
50 
51  % Strength of the self-consitent intercation in the Hubbard model
52  U = -0.6*vargamma;
53  % Zeeman energy for the initial iteration to bring the system out of the trivial solution
54  Zeeman_energy = 0.5*vargamma;
55  % The Fermi energy
56  EF = 0; % in eV
57  % temperature in K
58  T = 0;
59  % width of the junction
60  width = 22;
61  % length of the junction
62  height = 9;
63  % filename containing the output XML
64  outfilename = [fncname,'_',num2str( filenum )];
65  % the output folder
66  outputdir = [];
67  % false to supress output messages
68  silent = false;
69 
70  % the calculated energy eigenvalues in the non-interacting and in the self-consistent cases
71  filling_factors = [];
72  eig_spinup = [];
73  eig_no_interaction = [];
74 
75 
76  % Class for self-consistent iterations
77  cSelfConsistent = [];
78 
79  % creating output directories
80  setOutputDir();
81 
82  % Creates the class for self-consistent iterations
83  cSelfConsistent = SelfConsistent( Opt, 'magnetizaion_direction', []) ;
84 
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']) );
87 
88  % Calculates the self-consistent spectrum of graphene island
90 
91  % creates the plot
92  PlotFunction()
93 
94  % export the calculeted data
95  save( [outputdir, filesep, outfilename,'.mat']);
96 
97 
99 %> @brief Calculates the self-consistent spectrum of a graphene island
101 
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;
106 
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);
111 
112  % calculating the non-interacting eigenvalues
113 
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;
121 
122  % calculating the self-consistent eigenvalues
123 
124  % calculate the sel-consistent potential
125  CalcSelfconsistentPotential( filling_factor )
126 
127  % creating the Hamiltonian of the scattering region
128  cRibbon.CreateScatter();
129  CreateH = cRibbon.CreateH;
130  pot = ScatterPot(CreateH, 0);
131  Hscatter = CreateH.Read('Hscatter');
132  Hscatter_Self_consistent = Hscatter + diag(pot);
133 
134  % calculate the self-consistent energy eigenvalues
135  eigvals = eig(Hscatter_Self_consistent)/vargamma;
136  eig_spinup = eigvals(filling_factors);
137 
138 
139  end
140 
141 
142 
144 %> @brief Calculates the self-consistent potential of a graphene island
145  function CalcSelfconsistentPotential( filling_factor )
146  % reset the self-consistent class to forget previous iterations, but keep the last calculated density
147  cSelfConsistent.Reset();
148 
149  % Do the self-consistent iterations with function handle pointing to a Stoner model
150  cSelfConsistent.runSelfConsistentIterations( @()DensityCalc(filling_factor) );
151 
152 
153  end
154 
155 
156 
157 %% DensityCalc
158 %> @brief Calculates the density using the predefined graphene lattice framework (Ribbon class)
159  function [density_data, junction_sites_spinup] = DensityCalc( filling_factor )
160 
161  % create Density class
162  cDensity = Density(Opt, 'T', T, 'scatterPotential', @(CreateH, E)(ScatterPot(CreateH, E)), 'junction', cRibbon);
163 
164  % Calculate the density
165  [density_data, junction_sites_spinup] = cDensity.DensityCalcSmall(filling_factor);
166 
167  end
168 
169 %% ScatterPot
170 %> @brief Stoner model in the scattering region (and removing unnecessary sites from the scattering region)
171  function ret = ScatterPot(CreateH, E)
172 
173 
174  % determine sites to be removed to reproduce the scattering region in 2014 Nanotechnology 25 465201
175  CreateH.Write('kulso_szabfokok', []);
176 
177  coordinates = CreateH.Read('coordinates');
178  y = coordinates.y;
179  max_y = max(y);
180 
181  indexes2remove = ~(y<max_y);
182  CreateH.RemoveSites( indexes2remove )
183 
184 
185  if isempty(cSelfConsistent.density)
186 
187  coordinates = CreateH.Read('coordinates');
188 
189  % adding Zeeman term at the edges the first iteration to bring the
190  %system put of the trivial solution
191  x = coordinates.x;
192  min_x = min(x);
193  max_x = max(x);
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);
197  return
198  end
199 
200  % Hubbard model
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);
207 % end
208 
209  % Stoner interaction model of Nanotechnology 25 (2014) 465201
210  coordinates = CreateH.Read('coordinates');
211  ret = zeros(size(coordinates.x));
212 
213  scatter_density = cSelfConsistent.density(cSelfConsistent.junction_sites.Scatter.site_indexes);
214 
215  density_scatter_spinup = scatter_density(cSelfConsistent.junction_sites.Scatter.coordinates.spinup);
216  density_scatter_spindown = scatter_density(~cSelfConsistent.junction_sites.Scatter.coordinates.spinup);
217 
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);
220 
221 
222  end
223 
224 
225 
226 %% PlotFunction
227 %> @brief Creates the plot
229 
230  % creating figure in units of pixels
231  figure1 = figure( 'Units', 'Pixels', 'Visible', 'off');
232 
233  % font size on the figure will be 16 points
234  fontsize = 16;
235 
236  % creating axes of the plot
237  axes1 = axes('Parent',figure1, ...
238  'Visible', 'on',...
239  'FontSize', fontsize,...
240  'Box', 'on',...
241  'Units', 'Pixels', ...
242  'FontName','Times New Roman');
243  hold on;
244 
245  % Create xlabel
246  xlabel('Band filling','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes1);
247 
248  % Create ylabel
249  ylabel('E [\gamma]','FontSize', fontsize,'FontName','Times New Roman', 'Parent', axes1);
250 
251  % reserve a variable for legend titles
252  legend_labels = [];
253 
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';
259  end
260 
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'];
264  end
265 
266  % set the legends
267  fig_legend = legend(axes1, legend_labels);
268  set(fig_legend, 'FontSize', fontsize*0.8, 'FontName','Times New Roman', 'Box', 'off', 'Location', 'SouthEast')
269 
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)];
277  end
278 
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);
282 
283 
284  % export the figures
285  print('-depsc2', fullfile(outputdir,[outfilename, '.eps']))
286  print('-dpdf', fullfile(outputdir,[outfilename, '.pdf']))
287  close(figure1)
288 
289 
290 
291 
292  end
293 
294 
295 
296 %% setOutputDir
297 %> @brief Sets output directory.
299  resultsdir = 'results';
300  mkdir(fullfile(directory, resultsdir) );
301  outputdir = resultsdir;
302  end
303 
304 
305 
306 
307 end
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
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()
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.
Definition: Density.m:26
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
Structure sites contains data to identify the individual sites in a matrix.
Definition: structures.m:187
function parseInput(filename)
This function parses the input file containing the input parameters.
function PlotFunction()
Creates the plot.
function structures(name)
Structure junction_sites contains data to identify the individual sites of the leads,...
Definition: structures.m:176