2 % Copyright (C) 2009-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 basic Basic Functionalities
20 %> @brief A
class to create and store Hamiltonian of the scattering region
22 %> @brief A
class to create and store Hamiltonian of the scattering region
26 properties ( Access =
protected )
27 %> An instance of structure
param 29 %> A list of the
sites to be kept after decimation.
31 %> Hscatter - E*Sscatter
33 %> Hscatter_transverse - E*Sscatter_transverse
35 %> The matrix of the Hamiltonian.
37 %> The matrix of the Hamiltonian corresponding to the transverse coupling.
39 %> The matrix of the overlap integrals in the Hamiltonian.
41 %> The matrix of the overlap integrals
for the transverse coupling.
45 %> The matrix of the
Peierls phases
for the transverse coupling.
47 %> An instance of the structure coordinates.
49 %> The length of the scattering region in units of the lattice contant.
51 %> The number of
sites in the cross section.
53 %> The number of
sites in one unit cell.
55 %> A logical value. True
if the Hamiltonian was created,
false otherwise.
57 %> A logical value. True
if the Hamiltonian was decimated, or
false otherwise.
59 %> A logical value. True
if the overlap integrals were applied,
false otherwise.
61 %> A logical value. True
if the vector potential was incorporated into the Hamiltonian or
false otherwise.
63 %> A logical value. True
if a gauge transformation was applied on the
Hamiltonians, or
false otherwise.
64 GaugeTransformationApplied
65 %> A transverse momentum.
67 %> list of optional parameters (see http:
73 methods ( Access =
public )
74 %% constructorof the
class 75 %> @brief Constructor of the
class.
78 %> @
param varargin Cell array of optional parameters. For details see #InputParsing.
79 %> @
return An instance of the
class 84 obj.varargin = varargin;
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:
97 p.addParameter(
'Scatter_UC', []);
98 p.addParameter(
'CustomHamiltonian', []);
100 Scatter_UC = p.Results.Scatter_UC;
101 CustomHamiltonian = p.Results.CustomHamiltonian;
103 shape = obj.param.scatter.shape;
106 obj.height =
shape.
height; % number of unit cells!!!!!!!!
108 if isempty(Scatter_UC)
110 if ~isempty( obj.Opt.custom_Hamiltonians )
111 obj.queryHamiltonians( CustomHamiltonian );
113 elseif strcmpi(obj.
Opt.Lattice_Type, 'Square')
115 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.SquareLattice_Lead_Hamiltonians(obj.
param.scatter, obj.width);
116 elseif strcmpi(obj.
Opt.Lattice_Type, 'SSH')
119 elseif strcmp(obj.
Opt.Lattice_Type, 'Lieb')
123 elseif strcmpi(obj.
Opt.Lattice_Type, 'Graphene')
124 End_Type = obj.
param.scatter.End_Type;
126 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.Graphene_Lead_Hamiltonians(obj.
param.scatter, obj.width, End_Type);
127 elseif strcmpi(obj.
Opt.Lattice_Type, 'Silicene')
128 End_Type = obj.
param.scatter.End_Type;
130 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.Silicene_Lead_Hamiltonians(obj.
param.scatter, obj.width, End_Type);
131 elseif strcmpi(obj.
Opt.Lattice_Type, 'Graphene_Bilayer')
132 End_Type = obj.
param.scatter.End_Type;
134 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Lead_Hamiltonians(obj.
param.scatter, obj.width, End_Type);
135 elseif strcmpi(obj.
Opt.Lattice_Type, 'Graphene_Bilayer_2')
136 End_Type = obj.
param.scatter.End_Type;
138 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Lead_Hamiltonians2(obj.
param.scatter, obj.width, End_Type);
139 elseif strcmpi(obj.
Opt.Lattice_Type, 'Graphene_Bilayer_3')
140 End_Type = obj.
param.scatter.End_Type;
142 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.Graphene_Bilayer_Lead_Hamiltonians3(obj.
param.scatter, obj.width, End_Type);
143 elseif strcmpi(obj.
Opt.Lattice_Type, 'Triangle')
146 elseif strcmpi(obj.
Opt.Lattice_Type, 'TMDC_Monolayer')
148 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.TMDC_Monolayer_Hamiltonians(obj.
param.scatter, obj.width);
149 elseif strcmpi(obj.
Opt.Lattice_Type, 'TMDC_Monolayer_SOC')
151 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.TMDC_Monolayer_SOC_Hamiltonians(obj.
param.scatter, obj.width);
152 elseif strcmpi(obj.
Opt.Lattice_Type, 'TMDC_Bilayer_SOC')
154 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.TMDC_Monolayer_SOC_Hamiltonians(obj.
param.scatter, obj.width);
156 error(['EQuUs:', class(obj), ':CreateScatterH:'], 'Unrecognized lattice type, or the claculation options are not set to use outher DFT source.')
163 obj.MagneticFieldApplied = Scatter_UC.
Read( 'MagneticFieldApplied' );
164 obj.GaugeTransformationApplied = Scatter_UC.
Read( 'GaugeTransformationApplied' );
165 obj.width = size(
H0, 1);
176 HCell = repmat({
H1}, 1, height-1);
177 H1_big = blkdiag(HCell{:});
178 HCell = repmat({H1adj}, 1, height-1);
179 H1adj_big = blkdiag(HCell{:});
180 HCell = repmat({
H0}, 1, height);
183 H1_big = [[sparse([],[],[], size(H1_big,1), size(
H1,2)), H1_big]; sparse([],[],[], size(
H1,1), size(H1_big,2)+size(
H1,2))];
184 H1adj_big = [sparse([],[],[], size(
H1,1), size(H1adj_big,1)+size(
H1,2)); [H1adj_big, sparse([],[],[], size(H1adj_big,1), size(
H1,2))]];
195 coordfieldnames = fieldnames( coordinates_unitcell );
196 for idx = 1:length( coordfieldnames )
197 coordfieldname = coordfieldnames{idx};
198 if strcmpi( coordfieldname,
'a') || strcmpi( coordfieldname,
'b')
200 elseif strcmpi( coordfieldname, 'x')
201 tmp = ones(size(coordinates_unitcell.x))*(coordinates_unitcell.a(1)*(0:height-1));
202 tmp = reshape(tmp, numel(tmp), 1);
203 coordinates.x = repmat(coordinates_unitcell.x, height, 1) + tmp;
204 elseif strcmpi( coordfieldname, 'y')
205 tmp = ones(size(coordinates_unitcell.y))*(coordinates_unitcell.a(2)*(0:height-1));
206 tmp = reshape(tmp, numel(tmp), 1);
207 coordinates.y = repmat(coordinates_unitcell.y, height, 1) + tmp;
208 elseif ~isempty(coordinates_unitcell.(coordfieldname))
209 coordinates.(coordfieldname) = repmat(coordinates_unitcell.(coordfieldname), height, 1);
218 obj.HamiltoniansCreated = true;
219 obj.MagneticFieldApplied = false;
220 obj.GaugeTransformationApplied = false;
221 obj.OverlapApplied = false;
222 obj.HamiltoniansDecimated = false;
228 %% ApplyOverlapMatrices
229 %> @brief Applies the overlap matrices to the
Hamiltonians: K = H-ES
230 %> @
param E The energy value.
231 function ApplyOverlapMatrices(obj, E)
233 if obj.OverlapApplied
234 obj.
display(['EQuUs:', class(obj), ':ApplyOverlapMatrices: Overlap matrices were already applied.']);
240 obj.OverlapApplied = true;
242 obj.Kscatter = obj.
Hscatter - eye(size(obj.
H0))*E;
255 %> @brief Shifts the on-site energies in the Scattering region by a given energy.
256 %> @
param Energy The energy value to be used.
257 function shiftFermiEnergy( obj, Energy )
259 energyshift = speye( size( obj.
Hscatter ) )*Energy;
265 if ~isempty( obj.
param.scatter) && ~isempty( obj.
param.scatter.epsilon )
266 obj.
param.scatter.epsilon = obj.
param.scatter.epsilon + Energy;
270 %% projectHamiltonian2Spin
271 %> @brief Projects the Hamiltonian to a spin states of $s=\pm1$
272 %> @
param s The quantum index of the spin (\pm1)
273 function projectHamiltonian2Spin( obj, s )
289 display(['EQuUs:', class(obj), ':projectHamiltonian2Spin: spin should be +/-1'], 1)
299 %> @brief Resets all elements in the class.
303 meta_data = metaclass(obj);
305 for idx = 1:length(meta_data.PropertyList)
306 prop_name = meta_data.PropertyList(idx).Name;
307 if strcmp(prop_name, '
Opt') || strcmp( prop_name, '
param') || strcmp(prop_name, '
varargin')
310 obj.
Clear( prop_name );
320 %> @brief Creates a clone of the present class.
322 %> @
param 'empty' Set true to create an empty clone, or false (default) to clone all atributes.
323 %> @return Returns with the cloned
object.
327 p.addParameter('empty', false );
330 empty = p.Results.empty;
338 meta_data = metaclass(obj);
340 for idx = 1:length(meta_data.PropertyList)
341 prop_name = meta_data.PropertyList(idx).Name;
342 ret.
Write( prop_name, obj.(prop_name));
349 %> @brief Removes specific
sites from the model of the scattering region. For example see
function #ScatterPotQD. 350 %> @
param indexes Logical array. Sites with
true values will be removed from the system.
351 function RemoveSites( obj, indexes )
353 % update the array of external degrees of freedom
354 if ~isempty( obj.kulso_szabfokok )
356 sites2remove = all_sites( indexes );
358 for idx = length(sites2remove):-1:1
359 indexes_tmp = find( obj.kulso_szabfokok == sites2remove(idx), 1 );
360 if ~isempty(indexes_tmp)
361 error(['EQuUs:', class(obj), ':RemoveSites'], 'Sites cannot be removed from the Hamiltonian.');
364 indexes_tmp = obj.kulso_szabfokok > sites2remove(idx);
365 obj.kulso_szabfokok(indexes_tmp) = obj.kulso_szabfokok(indexes_tmp) - 1;
369 % removing
sites from the scattering Hamiltonian
372 % removing
sites from the matrix of the transverse coupling
377 % removing
sites from the matrix of the overlap integrals
382 % removing
sites from the matrix of the overlap integrals of the transverse coupling
388 if ~isempty(obj.fazis_mtx_scatter )
389 obj.fazis_mtx_scatter = obj.fazis_mtx_scatter(~indexes, ~indexes);
392 % removing
sites from the matrix of the
Peierls phases of the transverse coupling
393 if ~isempty(obj.fazis_mtx_scatter_t )
394 obj.fazis_mtx_scatter_t = obj.fazis_mtx_scatter_t(~indexes, ~indexes);
403 %% saveScatterHamiltonian
404 %> @brief Saves the Hamiltonian and other data of the scattering region
405 %> @
param filename The
string containing the path to the file. (In octave use absolute paths only)
407 if ~exist('filename', 'var')
414 %> @brief Loads the Hamiltonian and other data of the scattering region from a file.
415 %> @
param filename The
string containing the path to the file. (In octave use absolute paths only)
416 function loadScatter( obj, filename )
417 if ~exist('filename', 'var')
420 disp('EQuUs::CreateHamiltonian::loadScatter: Loading scatter Hamiltonian from file')
427 obj.fazis_mtx_scatter = HandleForLoad.LoadVariable('fazis_mtx_scatte', 'NoEmpty', 'Off');
428 obj.fazis_mtx_scatter_t = HandleForLoad.LoadVariable('fazis_mtx_scatte_t', 'NoEmpty', 'Off');
429 obj.
param = HandleForLoad.LoadVariable('
param', 'NoEmpty', 'On');
430 obj.M = HandleForLoad.LoadVariable('M', 'NoEmpty', 'On');
431 obj.width = HandleForLoad.LoadVariable('width', 'NoEmpty', 'Off');
432 obj.height = HandleForLoad.LoadVariable('height', 'NoEmpty', 'On');
433 obj.q = HandleForLoad.LoadVariable('q', 'NoEmpty', 'On');
434 HandleForLoad.ClearLoadedVariable();
438 %> @brief Sets the value of an attribute in the class.
439 %> @
param MemberName The name of the attribute to be set.
440 %> @
param input The value to be set.
443 if strcmp(MemberName, '
param')
447 elseif strcmp(MemberName, 'params')
448 obj.
param.scatter = input;
452 obj.(MemberName) = input;
454 error(['EQuUs:', class(obj), ':
Read'], ['No property to write with name: ', MemberName]);
461 %> @brief Query for the value of an attribute in the class.
462 %> @
param MemberName The name of the attribute to be set.
463 %> @return Returns with the value of the attribute.
466 ret = obj.(MemberName);
468 error(['EQuUs:', class(obj), ':
Read'], ['No property to read with name: ', MemberName]);
473 %> @brief Clears the value of an attribute in the class.
474 %> @
param MemberName The name of the attribute to be cleared.
477 obj.(MemberName) = [];
479 error(['EQuUs:', class(obj), ':
Clear'], ['No property to clear with name: ', MemberName]);
486 methods ( Access = private )
490 %> @brief Initializes
object attributes.
494 obj.HamiltoniansCreated = false;
495 obj.HamiltoniansDecimated = false;
496 obj.MagneticFieldApplied = false;
497 obj.GaugeTransformationApplied = false;
498 obj.OverlapApplied = false;
506 function queryHamiltonians( obj, cCustom_Hamiltonians )
507 if isempty( cCustom_Hamiltonians )
511 if ~cCustom_Hamiltonians.
Read(
'Hamiltonians_loaded' )
515 obj.coordinates = cCustom_Hamiltonians.
Read(
'coordinates_scatter' );
516 obj.Hscatter = cCustom_Hamiltonians.
Read(
'Hscatter' );
517 obj.Hscatter_transverse = cCustom_Hamiltonians.
Read(
'Hscatter_transverse' );
518 obj.Sscatter = cCustom_Hamiltonians.
Read(
'Sscatter' );
519 obj.Sscatter_transverse = cCustom_Hamiltonians.
Read(
'Sscatter_transverse' );
520 obj.HamiltoniansCreated =
true;
521 obj.MagneticFieldApplied =
false;
522 obj.GaugeTransformationApplied =
false;
523 obj.HamiltoniansDecimated =
false;
525 % determine kulso_szabfokok
530 coupled_sites = CoupledSites(
Hcoupling{idx} );
531 obj.kulso_szabfokok = [obj.kulso_szabfokok, coupled_sites];
533 obj.kulso_szabfokok = unique( obj.kulso_szabfokok );
535 obj.kulso_szabfokok = CoupledSites(
Hcoupling );
539 % tranforming into the BdG model
if necessary
540 if ~isempty( obj.Opt.BdG ) && obj.Opt.BdG
546 % determine
sites coupled to the leads
549 ret = unique( cols );
550 ret = reshape(ret, 1, numel(ret));
553 % end nested functions
557 %> @brief Transforms the
Hamiltonians into a Bogoliubov de Gennes model.
558 function Transforms2BdG( obj )
559 if isempty( obj.param.scatter.pair_potential )
560 error('CreateHamiltonian:Transform2BdG', 'Pair potential need to be set for the scattering region.');
569 for idx = 1:length(fnames)
571 if strcmp(fname,
'a') || strcmp(fname,
'b')
579 length_kulso_szabfokok = length(obj.kulso_szabfokok);
580 obj.kulso_szabfokok = [obj.kulso_szabfokok(1:length_kulso_szabfokok), obj.kulso_szabfokok(1:length_kulso_szabfokok)+size(obj.
Hscatter,1) ];
583 pair_potential = obj.
param.scatter.pair_potential;
585 obj.
coordinates.BdG_u = [true( site_num, 1); false( site_num, 1) ];
596 % transforming the overlap integrals
602 sparse([],[],[], site_num, site_num ), obj.
Sscatter ];
608 %> @brief Parses the optional parameters for the class constructor.
609 %> @
param varargin Optional parameters, see the web documantation.
610 %> @
param 'q' The transverse momentum quantum number.
614 p.addParameter('q', []);
623 end %methods
protected 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.
Structure Opt contains the basic computational parameters used in EQuUs.
Structure shape contains data about the geometry of the scattering region.
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 ...
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.
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.
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.
function Read(MemberName)
Query for the value of an attribute in the class.
width
The number of sites in the cross section.
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.
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.
A class to create and store Hamiltonian of the scattering region.