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:
95 function CreateScatterH( obj,
varargin )
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')
118 elseif strcmpi(obj.
Opt.Lattice_Type, 'SSH')
123 elseif strcmp(obj.
Opt.Lattice_Type, 'Lieb')
128 elseif strcmpi(obj.
Opt.Lattice_Type, 'Graphene')
129 End_Type = obj.
param.scatter.End_Type;
131 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.Graphene_Hamiltonians(obj.
param.scatter, obj.width, End_Type);
134 elseif strcmpi(obj.
Opt.Lattice_Type, 'Graphene_SOC')
135 End_Type = obj.
param.scatter.End_Type;
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;
141 [
H0,
H1,
H1_transverse,coordinates_unitcell] = createH.Silicene_Hamiltonians(obj.
param.scatter, obj.width, End_Type);
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);
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);
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);
162 elseif strcmpi(obj.
Opt.Lattice_Type, 'Triangle')
164 [
H0,
H1,
H1_transverse, H1_skew_left, coordinates_unitcell] = createH.Triangle_Hamiltonians(obj.
param.scatter, obj.width);
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)
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);
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);
179 error('Unrecognized lattice type, or the claculation options are not set to use outher DFT source.')
185 H1_skew_left = Scatter_UC.
Read( 'H1_skew_left' );
186 H1_skew_right = Scatter_UC.
Read( 'H1_skew_right' );
188 obj.MagneticFieldApplied = Scatter_UC.
Read( 'MagneticFieldApplied' );
189 obj.GaugeTransformationApplied = Scatter_UC.
Read( 'GaugeTransformationApplied' );
190 obj.width = size(
H0, 1);
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))];
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))]];
211 % creating Hamiltonian of the unit cells
212 HCell = repmat({
H0}, 1, height);
216 % adding coupling between the unit cells
219 % creating the transverse coupling
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)) ];
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))] ];
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')
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);
269 obj.HamiltoniansCreated = true;
270 obj.MagneticFieldApplied = false;
271 obj.GaugeTransformationApplied = false;
272 obj.OverlapApplied = false;
273 obj.HamiltoniansDecimated = false;
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)
284 if obj.OverlapApplied
285 obj.
display(['EQuUs:', class(obj), ':ApplyOverlapMatrices: Overlap matrices were already applied.']);
291 obj.OverlapApplied = true;
293 obj.Kscatter = obj.
Hscatter - eye(size(obj.
H0))*E;
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 )
310 energyshift = speye( size( obj.
Hscatter ) )*Energy;
316 if ~isempty( obj.
param.scatter) && ~isempty( obj.
param.scatter.epsilon )
317 obj.
param.scatter.epsilon = obj.
param.scatter.epsilon + Energy;
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 )
340 display(['EQuUs:', class(obj), ':projectHamiltonian2Spin: spin should be +/-1'], 1)
350 %> @brief Resets all elements in the class.
354 meta_data = metaclass(obj);
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')
361 obj.
Clear( prop_name );
371 %> @brief Creates a clone of the present class.
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 )
378 p.addParameter('empty', false );
381 empty = p.Results.empty;
389 meta_data = metaclass(obj);
391 for idx = 1:length(meta_data.PropertyList)
392 prop_name = meta_data.PropertyList(idx).Name;
393 ret.
Write( prop_name, obj.(prop_name));
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 )
404 % update the array of external degrees of freedom
405 if ~isempty( obj.kulso_szabfokok )
407 sites2remove = all_sites( indexes );
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.');
415 indexes_tmp = obj.kulso_szabfokok > sites2remove(idx);
416 obj.kulso_szabfokok(indexes_tmp) = obj.kulso_szabfokok(indexes_tmp) - 1;
420 % removing
sites from the scattering Hamiltonian
423 % removing
sites from the matrix of the transverse coupling
428 % removing
sites from the matrix of the overlap integrals
433 % removing
sites from the matrix of the overlap integrals of the transverse coupling
439 if ~isempty(obj.fazis_mtx_scatter )
440 obj.fazis_mtx_scatter = obj.fazis_mtx_scatter(~indexes, ~indexes);
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);
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')
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')
471 disp('EQuUs::CreateHamiltonian::loadScatter: Loading scatter Hamiltonian from file')
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();
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)
494 if strcmp(MemberName, '
param')
498 elseif strcmp(MemberName, 'params')
499 obj.
param.scatter = input;
503 obj.(MemberName) = input;
505 error(['EQuUs:', class(obj), ':
Read'], ['No property to write with name: ', MemberName]);
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)
517 ret = obj.(MemberName);
519 error(['EQuUs:', class(obj), ':
Read'], ['No property to read with name: ', MemberName]);
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)
528 obj.(MemberName) = [];
530 error(['EQuUs:', class(obj), ':
Clear'], ['No property to clear with name: ', MemberName]);
537 methods ( Access = private )
541 %> @brief Initializes
object attributes.
545 obj.HamiltoniansCreated = false;
546 obj.HamiltoniansDecimated = false;
547 obj.MagneticFieldApplied = false;
548 obj.GaugeTransformationApplied = false;
549 obj.OverlapApplied = false;
557 function queryHamiltonians( obj, cCustom_Hamiltonians )
558 if isempty( cCustom_Hamiltonians )
562 if ~cCustom_Hamiltonians.
Read(
'Hamiltonians_loaded' )
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;
576 % determine kulso_szabfokok
581 coupled_sites = CoupledSites(
Hcoupling{idx} );
582 obj.kulso_szabfokok = [obj.kulso_szabfokok, coupled_sites];
584 obj.kulso_szabfokok = unique( obj.kulso_szabfokok );
586 obj.kulso_szabfokok = CoupledSites(
Hcoupling );
590 % tranforming into the BdG model
if necessary
591 if ~isempty( obj.Opt.BdG ) && obj.Opt.BdG
597 % determine
sites coupled to the leads
600 ret = unique( cols );
601 ret = reshape(ret, 1, numel(ret));
604 % end nested functions
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.');
622 pair_potential = obj.
param.scatter.pair_potential;
624 obj.
coordinates.BdG_u = [true( site_num, 1); false( site_num, 1) ];
632 Hscatter_hole = -conj(obj.
Hscatter);
633 % apply time reversal symmetry on spins according to Eq (3) of PRB 86 134522 (2012)
639 Sscatter*conj(pair_potential), Hscatter_hole ];
641 % transforming the transverse coupling
645 % apply time reversal symmetry on spins according to Eq (3) of PRB 86 134522 (2012)
655 % transforming the overlap integrals
658 sparse([],[],[], site_num, site_num ), obj.
Sscatter ];
663 for idx = 1:length(fnames)
665 if strcmp(fname,
'a') || strcmp(fname,
'b')
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) ];
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.
685 p.addParameter('q', []);
694 end %methods
protected 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.
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.
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.
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.
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.