Eötvös Quantum Utilities  v5.0.144
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 ~isempty( obj.Opt.custom_Hamiltonians )
111  obj.queryHamiltonians( CustomHamiltonian );
112  return
113  elseif strcmpi(obj.Opt.Lattice_Type, 'Square')
114  createH = Square_Lead_Hamiltonians();
115  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Square_Hamiltonians(obj.param.scatter, obj.width);
116  H1_skew_left = [];
117  H1_skew_right = [];
118  elseif strcmpi(obj.Opt.Lattice_Type, 'SSH')
119  createH = Square_Lead_Hamiltonians();
120  [H0,H1,H1_transverse,coordinates_unitcell] = createH.SSH_Hamiltonians(obj.param.scatter);
121  H1_skew_left = [];
122  H1_skew_right = [];
123  elseif strcmp(obj.Opt.Lattice_Type, 'Lieb')
124  createH = Square_Lead_Hamiltonians();
125  [H0,H1,H1_transverse,obj.coordinates] = createH.Lieb_Hamiltonians(obj.param.scatter, obj.width);
126  H1_skew_left = [];
127  H1_skew_right = [];
128  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene')
129  End_Type = obj.param.scatter.End_Type;
130  createH = Hex_Lead_Hamiltonians();
131  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Graphene_Hamiltonians(obj.param.scatter, obj.width, End_Type);
132  H1_skew_left = [];
133  H1_skew_right = [];
134  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene_SOC')
135  End_Type = obj.param.scatter.End_Type;
136  createH = Graphene_SOC_Lead_Hamiltonians();
137  [H0, H1, H1_transverse, H1_skew_left, H1_skew_right, coordinates_unitcell] = createH.Graphene_SOC_Hamiltonians(obj.param.scatter, obj.width, End_Type);
138  elseif strcmpi(obj.Opt.Lattice_Type, 'Silicene')
139  End_Type = obj.param.scatter.End_Type;
140  createH = Silicene_Lead_Hamiltonians();
141  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Silicene_Hamiltonians(obj.param.scatter, obj.width, End_Type);
142  H1_skew_left = [];
143  H1_skew_right = [];
144  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene_Bilayer')
145  End_Type = obj.param.scatter.End_Type;
147  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Hamiltonians(obj.param.scatter, obj.width, End_Type);
148  H1_skew_left = [];
149  H1_skew_right = [];
150  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene_Bilayer_2')
151  End_Type = obj.param.scatter.End_Type;
153  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Hamiltonians2(obj.param.scatter, obj.width, End_Type);
154  H1_skew_left = [];
155  H1_skew_right = [];
156  elseif strcmpi(obj.Opt.Lattice_Type, 'Graphene_Bilayer_3')
157  End_Type = obj.param.scatter.End_Type;
159  [H0,H1,H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Hamiltonians3(obj.param.scatter, obj.width, End_Type);
160  H1_skew_left = [];
161  H1_skew_right = [];
162  elseif strcmpi(obj.Opt.Lattice_Type, 'Triangle')
163  createH = Triangle_Lead_Hamiltonians();
164  [H0, H1, H1_transverse, H1_skew_left, coordinates_unitcell] = createH.Triangle_Hamiltonians(obj.param.scatter, obj.width);
165  H1_skew_right = [];
166  elseif strcmpi(obj.Opt.Lattice_Type, 'TMDC_Monolayer')
168  [H0, H1, H1_transverse, H1_skew_left, coordinates_unitcell] = createH.TMDC_Monolayer_Hamiltonians(obj.param.scatter, obj.width)
169  H1_skew_right = [];
170  elseif strcmpi(obj.Opt.Lattice_Type, 'TMDC_Monolayer_SOC')
172  [H0, H1, H1_transverse, H1_skew_left, coordinates_unitcell] = createH.TMDC_Monolayer_SOC_Hamiltonians(obj.param.scatter, obj.width);
173  H1_skew_right = [];
174  elseif strcmpi(obj.Opt.Lattice_Type, 'TMDC_Bilayer_SOC')
176  [H0, H1, H1_transverse, H1_skew_left, coordinates_unitcell] = createH.TMDC_Bilayer_SOC_Hamiltonians(obj.param.scatter, obj.width);
177  H1_skew_right = [];
178  else
179  error('Unrecognized lattice type, or the claculation options are not set to use outher DFT source.')
180  end
181  else
182  H0 = Scatter_UC.Read( 'H0' );
183  H1 = Scatter_UC.Read( 'H1' );
184  H1_transverse = Scatter_UC.Read( 'H1_transverse' );
185  H1_skew_left = Scatter_UC.Read( 'H1_skew_left' );
186  H1_skew_right = Scatter_UC.Read( 'H1_skew_right' );
187  coordinates_unitcell = Scatter_UC.Read( 'coordinates' );
188  obj.MagneticFieldApplied = Scatter_UC.Read( 'MagneticFieldApplied' );
189  obj.GaugeTransformationApplied = Scatter_UC.Read( 'GaugeTransformationApplied' );
190  obj.width = size(H0, 1);
191  end
192 
193  H1adj = H1';
194  obj.M = size(H0,1);
195 
196  height = obj.height;
198  coordinates.a = coordinates_unitcell.a;
199  coordinates.b = coordinates_unitcell.b;
200 
201  % creating coupling between the unit cells
202  HCell = repmat({H1}, 1, height-1);
203  H1_big = blkdiag(HCell{:});
204  H1_big = [ [sparse([],[],[], size(H1_big,1), size(H1,2)), H1_big]; sparse([],[],[], size(H1,1), size(H1_big,2)+size(H1,2))];
205 
206  % creating coupling between the unit cells in the opposite direction
207  HCell = repmat({H1adj}, 1, height-1);
208  H1adj_big = blkdiag(HCell{:});
209  H1adj_big = [sparse([],[],[], size(H1,1), size(H1adj_big,1)+size(H1,2)); [H1adj_big, sparse([],[],[], size(H1adj_big,1), size(H1,2))]];
210 
211  % creating Hamiltonian of the unit cells
212  HCell = repmat({H0}, 1, height);
213  Hscatter = blkdiag(HCell{:});
214 
215 
216  % adding coupling between the unit cells
217  Hscatter = Hscatter + H1_big + H1adj_big;
218 
219  % creating the transverse coupling
220  if ~isempty(obj.q)
221  HCell = repmat({H1_transverse}, 1, height);
222  Hscatter_transverse = blkdiag(HCell{:});
223 
224  % adding skew_left couplings
225  if ~isempty( H1_skew_left )
226  HCell = repmat( {H1_skew_left}, 1, height-1 );
227  H1_skew_left_big = blkdiag(HCell{:});
228  H1_skew_left_big = [ [sparse([],[],[], size(H1_skew_left_big,1), size(H1_skew_left,2)), H1_skew_left_big]; sparse([],[],[], size(H1_skew_left,1), size(H1_skew_left_big,2)+size(H1_skew_left,2)) ];
229  Hscatter_transverse = Hscatter_transverse + H1_skew_left_big;
230  end
231 
232  % adding skew_right couplings
233  if ~isempty( H1_skew_right )
234  HCell = repmat( {H1_skew_right}, 1, height-1 );
235  H1_skew_right_big = blkdiag(HCell{:});
236  H1_skew_right_big = [ sparse([],[],[], size(H1_skew_right,1), size(H1_skew_right_big,2)+size(H1_skew_right,2)); [H1_skew_right_big, sparse([],[],[], size(H1_skew_right_big,1), size(H1_skew_right,2))] ];
237  Hscatter_transverse = Hscatter_transverse + H1_skew_right_big;
238  end
239 
240 
241 
242  else
243  Hscatter_transverse = [];
244  end
245 
246  coordfieldnames = fieldnames( coordinates_unitcell );
247  for idx = 1:length( coordfieldnames )
248  coordfieldname = coordfieldnames{idx};
249  if strcmpi( coordfieldname, 'a') || strcmpi( coordfieldname, 'b') || strcmpi( coordfieldname, 'LatticeConstant')
250  continue
251  elseif strcmpi( coordfieldname, 'x')
252  tmp = ones(size(coordinates_unitcell.x))*(coordinates_unitcell.a(1)*(0:height-1));
253  tmp = reshape(tmp, numel(tmp), 1);
254  coordinates.x = repmat(coordinates_unitcell.x, height, 1) + tmp;
255  elseif strcmpi( coordfieldname, 'y')
256  tmp = ones(size(coordinates_unitcell.y))*(coordinates_unitcell.a(2)*(0:height-1));
257  tmp = reshape(tmp, numel(tmp), 1);
258  coordinates.y = repmat(coordinates_unitcell.y, height, 1) + tmp;
259  elseif ~isempty(coordinates_unitcell.(coordfieldname))
260  coordinates.(coordfieldname) = repmat(coordinates_unitcell.(coordfieldname), height, 1);
261  end
262  end
263 
264 
265  obj.coordinates = coordinates;
266  obj.Hscatter = Hscatter;
268 
269  obj.HamiltoniansCreated = true;
270  obj.MagneticFieldApplied = false;
271  obj.GaugeTransformationApplied = false;
272  obj.OverlapApplied = false;
273  obj.HamiltoniansDecimated = false;
274 
275 
276 end
277 
278 
279 %% ApplyOverlapMatrices
280 %> @brief Applies the overlap matrices to the Hamiltonians: K = H-ES
281 %> @param E The energy value.
282  function ApplyOverlapMatrices(obj, E)
283 
284  if obj.OverlapApplied
285  obj.display(['EQuUs:', class(obj), ':ApplyOverlapMatrices: Overlap matrices were already applied.']);
286  return;
287  end
288 
289  if ~isempty( obj.Sscatter )
290  obj.Kscatter = obj.Hscatter - E*obj.Sscatter;
291  obj.OverlapApplied = true;
292  else
293  obj.Kscatter = obj.Hscatter - eye(size(obj.H0))*E;
294  end
295 
296 
297  if ~isempty( obj.Sscatter_transverse )
298  obj.Kscatter_transverse = obj.Hscatter_transverse - E*obj.Sscatter_transverse;
299  elseif ~isempty( obj.H1_transverse )
300  obj.Kscatter_transverse = obj.Hscatter_transverse;
301  end
302 
303  end
304 
305 %% shiftFermiEnergy
306 %> @brief Shifts the on-site energies in the Scattering region by a given energy.
307 %> @param Energy The energy value to be used.
308  function shiftFermiEnergy( obj, Energy )
309  if isempty( obj.Sscatter )
310  energyshift = speye( size( obj.Hscatter ) )*Energy;
311  else
312  energyshift = obj.Sscatter*Energy;
313  end
314 
315  obj.Hscatter = obj.Hscatter - energyshift;
316  if ~isempty( obj.param.scatter) && ~isempty( obj.param.scatter.epsilon )
317  obj.param.scatter.epsilon = obj.param.scatter.epsilon + Energy;
318  end
319  end
320 
321 %% projectHamiltonian2Spin
322 %> @brief Projects the Hamiltonian to a spin states of $s=\pm1$
323 %> @param s The quantum index of the spin (\pm1)
324  function projectHamiltonian2Spin( obj, s )
325  if s == 1
326  obj.coordinates.x = obj.coordinates.x(obj.coordinates.spinup);
327  obj.coordinates.y = obj.coordinates.y(obj.coordinates.spinup);
328  obj.Hscatter = obj.Hscatter( obj.coordinates.spinup, obj.coordinates.spinup);
329  if ~isempty(obj.q)
330  obj.Hscatter_transverse = obj.Hscatter_transverse( obj.coordinates.spinup, obj.coordinates.spinup);
331  end
332  elseif s == -1
333  obj.coordinates.x = obj.coordinates.x(~obj.coordinates.spinup);
334  obj.coordinates.y =obj. coordinates.y(~obj.coordinates.spinup);
335  obj.Hscatter = obj.Hscatter( ~obj.coordinates.spinup, ~obj.coordinates.spinup);
336  if ~isempty(obj.q)
337  obj.Hscatter_transverse = obj.Hscatter_transverse( ~obj.coordinates.spinup, ~obj.coordinates.spinup);
338  end
339  else
340  display(['EQuUs:', class(obj), ':projectHamiltonian2Spin: spin should be +/-1'], 1)
341  end
342 
343  obj.coordinates.spinup = [];
344  obj.M = obj.M/2;
345 
346 
347  end
348 
349 %% Reset
350 %> @brief Resets all elements in the class.
351  function Reset(obj)
352 
353  if strcmpi( class(obj), 'CreateHamiltonians' )
354  meta_data = metaclass(obj);
355 
356  for idx = 1:length(meta_data.PropertyList)
357  prop_name = meta_data.PropertyList(idx).Name;
358  if strcmp(prop_name, 'Opt') || strcmp( prop_name, 'param') || strcmp(prop_name, 'varargin')
359  continue
360  end
361  obj.Clear( prop_name );
362  end
363  end
364 
365  obj.Initialize();
366 
367 
368  end
369 
370 %% CreateClone
371 %> @brief Creates a clone of the present class.
372 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
373 %> @param 'empty' Set true to create an empty clone, or false (default) to clone all atributes.
374 %> @return Returns with the cloned object.
375  function ret = CreateClone( obj, varargin )
376 
377  p = inputParser;
378  p.addParameter('empty', false );
379 
380  p.parse(varargin{:});
381  empty = p.Results.empty;
382 
383  ret = CreateHamiltonians(obj.Opt, obj.param, obj.varargin{:});
384 
385  if empty
386  return
387  end
388 
389  meta_data = metaclass(obj);
390 
391  for idx = 1:length(meta_data.PropertyList)
392  prop_name = meta_data.PropertyList(idx).Name;
393  ret.Write( prop_name, obj.(prop_name));
394  end
395 
396  end
397 
398 
399 %% RemoveSites
400 %> @brief Removes specific sites from the model of the scattering region. For example see function #ScatterPotQD.
401 %> @param indexes Logical array. Sites with true values will be removed from the system.
402  function RemoveSites( obj, indexes )
403 
404  % update the array of external degrees of freedom
405  if ~isempty( obj.kulso_szabfokok )
406  all_sites = 1:size(obj.Hscatter,1);
407  sites2remove = all_sites( indexes );
408 
409  for idx = length(sites2remove):-1:1
410  indexes_tmp = find( obj.kulso_szabfokok == sites2remove(idx), 1 );
411  if ~isempty(indexes_tmp)
412  error(['EQuUs:', class(obj), ':RemoveSites'], 'Sites cannot be removed from the Hamiltonian.');
413  end
414 
415  indexes_tmp = obj.kulso_szabfokok > sites2remove(idx);
416  obj.kulso_szabfokok(indexes_tmp) = obj.kulso_szabfokok(indexes_tmp) - 1;
417  end
418  end
419 
420  % removing sites from the scattering Hamiltonian
421  obj.Hscatter = obj.Hscatter(~indexes, ~indexes);
422 
423  % removing sites from the matrix of the transverse coupling
424  if ~isempty(obj.Hscatter_transverse)
425  obj.Hscatter_transverse = obj.Hscatter_transverse(~indexes, ~indexes);
426  end
427 
428  % removing sites from the matrix of the overlap integrals
429  if ~isempty(obj.Sscatter )
430  obj.Sscatter = obj.Sscatter(~indexes, ~indexes);
431  end
432 
433  % removing sites from the matrix of the overlap integrals of the transverse coupling
434  if ~isempty(obj.Sscatter_transverse )
435  obj.Sscatter_transverse = obj.Sscatter_transverse(~indexes, ~indexes);
436  end
437 
438  % removing sites from the matrix of the Peierls phases
439  if ~isempty(obj.fazis_mtx_scatter )
440  obj.fazis_mtx_scatter = obj.fazis_mtx_scatter(~indexes, ~indexes);
441  end
442 
443  % removing sites from the matrix of the Peierls phases of the transverse coupling
444  if ~isempty(obj.fazis_mtx_scatter_t )
445  obj.fazis_mtx_scatter_t = obj.fazis_mtx_scatter_t(~indexes, ~indexes);
446  end
447 
448  % removing sites from structure coordinates
449  obj.coordinates = obj.coordinates.RemoveSites( indexes );
450 
451 
452  end
453 
454 %% saveScatterHamiltonian
455 %> @brief Saves the Hamiltonian and other data of the scattering region
456 %> @param filename The string containing the path to the file. (In octave use absolute paths only)
457  function saveScatter( filename )
458  if ~exist('filename', 'var')
459  filename = 'Hscatter.mat';
460  end
461  save(filename,'Hscatter', 'Hscatter_transverse', 'coordinates', 'param', 'fazis_mtx_scatte', 'fazis_mtx_scatte_t', 'width', 'height', 'M')
462  end
463 
464 %% LoadHamiltonian
465 %> @brief Loads the Hamiltonian and other data of the scattering region from a file.
466 %> @param filename The string containing the path to the file. (In octave use absolute paths only)
467  function loadScatter( obj, filename )
468  if ~exist('filename', 'var')
469  filename = 'Hscatter.mat';
470  end
471  disp('EQuUs::CreateHamiltonian::loadScatter: Loading scatter Hamiltonian from file')
472  HandleForLoad = LoadFromFile( filename );
473  obj.Hscatter = HandleForLoad.LoadVariable('Hscatter', 'NoEmpty', 'On');
474  obj.Hscatter_transverse = HandleForLoad.LoadVariable('Hscatter_transverse', 'NoEmpty', 'On');
475  obj.Sscatter = HandleForLoad.LoadVariable('Sscatter', 'NoEmpty', 'On');
476  obj.Sscatter_transverse = HandleForLoad.LoadVariable('Sscatter_transverse', 'NoEmpty', 'On');
477  obj.coordinates = HandleForLoad.LoadVariable('coordinates', 'NoEmpty', 'On');
478  obj.fazis_mtx_scatter = HandleForLoad.LoadVariable('fazis_mtx_scatte', 'NoEmpty', 'Off');
479  obj.fazis_mtx_scatter_t = HandleForLoad.LoadVariable('fazis_mtx_scatte_t', 'NoEmpty', 'Off');
480  obj.param = HandleForLoad.LoadVariable('param', 'NoEmpty', 'On');
481  obj.M = HandleForLoad.LoadVariable('M', 'NoEmpty', 'On');
482  obj.width = HandleForLoad.LoadVariable('width', 'NoEmpty', 'Off');
483  obj.height = HandleForLoad.LoadVariable('height', 'NoEmpty', 'On');
484  obj.q = HandleForLoad.LoadVariable('q', 'NoEmpty', 'On');
485  HandleForLoad.ClearLoadedVariable();
486 end
487 
488 %% Write
489 %> @brief Sets the value of an attribute in the class.
490 %> @param MemberName The name of the attribute to be set.
491 %> @param input The value to be set.
492  function Write(obj, MemberName, input)
493 
494  if strcmp(MemberName, 'param')
495  obj.param = input;
496  obj.Reset();
497  return
498  elseif strcmp(MemberName, 'params')
499  obj.param.scatter = input;
500  return
501  else
502  try
503  obj.(MemberName) = input;
504  catch
505  error(['EQuUs:', class(obj), ':Read'], ['No property to write with name: ', MemberName]);
506  end
507  end
508 
509  end
510 
511 %% Read
512 %> @brief Query for the value of an attribute in the class.
513 %> @param MemberName The name of the attribute to be set.
514 %> @return Returns with the value of the attribute.
515  function ret = Read(obj, MemberName)
516  try
517  ret = obj.(MemberName);
518  catch
519  error(['EQuUs:', class(obj), ':Read'], ['No property to read with name: ', MemberName]);
520  end
521  end
522 
523 %% MemberClear
524 %> @brief Clears the value of an attribute in the class.
525 %> @param MemberName The name of the attribute to be cleared.
526  function Clear(obj, MemberName)
527  try
528  obj.(MemberName) = [];
529  catch
530  error(['EQuUs:', class(obj), ':Clear'], ['No property to clear with name: ', MemberName]);
531  end
532 
533  end
534 
535 end % methods public
536 
537 methods ( Access = private )
538 
539 
540 %% Initialize
541 %> @brief Initializes object attributes.
542  function Initialize(obj)
543 
545  obj.HamiltoniansCreated = false;
546  obj.HamiltoniansDecimated = false;
547  obj.MagneticFieldApplied = false;
548  obj.GaugeTransformationApplied = false;
549  obj.OverlapApplied = false;
550 
551  obj.InputParsing( obj.varargin{:} );
552  end
553 
554 %% queryHamiltonians
555 %> @brief Obtains Hamiltonians from a class instance Custom_Hamiltonians
556 %> @param cCustom_Hamiltonians An instance of class #Custom_Hamiltonians
557  function queryHamiltonians( obj, cCustom_Hamiltonians )
558  if isempty( cCustom_Hamiltonians )
559  cCustom_Hamiltonians = Custom_Hamiltonians( obj.Opt, obj.param );
560  end
561 
562  if ~cCustom_Hamiltonians.Read( 'Hamiltonians_loaded' )
563  cCustom_Hamiltonians.LoadHamiltonians();
564  end
565 
566  obj.coordinates = cCustom_Hamiltonians.Read( 'coordinates_scatter' );
567  obj.Hscatter = cCustom_Hamiltonians.Read( 'Hscatter' );
568  obj.Hscatter_transverse = cCustom_Hamiltonians.Read( 'Hscatter_transverse' );
569  obj.Sscatter = cCustom_Hamiltonians.Read( 'Sscatter' );
570  obj.Sscatter_transverse = cCustom_Hamiltonians.Read( 'Sscatter_transverse' );
571  obj.HamiltoniansCreated = true;
572  obj.MagneticFieldApplied = false;
573  obj.GaugeTransformationApplied = false;
574  obj.HamiltoniansDecimated = false;
575 
576  % determine kulso_szabfokok
577  Hcoupling = cCustom_Hamiltonians.Read( 'Hcoupling' );
578 
579  if iscell( Hcoupling )
580  for idx = 1:length( Hcoupling )
581  coupled_sites = CoupledSites( Hcoupling{idx} );
582  obj.kulso_szabfokok = [obj.kulso_szabfokok, coupled_sites];
583  end
584  obj.kulso_szabfokok = unique( obj.kulso_szabfokok );
585  else
586  obj.kulso_szabfokok = CoupledSites( Hcoupling );
587  end
588 
589 
590  % tranforming into the BdG model if necessary
591  if ~isempty( obj.Opt.BdG ) && obj.Opt.BdG
592  obj.Transforms2BdG()
593  end
594 
595  % nested functions
596 
597  % determine sites coupled to the leads
598  function ret = CoupledSites( Hcoupling )
599  [rows, cols] = find(Hcoupling);
600  ret = unique( cols );
601  ret = reshape(ret, 1, numel(ret));
602  end
603 
604  % end nested functions
605  end
606 
607 %% Transforms2BdG
608 %> @brief Transforms the Hamiltonians into a Bogoliubov de Gennes model.
609  function Transforms2BdG( obj )
610  if isempty( obj.param.scatter.pair_potential )
611  error('CreateHamiltonian:Transform2BdG', 'Pair potential need to be set for the scattering region.');
612  end
613 
614  if ~isempty(obj.coordinates.BdG_u)
615  obj.display('Hamiltonians already transformed to BdG model.')
616  return
617  end
618 
619 
620 
621  % transforming the Hamiltonians
622  pair_potential = obj.param.scatter.pair_potential;
623  site_num = size( obj.Hscatter, 1 );
624  obj.coordinates.BdG_u = [true( site_num, 1); false( site_num, 1) ];
625 
626  if isempty( obj.Sscatter )
627  Sscatter = speye(size(obj.Hscatter));
628  else
629  Sscatter = obj.Sscatter;
630  end
631 
632  Hscatter_hole = -conj(obj.Hscatter);
633  % apply time reversal symmetry on spins according to Eq (3) of PRB 86 134522 (2012)
634  if ~isempty(obj.coordinates.spinup)
635  Hscatter_hole = [Hscatter_hole(~obj.coordinates.spinup, ~obj.coordinates.spinup), -Hscatter_hole(~obj.coordinates.spinup, obj.coordinates.spinup);
636  -Hscatter_hole(obj.coordinates.spinup, ~obj.coordinates.spinup), Hscatter_hole(obj.coordinates.spinup, obj.coordinates.spinup) ];
637  end
638  obj.Hscatter = [ obj.Hscatter, Sscatter*pair_potential;
639  Sscatter*conj(pair_potential), Hscatter_hole ];
640 
641  % transforming the transverse coupling
642  if ~isempty(obj.Hscatter_transverse)
643  Hscatter_transverse_hole = -conj(obj.Hscatter_transverse);
644 
645  % apply time reversal symmetry on spins according to Eq (3) of PRB 86 134522 (2012)
646  if ~isempty(obj.coordinates.spinup)
647  Hscatter_transverse_hole = [Hscatter_transverse_hole(~obj.coordinates.spinup, ~obj.coordinates.spinup), -Hscatter_transverse_hole(~obj.coordinates.spinup, obj.coordinates.spinup);
648  -Hscatter_transverse_hole(obj.coordinates.spinup, ~obj.coordinates.spinup), Hscatter_transverse_hole(obj.coordinates.spinup, obj.coordinates.spinup) ];
649  end
650 
651  obj.Hscatter_transverse = [ obj.Hscatter_transverse, sparse([],[],[], size(obj.Hscatter_transverse,1), size(obj.Hscatter_transverse,2));
652  sparse([],[],[], size(obj.Hscatter_transverse,1), size(obj.Hscatter_transverse,2)), Hscatter_transverse_hole ];
653  end
654 
655  % transforming the overlap integrals
656  if ~isempty( obj.Sscatter )
657  obj.Sscatter = [ obj.Sscatter, sparse([],[],[], site_num, site_num );
658  sparse([],[],[], site_num, site_num ), obj.Sscatter ];
659  end
660 
661 
662  fnames = fieldnames( obj.coordinates );
663  for idx = 1:length(fnames)
664  fname = fnames{idx};
665  if strcmp(fname, 'a') || strcmp(fname, 'b')
666  continue
667  end
668  obj.coordinates.(fname) = [ obj.coordinates.(fname); obj.coordinates.(fname) ];
669  end
670 
671  obj.coordinates.BdG_u = [ true(size(obj.Hscatter,1),1), false(size(obj.Hscatter,1),1)];
672 
673  length_kulso_szabfokok = length(obj.kulso_szabfokok);
674  obj.kulso_szabfokok = [obj.kulso_szabfokok(1:length_kulso_szabfokok), obj.kulso_szabfokok(1:length_kulso_szabfokok)+size(obj.Hscatter,1) ];
675 
676  end
677 
678 %% InputParsing
679 %> @brief Parses the optional parameters for the class constructor.
680 %> @param varargin Optional parameters, see the web documantation.
681 %> @param 'q' The transverse momentum quantum number.
682  function InputParsing( obj, varargin)
683 
684  p = inputParser;
685  p.addParameter('q', []);
686 
687  p.parse(varargin{:});
688 
689  obj.q = p.Results.q;
690 
691  end
692 
693 
694 end %methods protected
695 
696 end % Global end
697 
A class to create the Hamiltonian of one unit cell in a translational invariant graphene bilayer lead...
function LoadHamiltonians(varargin)
Obtain the Hamiltonians from the external source.
function InputParsing(varargin)
Parses the optional parameters for the class constructor.
Class to create the Hamiltonian of one unit cell in a translational invariant lead made of Triangle l...
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:60
Structure shape contains data about the geometry of the scattering region.
Definition: structures.m:106
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)
Calculates the conductance at a given energy value.
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.
Class to create the Hamiltonian of one unit cell in a translational invariant lead made of TMDC_Monol...
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
Class to create the Hamiltonian of one unit cell in a translational invariant lead made of TMDC_Monol...
Structure sites contains data to identify the individual sites in a matrix.
Definition: structures.m:187
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.
A class to create the Hamiltonian of one unit cell in a translational invariant graphene lead,...
width
The number of sites in the cross section.
Definition: structures.m:108
Property H1_transverse
Cell array of transverse coupling between the unit cells of the lead.
A class to create the Hamiltonian of one unit cell in a translational invariant silicene lead.
A class providing interface to load variables from a file.
Definition: LoadFromFile.m:24
A class to create the Hamiltonian of one unit cell in a translational invariant lead made of hexagona...
function structures(name)
Class to create the Hamiltonian of one unit cell in a translational invariant lead made of TMDC bilay...
height
Number of unit cells along the logitudinal direction in the scattering region.
Definition: structures.m:110
A class to create and store Hamiltonian of the scattering region.