2 % Copyright (C) 2018 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:
20 %> @brief Structure containing the coordinates and other quantum number identifiers of the
sites in the
Hamiltonians.
22 %> @brief Structure containing the coordinates and other quantum number identifiers of the
sites in the
Hamiltonians.
27 %> A vector containing the $x$ coordinates of the
sites in units of the lattice constant.
29 %> A vector containing the $y$ coordinates of the
sites in units of the lattice constant.
31 %> A vector containing the $z$ coordinates of the
sites in units of the lattice constant.
33 %> The lattice vector of the translational invariant lead in units of the lattice constant.
35 %> The lattice vector in the transverse direction in units of the lattice constant.
39 %> Cell array containing the orbital types of the
sites 41 %> Array of logicals. Used in system including a spin degree of freedom. Values
"true" gives
sites with spin up, and values
"false" stand
for the spin down
sites.
43 %> Array of logicals. Used in the Bogoliubov de Gennes
Hamiltonians. Values
"true" gives
sites corresponding to the
"u" component of the wave
function, and values
"false" stand
for the
sites of the
"v" component of the wave
function.
49 methods (Access=
public)
51 %% Contructor of the
class 52 %> @brief Constructor of the
class.
53 %> @
return An instance of the
class 56 % initializing
class members
62 obj.LatticeConstant = 1;
63 obj.OrbitalTypes = [];
70 %> @brief Removes
sites from the structure
71 %> @
param indexes Logical array. Sites with
true values will be removed from the structure.
72 %> @
return Returns with the modified structure
73 function ret = RemoveSites( obj, indexes )
75 %
do a
for loop
for class properties
76 meta_data = metaclass(obj);
78 for idx = 1:length(meta_data.PropertyList)
79 prop_name = meta_data.PropertyList(idx).Name;
80 if strcmpi(prop_name, 'a') || strcmpi(prop_name, 'b') || strcmpi(prop_name, 'LatticeConstant')
84 if ~isempty( obj.(prop_name) )
85 if iscell( obj.(prop_name) )
86 obj.(prop_name) = obj.(prop_name){~indexes};
88 obj.(prop_name) = obj.(prop_name)(~indexes);
99 %> @brief Keep only
sites in the structure defined by the input parameter #indexes
100 %> @
param indexes Logical array. Sites with
true values will be kept in the structure.
101 %> @
return Returns with the modified structure
102 function ret = KeepSites( obj, indexes )
104 %
do a
for loop
for class properties
105 meta_data = metaclass(obj);
107 for idx = 1:length(meta_data.PropertyList)
108 prop_name = meta_data.PropertyList(idx).Name;
109 if strcmpi(prop_name, 'a') || strcmpi(prop_name, 'b') || strcmpi(prop_name, 'LatticeConstant')
113 if ~isempty( obj.(prop_name) )
114 if iscell( obj.(prop_name) )
115 obj.(prop_name) = obj.(prop_name){indexes};
117 obj.(prop_name) = obj.(prop_name)(indexes);
128 %> @brief Combines the present structure with the instance given as an input
129 %> @
param cCoordinates An instance of a structure to be combined with.
130 %> @
return Returns with the combinied structure
131 function ret = Combine( obj, cCoordinates )
133 % check the type of the input
134 if ~strcmp(
class( cCoordinates ),
class(obj) )
135 error([
'EQuUs:',
class(obj),
'Combine'],
'The input class has a wrong type');
138 % creating instance to be returned
141 %
do a
for loop
for class properties
142 meta_data = metaclass(obj);
144 for idx = 1:length(meta_data.PropertyList)
145 prop_name = meta_data.PropertyList(idx).Name;
146 if strcmpi(prop_name, 'a') || strcmpi(prop_name, 'b') || strcmpi(prop_name, 'LatticeConstant')
148 % checking whether the structure to be combined with describes the same strucutre
149 if norm( obj.(prop_name) - cCoordinates.(prop_name) ) > 0
150 error(['EQuUs:', class(obj), 'Combine'], 'The structure to be combined with is describing a different structure.');
153 ret.(prop_name) = obj.(prop_name);
157 % combining data arrays
158 if ~isempty( obj.(prop_name) ) && ~isempty( cCoordinates.(prop_name) )
159 ret.(prop_name) = [obj.(prop_name); cCoordinates.(prop_name)];
160 elseif ~isempty( obj.(prop_name) ) && isempty( cCoordinates.(prop_name) )
161 error(['EQuUs:', class(obj), 'Combine'], ['Data array ', prop_name, ' is empty in the input structure']);
162 elseif isempty( obj.(prop_name) ) && ~isempty( cCoordinates.(prop_name) )
163 error(['EQuUs:', class(obj), 'Combine'], ['Data array ', prop_name, ' is empty in the initial structure']);
171 %> @brief Combines the present structure with the instance given as an input
172 %> @
param shift_vector A two- or three component vector describing the coordinate shift.
173 %> @return Returns with the shifted structure
174 function ret = Shift( obj, shift_vector )
178 % shifting the x and y coordinates
179 ret.x = obj.x + shift_vector(1);
180 ret.y = obj.y + shift_vector(2);
182 % shifting the z coordinates
183 if ~isempty( obj.z ) && length(shift_vector)>2
184 ret.z = obj.z + shift_vector(3);
190 %> @brief Transforms sthe structure into the BdG model in the Nambu space representation.
191 %> @return Returns with the transformed instance of the structure
196 fnames = fieldnames( obj );
197 for idx = 1:length(fnames)
199 if strcmp(fname,
'a') || strcmp(fname,
'b') || strcmp(fname,
'LatticeConstant')
203 if ~isempty( obj.(fname) )
204 numel = length( obj.(fname) );
207 obj.(fname) = [ obj.(fname); obj.(fname) ];
211 obj.BdG_u = [ true(numel,1); false(numel,1)];
219 end % public methods end
Property y
A vector containing the $y$ coordinates of the sites in units of the lattice constant.
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.
Structure param contains data structures describing the physical parameters of the scattering center ...
Structure sites contains data to identify the individual sites in a matrix.
Structure containing the coordinates and other quantum number identifiers of the sites in the Hamilto...
function structures(name)