Eötvös Quantum Utilities  v4.8.141
Providing the Horsepowers in the Quantum Realm
CreateHamiltonians.m
Go to the documentation of this file.
1 %% Eotvos Quantum Transport Utilities - CreateHamiltonians
2 % Copyright (C) 2009-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 basic Basic Functionalities
18 %> @{
19 %> @file CreateHamiltonians.m
20 %> @brief A class to create and store Hamiltonian of the scattering region
21 %> @}
22 %> @brief A class to create and store Hamiltonian of the scattering region
23 %%
25 
26  properties ( Access = protected )
27  %> An instance of structure param
28  param
29  %> A list of the sites to be kept after decimation.
30  kulso_szabfokok
31  %> Hscatter - E*Sscatter
32  Kscatter
33  %> Hscatter_transverse - E*Sscatter_transverse
34  Kscatter_transverse
35  %> The matrix of the Hamiltonian.
36  Hscatter
37  %> The matrix of the Hamiltonian corresponding to the transverse coupling.
38  Hscatter_transverse
39  %> The matrix of the overlap integrals in the Hamiltonian.
40  Sscatter
41  %> The matrix of the overlap integrals for the transverse coupling.
42  Sscatter_transverse
43  %> The matrix of the Peierls phases.
44  fazis_mtx_scatter
45  %> The matrix of the Peierls phases for the transverse coupling.
46  fazis_mtx_scatter_t
47  %> An instance of the structure coordinates.
48  coordinates
49  %> The length of the scattering region in units of the lattice contant.
50  height
51  %> The number of sites in the cross section.
52  width
53  %> The number of sites in one unit cell.
54  M
55  %> A logical value. True if the Hamiltonian was created, false otherwise.
56  HamiltoniansCreated
57  %> A logical value. True if the Hamiltonian was decimated, or false otherwise.
58  HamiltoniansDecimated
59  %> A logical value. True if the overlap integrals were applied, false otherwise.
60  OverlapApplied
61  %> A logical value. True if the vector potential was incorporated into the Hamiltonian or false otherwise.
62  MagneticFieldApplied
63  %> A logical value. True if a gauge transformation was applied on the Hamiltonians, or false otherwise.
64  GaugeTransformationApplied
65  %> A transverse momentum.
66  q
67  %> list of optional parameters (see http://www.mathworks.com/help/matlab/ref/varargin.html for details)
68  varargin
69 
70  end
71 
72 
73 methods ( Access = public )
74 %% constructorof the class
75 %> @brief Constructor of the class.
76 %> @param Opt An instance of the structure Opt.
77 %> @param param An instance of structure param.
78 %> @param varargin Cell array of optional parameters. For details see #InputParsing.
79 %> @return An instance of the class
80 function obj = CreateHamiltonians(Opt, param, varargin)
81  obj = obj@Messages( Opt );
82  obj.Opt = Opt;
83  obj.param = param;
84  obj.varargin = varargin;
85 
86  obj.Initialize();
87 
88 end
89 
90 %% CreateScatterH
91 %> @brief Creates a Hamiltonian of a rectangle shaped area. The created Hamiltonian and coordinates are stored within the object.
92 %> @param varargin Cell array of optional parameters:
93 %> @param 'Scatter_UC' An instance of class #CreateLeadHamiltonians or its subclass
94 %> @param 'CustomHamiltonian' An instance of class #Custom_Hamiltonians for external Hamiltonian source.
95 function CreateScatterH( obj, varargin )
96  p = inputParser;
97  p.addParameter('Scatter_UC', []);
98  p.addParameter('CustomHamiltonian', []);
99  p.parse(varargin{:});
100  Scatter_UC = p.Results.Scatter_UC;
101  CustomHamiltonian = p.Results.CustomHamiltonian;
102 
103  shape = obj.param.scatter.shape;
104 
105  obj.width = shape.width;
106  obj.height = shape.height; % number of unit cells!!!!!!!!
107 
108  if isempty(Scatter_UC)
109 
110  if strcmpi(obj.Opt.Lattice_Type, 'Square')
111  createH = Square_Lead_Hamiltonians();
112  [H0,H1,H1_transverse,coordinates_unitcell] = createH.SquareLattice_Lead_Hamiltonians(obj.param.scatter, obj.width, 'q', obj.q);
113  elseif strcmpi(obj.Opt.Lattice_Type, 'SSH')
114  createH = Square_Lead_Hamiltonians();
115  [H0,H1,H1_transverse,coordinates_unitcell] = createH.SSH_Lead_Hamiltonians(obj.param.scatter, 'q', obj.q);
116  elseif strcmp(obj.Opt.Lattice_Type, 'Lieb')
117  createH = Square_Lead_Hamiltonians();
118  [obj.H0,obj.H1,obj.H1_transverse,obj.coordinates] = createH.Lieb_Lead_Hamiltonians(obj.params, obj.width, 'q', obj.q);
119  obj.H1adj = obj.H1';
120  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene')
121  End_Type = obj.param.scatter.End_Type;
122  createH = Hex_Lead_Hamiltonians();
123  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Graphene_Lead_Hamiltonians(obj.param.scatter, obj.width, End_Type, 'q', obj.q);
124  elseif strcmpi(obj.Opt.Lattice_Type, 'Silicene')
125  End_Type = obj.param.scatter.End_Type;
126  createH = Hex_Lead_Hamiltonians();
127  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Silicene_Lead_Hamiltonians(obj.param.scatter, obj.width, End_Type, 'q', obj.q);
128  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene_Bilayer')
129  End_Type = obj.param.scatter.End_Type;
130  createH = Hex_Lead_Hamiltonians();
131  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Lead_Hamiltonians(obj.param.scatter, obj.width, End_Type, 'q', obj.q);
132  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene_Bilayer_2')
133  End_Type = obj.param.scatter.End_Type;
134  createH = Hex_Lead_Hamiltonians();
135  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Lead_Hamiltonians2(obj.param.scatter, obj.width, End_Type, 'q', obj.q);
136  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene_Bilayer_3')
137  End_Type = obj.param.scatter.End_Type;
138  createH = Hex_Lead_Hamiltonians();
139  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Lead_Hamiltonians3(obj.param.scatter, obj.width, End_Type, 'q', obj.q);
140  elseif ~isempty( obj.Opt.custom_Hamiltonians )
141  obj.queryHamiltonians( CustomHamiltonian );
142  return
143  else
144  error(['EQuUs:', class(obj), ':CreateScatterH:'], 'Unrecognized lattice type, or the claculation options are not set to use outher DFT source.')
145  end
146  else
147  H0 = Scatter_UC.Read( 'H0' );
148  H1 = Scatter_UC.Read( 'H1' );
149  H1_transverse = Scatter_UC.Read( 'H1_transverse' );
150  coordinates_unitcell = Scatter_UC.Read( 'coordinates' );
151  obj.MagneticFieldApplied = Scatter_UC.Read( 'MagneticFieldApplied' );
152  obj.GaugeTransformationApplied = Scatter_UC.Read( 'GaugeTransformationApplied' );
153  obj.width = size(H0, 1);
154  end
155 
156  H1adj = H1';
157  obj.M = size(H0,1);
158 
159  height = obj.height;
160  coordinates = structures( 'coordinates' );
161  coordinates.a = coordinates_unitcell.a;
162  coordinates.b = coordinates_unitcell.b;
163 
164  HCell = repmat({H1}, 1, height-1);
165  H1_big = blkdiag(HCell{:});
166  HCell = repmat({H1adj}, 1, height-1);
167  H1adj_big = blkdiag(HCell{:});
168  HCell = repmat({H0}, 1, height);
169  Hscatter = blkdiag(HCell{:});
170 
171  H1_big = [[sparse([],[],[], size(H1_big,1), size(H1,2)), H1_big]; sparse([],[],[], size(H1,1), size(H1_big,2)+size(H1,2))];
172  H1adj_big = [sparse([],[],[], size(H1,1), size(H1adj_big,1)+size(H1,2)); [H1adj_big, sparse([],[],[], size(H1adj_big,1), size(H1,2))]];
173 
174  Hscatter = Hscatter + H1_big + H1adj_big;
175 
176  if ~isempty(obj.q)
177  HCell = repmat({H1_transverse}, 1, height);
178  Hscatter_transverse = blkdiag(HCell{:});
179  else
180  Hscatter_transverse = [];
181  end
182  HCell = [];
183  coordfieldnames = fieldnames( coordinates_unitcell );
184  for idx = 1:length( coordfieldnames )
185  coordfieldname = coordfieldnames{idx};
186  if strcmpi( coordfieldname, 'a') || strcmpi( coordfieldname, 'b')
187  continue
188  elseif strcmpi( coordfieldname, 'x')
189  tmp = ones(size(coordinates_unitcell.x))*(coordinates_unitcell.a(1)*(0:height-1));
190  tmp = reshape(tmp, numel(tmp), 1);
191  coordinates.x = repmat(coordinates_unitcell.x, height, 1) + tmp;
192  elseif strcmpi( coordfieldname, 'y')
193  tmp = ones(size(coordinates_unitcell.y))*(coordinates_unitcell.a(2)*(0:height-1));
194  tmp = reshape(tmp, numel(tmp), 1);
195  coordinates.y = repmat(coordinates_unitcell.y, height, 1) + tmp;
196  elseif ~isempty(coordinates_unitcell.(coordfieldname))
197  coordinates.(coordfieldname) = repmat(coordinates_unitcell.(coordfieldname), height, 1);
198  end
199  end
200 
201 
202  obj.coordinates = coordinates;
203  obj.Hscatter = Hscatter;
204  obj.Hscatter_transverse = Hscatter_transverse;
205 
206  obj.HamiltoniansCreated = true;
207  obj.MagneticFieldApplied = false;
208  obj.GaugeTransformationApplied = false;
209  obj.OverlapApplied = false;
210  obj.HamiltoniansDecimated = false;
211 
212 
213 end
214 
215 
216 %% ApplyOverlapMatrices
217 %> @brief Applies the overlap matrices to the Hamiltonians: K = H-ES
218 %> @param E The energy value.
219  function ApplyOverlapMatrices(obj, E)
220 
221  if obj.OverlapApplied
222  obj.display(['EQuUs:', class(obj), ':ApplyOverlapMatrices: Overlap matrices were already applied.']);
223  return;
224  end
225 
226  if ~isempty( obj.Sscatter )
227  obj.Kscatter = obj.Hscatter - E*obj.Sscatter;
228  obj.OverlapApplied = true;
229  else
230  obj.Kscatter = obj.Hscatter - eye(size(obj.H0))*E;
231  end
232 
233 
234  if ~isempty( obj.Sscatter_transverse )
235  obj.Kscatter_transverse = obj.Hscatter_transverse - E*obj.Sscatter_transverse;
236  elseif ~isempty( obj.H1_transverse )
237  obj.Kscatter_transverse = obj.Hscatter_transverse;
238  end
239 
240  end
241 
242 %% shiftFermiEnergy
243 %> @brief Shifts the on-site energies in the Scattering region by a given energy.
244 %> @param Energy The energy value to be used.
245  function shiftFermiEnergy( obj, Energy )
246  if isempty( obj.Sscatter )
247  energyshift = speye( size( obj.Hscatter ) )*Energy;
248  else
249  energyshift = obj.Sscatter*Energy;
250  end
251 
252  obj.Hscatter = obj.Hscatter - energyshift;
253  if ~isempty( obj.param.scatter) && ~isempty( obj.param.scatter.epsilon )
254  obj.param.scatter.epsilon = obj.param.scatter.epsilon + Energy;
255  end
256  end
257 
258 %% projectHamiltonian2Spin
259 %> @brief Projects the Hamiltonian to a spin states of $s=\pm1$
260 %> @param s The quantum index of the spin (\pm1)
261  function projectHamiltonian2Spin( obj, s )
262  if s == 1
263  obj.coordinates.x = obj.coordinates.x(obj.coordinates.spinup);
264  obj.coordinates.y = obj.coordinates.y(obj.coordinates.spinup);
265  obj.Hscatter = obj.Hscatter( obj.coordinates.spinup, obj.coordinates.spinup);
266  if ~isempty(obj.q)
267  obj.Hscatter_transverse = obj.Hscatter_transverse( obj.coordinates.spinup, obj.coordinates.spinup);
268  end
269  elseif s == -1
270  obj.coordinates.x = obj.coordinates.x(~obj.coordinates.spinup);
271  obj.coordinates.y =obj. coordinates.y(~obj.coordinates.spinup);
272  obj.Hscatter = obj.Hscatter( ~obj.coordinates.spinup, ~obj.coordinates.spinup);
273  if ~isempty(obj.q)
274  obj.Hscatter_transverse = obj.Hscatter_transverse( ~obj.coordinates.spinup, ~obj.coordinates.spinup);
275  end
276  else
277  display(['EQuUs:', class(obj), ':projectHamiltonian2Spin: spin should be +/-1'], 1)
278  end
279 
280  obj.coordinates.spinup = [];
281  obj.M = obj.M/2;
282 
283 
284  end
285 
286 %% Reset
287 %> @brief Resets all elements in the class.
288  function Reset(obj)
289 
290  if strcmpi( class(obj), 'CreateHamiltonians' )
291  meta_data = metaclass(obj);
292 
293  for idx = 1:length(meta_data.PropertyList)
294  prop_name = meta_data.PropertyList(idx).Name;
295  if strcmp(prop_name, 'Opt') || strcmp( prop_name, 'param') || strcmp(prop_name, 'varargin')
296  continue
297  end
298  obj.Clear( prop_name );
299  end
300  end
301 
302  obj.Initialize();
303 
304 
305  end
306 
307 %% CreateClone
308 %> @brief Creates a clone of the present class.
309 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
310 %> @param 'empty' Set true to create an empty clone, or false (default) to clone all atributes.
311 %> @return Returns with the cloned object.
312  function ret = CreateClone( obj, varargin )
313 
314  p = inputParser;
315  p.addParameter('empty', false );
316 
317  p.parse(varargin{:});
318  empty = p.Results.empty;
319 
320  ret = CreateHamiltonians(obj.Opt, obj.param, obj.varargin{:});
321 
322  if empty
323  return
324  end
325 
326  meta_data = metaclass(obj);
327 
328  for idx = 1:length(meta_data.PropertyList)
329  prop_name = meta_data.PropertyList(idx).Name;
330  ret.Write( prop_name, obj.(prop_name));
331  end
332 
333  end
334 
335 
336 %% RemoveSites
337 %> @brief Removes specific sites from the model of the scattering region. For example see function #ScatterPotQD.
338 %> @param indexes Logical array. Sites with true values will be removed from the system.
339  function RemoveSites( obj, indexes )
340 
341  % update the array of external degrees of freedom
342  if ~isempty( obj.kulso_szabfokok )
343  all_sites = 1:size(obj.Hscatter,1);
344  sites2remove = all_sites( indexes );
345 
346  for idx = length(sites2remove):-1:1
347  indexes_tmp = find( obj.kulso_szabfokok == sites2remove(idx), 1 );
348  if ~isempty(indexes_tmp)
349  error(['EQuUs:', class(obj), ':RemoveSites'], 'Sites cannot be removed from the Hamiltonian.');
350  end
351 
352  indexes_tmp = obj.kulso_szabfokok > sites2remove(idx);
353  obj.kulso_szabfokok(indexes_tmp) = obj.kulso_szabfokok(indexes_tmp) - 1;
354  end
355  end
356 
357  % removing sites from the scattering Hamiltonian
358  obj.Hscatter = obj.Hscatter(~indexes, ~indexes);
359 
360  % removing sites from the matrix of the transverse coupling
361  if ~isempty(obj.Hscatter_transverse)
362  obj.Hscatter_transverse = obj.Hscatter_transverse(~indexes, ~indexes);
363  end
364 
365  % removing sites from the matrix of the overlap integrals
366  if ~isempty(obj.Sscatter )
367  obj.Sscatter = obj.Sscatter(~indexes, ~indexes);
368  end
369 
370  % removing sites from the matrix of the overlap integrals of the transverse coupling
371  if ~isempty(obj.Sscatter_transverse )
372  obj.Sscatter_transverse = obj.Sscatter_transverse(~indexes, ~indexes);
373  end
374 
375  % removing sites from the matrix of the Peierls phases
376  if ~isempty(obj.fazis_mtx_scatter )
377  obj.fazis_mtx_scatter = obj.fazis_mtx_scatter(~indexes, ~indexes);
378  end
379 
380  % removing sites from the matrix of the Peierls phases of the transverse coupling
381  if ~isempty(obj.fazis_mtx_scatter_t )
382  obj.fazis_mtx_scatter_t = obj.fazis_mtx_scatter_t(~indexes, ~indexes);
383  end
384 
385  % removing sites from structure coordinates
386  obj.coordinates = obj.coordinates.RemoveSites( indexes );
387 
388 
389  end
390 
391 %% saveScatterHamiltonian
392 %> @brief Saves the Hamiltonian and other data of the scattering region
393 %> @param filename The string containing the path to the file. (In octave use absolute paths only)
394  function saveScatter( filename )
395  if ~exist('filename', 'var')
396  filename = 'Hscatter.mat';
397  end
398  save(filename,'Hscatter', 'Hscatter_transverse', 'coordinates', 'param', 'fazis_mtx_scatte', 'fazis_mtx_scatte_t', 'width', 'height', 'M')
399  end
400 
401 %% LoadHamiltonian
402 %> @brief Loads the Hamiltonian and other data of the scattering region from a file.
403 %> @param filename The string containing the path to the file. (In octave use absolute paths only)
404  function loadScatter( obj, filename )
405  if ~exist('filename', 'var')
406  filename = 'Hscatter.mat';
407  end
408  disp('EQuUs::CreateHamiltonian::loadScatter: Loading scatter Hamiltonian from file')
409  HandleForLoad = LoadFromFile( filename );
410  obj.Hscatter = HandleForLoad.LoadVariable('Hscatter', 'NoEmpty', 'On');
411  obj.Hscatter_transverse = HandleForLoad.LoadVariable('Hscatter_transverse', 'NoEmpty', 'On');
412  obj.Sscatter = HandleForLoad.LoadVariable('Sscatter', 'NoEmpty', 'On');
413  obj.Sscatter_transverse = HandleForLoad.LoadVariable('Sscatter_transverse', 'NoEmpty', 'On');
414  obj.coordinates = HandleForLoad.LoadVariable('coordinates', 'NoEmpty', 'On');
415  obj.fazis_mtx_scatter = HandleForLoad.LoadVariable('fazis_mtx_scatte', 'NoEmpty', 'Off');
416  obj.fazis_mtx_scatter_t = HandleForLoad.LoadVariable('fazis_mtx_scatte_t', 'NoEmpty', 'Off');
417  obj.param = HandleForLoad.LoadVariable('param', 'NoEmpty', 'On');
418  obj.M = HandleForLoad.LoadVariable('M', 'NoEmpty', 'On');
419  obj.width = HandleForLoad.LoadVariable('width', 'NoEmpty', 'Off');
420  obj.height = HandleForLoad.LoadVariable('height', 'NoEmpty', 'On');
421  obj.q = HandleForLoad.LoadVariable('q', 'NoEmpty', 'On');
422  HandleForLoad.ClearLoadedVariable();
423 end
424 
425 %% Write
426 %> @brief Sets the value of an attribute in the class.
427 %> @param MemberName The name of the attribute to be set.
428 %> @param input The value to be set.
429  function Write(obj, MemberName, input)
430 
431  if strcmp(MemberName, 'param')
432  obj.param = input;
433  obj.Reset();
434  return
435  elseif strcmp(MemberName, 'params')
436  obj.param.scatter = input;
437  return
438  else
439  try
440  obj.(MemberName) = input;
441  catch
442  error(['EQuUs:', class(obj), ':Read'], ['No property to write with name: ', MemberName]);
443  end
444  end
445 
446  end
447 
448 %% Read
449 %> @brief Query for the value of an attribute in the class.
450 %> @param MemberName The name of the attribute to be set.
451 %> @return Returns with the value of the attribute.
452  function ret = Read(obj, MemberName)
453  try
454  ret = obj.(MemberName);
455  catch
456  error(['EQuUs:', class(obj), ':Read'], ['No property to read with name: ', MemberName]);
457  end
458  end
459 
460 %% MemberClear
461 %> @brief Clears the value of an attribute in the class.
462 %> @param MemberName The name of the attribute to be cleared.
463  function Clear(obj, MemberName)
464  try
465  obj.(MemberName) = [];
466  catch
467  error(['EQuUs:', class(obj), ':Clear'], ['No property to clear with name: ', MemberName]);
468  end
469 
470  end
471 
472 end % methods public
473 
474 methods ( Access = private )
475 
476 
477 %% Initialize
478 %> @brief Initializes object attributes.
479  function Initialize(obj)
480 
481  obj.coordinates = structures('coordinates');
482  obj.HamiltoniansCreated = false;
483  obj.HamiltoniansDecimated = false;
484  obj.MagneticFieldApplied = false;
485  obj.GaugeTransformationApplied = false;
486  obj.OverlapApplied = false;
487 
488  obj.InputParsing( obj.varargin{:} );
489  end
490 
491 %% queryHamiltonians
492 %> @brief Obtains Hamiltonians from a class instance Custom_Hamiltonians
493 %> @param cCustom_Hamiltonians An instance of class #Custom_Hamiltonians
494  function queryHamiltonians( obj, cCustom_Hamiltonians )
495  if isempty( cCustom_Hamiltonians )
496  cCustom_Hamiltonians = Custom_Hamiltonians( obj.Opt );
497  end
498 
499  if ~cCustom_Hamiltonians.Read( 'Hamiltonians_loaded' )
500  cCustom_Hamiltonians.LoadHamiltonians();
501  end
502 
503  obj.coordinates = cCustom_Hamiltonians.Read( 'coordinates_scatter' );
504  obj.Hscatter = cCustom_Hamiltonians.Read( 'Hscatter' );
505  obj.Hscatter_transverse = cCustom_Hamiltonians.Read( 'Hscatter_transverse' );
506  obj.Sscatter = cCustom_Hamiltonians.Read( 'Sscatter' );
507  obj.Sscatter_transverse = cCustom_Hamiltonians.Read( 'Sscatter_transverse' );
508  obj.HamiltoniansCreated = true;
509  obj.MagneticFieldApplied = false;
510  obj.GaugeTransformationApplied = false;
511  obj.HamiltoniansDecimated = false;
512 
513  % determine kulso_szabfokok
514  Hcoupling = cCustom_Hamiltonians.Read( 'Hcoupling' );
515 
516  if iscell( Hcoupling )
517  for idx = 1:length( Hcoupling )
518  coupled_sites = CoupledSites( Hcoupling{idx} );
519  obj.kulso_szabfokok = [obj.kulso_szabfokok, coupled_sites];
520  end
521  obj.kulso_szabfokok = unique( obj.kulso_szabfokok );
522  else
523  obj.kulso_szabfokok = CoupledSites( Hcoupling );
524  end
525 
526 
527  % tranforming into the BdG model if necessary
528  if ~isempty( obj.Opt.BdG ) && obj.Opt.BdG
529  obj.Transforms2BdG()
530  end
531 
532  % nested functions
533 
534  % determine sites coupled to the leads
535  function ret = CoupledSites( Hcoupling )
536  [rows, cols] = find(Hcoupling);
537  ret = unique( cols );
538  ret = reshape(ret, 1, numel(ret));
539  end
540 
541  % end nested functions
542  end
543 
544 %% Transforms2BdG
545 %> @brief Transforms the Hamiltonians into a Bogoliubov de Gennes model.
546  function Transforms2BdG( obj )
547  if isempty( obj.param.scatter.pair_potential )
548  error('CreateHamiltonian:Transform2BdG', 'Pair potential need to be set for the scattering region.');
549  end
550 
551  if ~isempty(obj.coordinates.BdG_u)
552  obj.display('Hamiltonians already transformed to BdG model.')
553  return
554  end
555 
556  fnames = fieldnames( obj.coordinates );
557  for idx = 1:length(fnames)
558  fname = fnames{idx};
559  if strcmp(fname, 'a') || strcmp(fname, 'b')
560  continue
561  end
562  obj.coordinates.(fname) = [ obj.coordinates.(fname); obj.coordinates.(fname) ];
563  end
564 
565  obj.coordinates.BdG_u = [ true(size(obj.Hscatter,1),1), false(size(obj.Hscatter,1),1)];
566 
567  length_kulso_szabfokok = length(obj.kulso_szabfokok);
568  obj.kulso_szabfokok = [obj.kulso_szabfokok(1:length_kulso_szabfokok), obj.kulso_szabfokok(1:length_kulso_szabfokok)+size(obj.Hscatter,1) ];
569 
570  % transforming the Hamiltonians
571  pair_potential = obj.param.scatter.pair_potential;
572  site_num = size( obj.Hscatter, 1 );
573  obj.coordinates.BdG_u = [true( site_num, 1); false( site_num, 1) ];
574 
575  if isempty( obj.Sscatter )
576  Sscatter = speye(size(obj.Hscatter));
577  else
578  Sscatter = obj.Sscatter;
579  end
580 
581  obj.Hscatter = [ obj.Hscatter, Sscatter*pair_potential;
582  Sscatter*conj(pair_potential), -conj(obj.Hscatter) ];
583 
584  % transforming the overlap integrals
585  if isempty( obj.Sscatter )
586  return;
587  end
588 
589  obj.Sscatter = [ obj.Sscatter, sparse([],[],[], site_num, site_num );
590  sparse([],[],[], site_num, site_num ), obj.Sscatter ];
591 
592 
593  end
594 
595 %% InputParsing
596 %> @brief Parses the optional parameters for the class constructor.
597 %> @param varargin Optional parameters, see the web documantation.
598 %> @param 'q' The transverse momentum quantum number.
599  function InputParsing( obj, varargin)
600 
601  p = inputParser;
602  p.addParameter('q', []);
603 
604  p.parse(varargin{:});
605 
606  obj.q = p.Results.q;
607 
608  end
609 
610 
611 end %methods protected
612 
613 end % Global end
614 
function LoadHamiltonians(varargin)
Obtain the Hamiltonians from the external source.
function InputParsing(varargin)
Parses the optional parameters for the class constructor.
function Custom_Hamiltonians(Opt, param, varargin)
Constructor of the class.
A class containing methodes for displaying several standard messages.
Definition: Messages.m:24
Structure Opt contains the basic computational parameters used in EQuUs.
Definition: structures.m:120
Structure shape contains data about the geometry of the scattering region.
Definition: structures.m:166
Class to create and store Hamiltonian of the translational invariant leads.
Class to create the Hamiltonian of one unit cell in a translational invariant lead made of square lat...
function display(message, nosilent)
Displays output messages on the screen.
Property varargin
list of optional parameters (see InputParsing for details)
function Transport(Energy, B)
creating the Ribbon class representing the twoterminal setup
function Reset()
Resets all elements in the object.
Property Sscatter_transverse
overlap integrals for the transverse coupling in the scattering region
function Hamiltonians(varargin)
Function to create the custom Hamiltonians for the 1D chain.
function Initialize()
Initializes object properties.
Property Hcoupling
Cell array of couplings between the scattering region and the leads.
Property Sscatter
Overlap integrals of the scattering region.
function Write(MemberName, input)
Sets the value of an attribute in the class.
A class to import custom Hamiltonians provided by other codes or created manually ...
Property H0
Cell array of Hamiltonians of one slab in the leads.
epsilon
A physical parameter, see the individual lattice documentations for details.
Definition: structures.m:56
Property Hscatter_transverse
transverse coupling for the scattering region
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
scatter_param scatter
An instance of the structure scatter_param containing the physical parameters for the scattering regi...
Definition: structures.m:47
Structure sites contains data to identify the individual sites in a matrix.
Definition: structures.m:247
function Clear(MemberName)
Clears the value of an attribute in the class.
Property coordinates
Cell array of coordinates of the leads.
Property Opt
An instance of structure Opt.
Definition: Messages.m:31
Property H1
Cell array of couplings between the slabs of the leads.
Property Hscatter
Hamiltonian of the scattering region.
A class responsible for the Peierls and gauge transformations.
Definition: Peierls.m:24
function Read(MemberName)
Query for the value of an attribute in the class.
Property param
An instance of structure param.
width
The number of sites in the cross section.
Definition: structures.m:168
Property H1_transverse
Cell array of transverse coupling between the unit cells of the lead.
A class providing interface to load variables from a file.
Definition: LoadFromFile.m:24
function structures(name)
height
Number of unit cells along the logitudinal direction in the scattering region.
Definition: structures.m:170
A class to create and store Hamiltonian of the scattering region.