2 % Copyright (C) 2015-2016 Peter Rakyta, Ph.D., David Visontai, 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
import custom
Hamiltonians provided by other codes or created manually
22 %> @brief A
class to import custom
Hamiltonians provided by other codes or created manually
24 %> EQuUs v4.8 or later
28 properties (Access =
protected )
29 %> An instance of structure
param 33 %> Cell array of couplings between the slabs of the leads
35 %> Cell array of transverse coupling between the unit cells of the lead
37 %> Hamiltonian of the scattering region
39 %> transverse coupling
for the scattering region
40 Hscatter_transverse = [];
41 %> Cell array of couplings between the scattering region and the leads
43 %> Cell array of overlap integrals of one slab in the leads
45 %> Cell array of overlap integrals between the slabs of the leads
47 %> overlap integrals
for the transverse coupling between the unit cells of the lead
49 %> Overlap integrals of the scattering region
51 %> overlap integrals
for the transverse coupling in the scattering region
52 Sscatter_transverse = [];
53 %> Cell array of overlap integrals between the scattering region and the leads
55 %> Cell array of coordinates of the leads
57 %> coordinates of the scattering region
58 coordinates_scatter = [];
59 %> logical value:
true if Hamiltonians are loaded,
false otherwise.
60 Hamiltonians_loaded =
false;
63 %> Function Handle
for the custom
Hamiltonians with identical input values as #LoadHamiltonians, and output values described in the example #
Hamiltonians.
64 CustomHamiltoniansHandle
65 %> list of optional parameters (see #InputParsing
for details)
71 methods (Access = public )
74 %% Constructor of the class
75 %> @brief Constructor of the class.
76 %> @
param Opt An instance of the structure
#Opt. 78 %> @
param varargin Cell array of optional parameters. For details see #InputParsing.
79 %> @
return An instance of the
class 83 obj.varargin = varargin;
91 %> @brief Obtain the
Hamiltonians from the external source
92 %> @
param varargin Cell array of optional parameters (https:
93 %> @
param 'q' The transverse momentum quantum number.
94 % @
param 'Extmol' The transverse momentum quantum number.
95 % @
param 'GollumInput' The transverse momentum quantum number.
96 % @
param 'WorkingDir' The transverse momentum quantum number.
97 function LoadHamiltonians(obj, varargin)
99 if strcmpi( obj.
Opt.custom_Hamiltonians, 'siesta' )
102 p.addParamValue('q', [1]);
103 p.addParamValue('Filename', 'HSX');
104 p.addParamValue('WorkingDir', pwd);
105 p.parse(varargin{:});
108 %Filename = p.Results.Filename;
109 % Coordinatzes needs to be determined : TODO
110 [obj.H0, obj.S0, obj.H1, obj.S1, obj.coordinates, ...
111 obj.Hscatter, obj.Sscatter, obj.coordinates_scatter, ...
112 obj.H1_transverse, obj.S1_transverse, ...
113 obj.Hscatter_transverse, obj.Sscatter_transverse, ...
114 obj.Hcoupling, obj.Scoupling, obj.EF] = Siesta_Interface(obj.Opt.WorkingDir, obj.param, q );
116 %obj.H1_transverse = cell(size(obj.H0));
117 obj.Hamiltonians_loaded =
true;
119 %% Yaehmop TB hamiltonian
120 elseif strcmpi( obj.Opt.custom_Hamiltonians,
'yaehmop' )
123 p.addParamValue('q', [1]);
124 p.addParamValue('Filename', 'HS');
125 p.addParamValue('WorkingDir', pwd);
126 p.parse(varargin{:});
129 % Coordinatzes needs to be determined : TODO
130 [obj.H0, obj.S0, obj.H1, obj.S1, obj.coordinates, ...
131 obj.Hscatter, obj.Sscatter, obj.coordinates_scatter, obj.Hcoupling, obj.Scoupling, obj.EF] = Yaehmop_Interface(obj.Opt.WorkingDir, obj.param );
133 obj.H1_transverse = cell(size(obj.H0));
134 obj.Hamiltonians_loaded =
true;
137 elseif strcmpi( obj.Opt.custom_Hamiltonians,
'custom' )
139 if isempty(obj.CustomHamiltoniansHandle)
143 [obj.H0, obj.S0, obj.H1, obj.S1, obj.H1_transverse, obj.coordinates, ...
144 obj.Hscatter, obj.Sscatter, obj.Hscatter_transverse, obj.Sscatter_transverse, ...
145 obj.coordinates_scatter, obj.Hcoupling, obj.Scoupling] = obj.CustomHamiltoniansHandle();
148 error(['EQuUs:', class(obj), ':LoadHamiltonians'], 'Undefinied option of the attribute
Opt.custom_Hamiltonians')
154 if ~isempty( obj.EF )
155 for idx = 1:length( obj.S0 )
156 if ~isempty( obj.S0{idx} )
157 obj.H0{idx} = obj.H0{idx} - obj.EF*obj.S0{idx};
158 obj.H1{idx} = obj.H1{idx} - obj.EF*obj.S1{idx};
160 obj.H0{idx} = obj.H0{idx} - obj.EF*speye(size(obj.H0{idx}));
164 for idx = 1:length( obj.Scoupling )
165 if ~isempty( obj.Scoupling{idx} )
166 obj.Hcoupling{idx} = obj.Hcoupling{idx} - obj.EF*obj.Scoupling{idx};
170 if ~isempty(obj.Sscatter)
171 obj.Hscatter = obj.Hscatter - obj.EF*obj.Sscatter;
173 obj.Hscatter = obj.Hscatter - obj.EF*speye(size(obj.Hscatter));
178 obj.Hamiltonians_loaded = true;
187 %> @brief Resets all elements in the
object.
191 meta_data = metaclass(obj);
193 for idx = 1:length(meta_data.PropertyList)
194 prop_name = meta_data.PropertyList(idx).Name;
195 if strcmp(prop_name, '
Opt') || strcmp( prop_name, '
param') || strcmp(prop_name, 'varargin')
198 obj.Clear( prop_name );
208 %> @brief Sets the value of an attribute in the class.
209 %> @
param MemberName The name of the attribute to be set.
210 %> @
param input The value to be set.
211 function Write( obj, MemberName, input)
213 if strcmp(MemberName, '
param')
217 elseif strcmp(MemberName, '
Opt')
222 obj.(MemberName) = input;
224 error(['EQuUs:', class(obj), ':Read'], ['No property to write with name: ', MemberName]);
229 %> @brief Query for the value of an attribute in the class.
230 %> @
param MemberName The name of the attribute to be set.
231 %> @return Returns with the value of the attribute.
232 function ret = Read(obj, MemberName)
234 ret = obj.(MemberName);
236 error(['EQuUs:', class(obj), ':Read'], ['No property to read with name: ', MemberName]);
240 %> @brief Clears the value of an attribute in the class.
241 %> @
param MemberName The name of the attribute to be cleared.
244 obj.(MemberName) = [];
246 error(['EQuUs:', class(obj), ':Clear'], ['No property to clear with name: ', MemberName]);
254 methods ( Access = private )
257 %> @brief Initializes
object properties.
260 obj.Hamiltonians_loaded = false;
263 obj.InputParsing( obj.varargin{:} )
267 %> @brief Parses the optional parameters
for the
class constructor.
268 %> @
param varargin Optional parameters, see the web documantation.
269 %> @
param 'EF' The Fermi energy.
270 %> @
param 'CustomHamiltoniansHandle' A
function handle for the custom
Hamiltonians with identical input values as #LoadHamiltonians, and output values described in the example #
Hamiltonians.
271 function InputParsing( obj, varargin )
274 p.addParameter(
'EF', []);
275 p.addParameter(
'CustomHamiltoniansHandle', []);
277 p.parse(varargin{:});
280 obj.EF = p.Results.EF;
281 obj.CustomHamiltoniansHandle = p.Results.CustomHamiltoniansHandle;
287 end % methods
private A class containing methodes for displaying several standard messages.
Structure Opt contains the basic computational parameters used in EQuUs.
function Transport(Energy, B)
Calculates the conductance at a given energy value.
function Hamiltonians(varargin)
Function to create the custom Hamiltonians for the 1D chain.
A class to import custom Hamiltonians provided by other codes or created manually
Structure param contains data structures describing the physical parameters of the scattering center ...