Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
Coordinates.m
Go to the documentation of this file.
1 %% Eotvos Quantum Transport Utilities - Coordinates
2 % Copyright (C) 2018 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 structures Structures
18 %> @{
19 %> @file Coordinates.m
20 %> @brief Structure containing the coordinates and other quantum number identifiers of the sites in the Hamiltonians.
21 %> @}
22 %> @brief Structure containing the coordinates and other quantum number identifiers of the sites in the Hamiltonians.
23 %%
24 classdef Coordinates
25 
26  properties
27  %> A vector containing the $x$ coordinates of the sites in units of the lattice constant.
28  x
29  %> A vector containing the $y$ coordinates of the sites in units of the lattice constant.
30  y
31  %> A vector containing the $z$ coordinates of the sites in units of the lattice constant.
32  z
33  %> The lattice vector of the translational invariant lead in units of the lattice constant.
34  a
35  %> The lattice vector in the transverse direction in units of the lattice constant.
36  b
37  %> Units of length
38  LatticeConstant
39  %> Cell array containing the orbital types of the sites
40  OrbitalTypes
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.
42  spinup
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.
44  BdG_u
45  end
46 
47 
48 
49 methods (Access=public)
50 
51 %% Contructor of the class
52 %> @brief Constructor of the class.
53 %> @return An instance of the class
54  function obj = Coordinates()
55 
56  % initializing class members
57  obj.x = [];
58  obj.y = [];
59  obj.z = [];
60  obj.a = [];
61  obj.b = [];
62  obj.LatticeConstant = 1;
63  obj.OrbitalTypes = [];
64  obj.spinup = [];
65  obj.BdG_u = [];
66 
67  end
68 
69 %% RemoveSites
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 )
74 
75  % do a for loop for class properties
76  meta_data = metaclass(obj);
77 
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')
81  continue
82  end
83 
84  if ~isempty( obj.(prop_name) )
85  if iscell( obj.(prop_name) )
86  obj.(prop_name) = obj.(prop_name){~indexes};
87  else
88  obj.(prop_name) = obj.(prop_name)(~indexes);
89  end
90  end
91  end
92 
93  ret = obj;
94 
95  end
96 
97 
98 %% KeepSites
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 )
103 
104  % do a for loop for class properties
105  meta_data = metaclass(obj);
106 
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')
110  continue
111  end
112 
113  if ~isempty( obj.(prop_name) )
114  if iscell( obj.(prop_name) )
115  obj.(prop_name) = obj.(prop_name){indexes};
116  else
117  obj.(prop_name) = obj.(prop_name)(indexes);
118  end
119  end
120  end
121 
122  ret = obj;
123 
124  end
125 
126 
127 %% Combine
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 )
132 
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');
136  end
137 
138  % creating instance to be returned
139  ret = structures('coordinates');
140 
141  % do a for loop for class properties
142  meta_data = metaclass(obj);
143 
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')
147 
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.');
151  end
152 
153  ret.(prop_name) = obj.(prop_name);
154  continue
155  end
156 
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']);
164  end
165  end
166 
167  end
168 
169 
170 %% Combine
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 )
175 
176  ret = obj;
177 
178  % shifting the x and y coordinates
179  ret.x = obj.x + shift_vector(1);
180  ret.y = obj.y + shift_vector(2);
181 
182  % shifting the z coordinates
183  if ~isempty( obj.z ) && length(shift_vector)>2
184  ret.z = obj.z + shift_vector(3);
185  end
186 
187  end
188 
189 %% Transform2BdG
190 %> @brief Transforms sthe structure into the BdG model in the Nambu space representation.
191 %> @return Returns with the transformed instance of the structure
192  function ret = Transform2BdG( obj )
193 
194  numel = [];
195 
196  fnames = fieldnames( obj );
197  for idx = 1:length(fnames)
198  fname = fnames{idx};
199  if strcmp(fname, 'a') || strcmp(fname, 'b') || strcmp(fname, 'LatticeConstant')
200  continue
201  end
202 
203  if ~isempty( obj.(fname) )
204  numel = length( obj.(fname) );
205  end
206 
207  obj.(fname) = [ obj.(fname); obj.(fname) ];
208  end
209 
210  if ~isempty(numel)
211  obj.BdG_u = [ true(numel,1); false(numel,1)];
212  end
213 
214  ret = obj;
215 
216  end
217 
218 
219 end % public methods end
220 
221 end
Property y
A vector containing the $y$ coordinates of the sites in units of the lattice constant.
Definition: Coordinates.m:33
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.
function()
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
Structure sites contains data to identify the individual sites in a matrix.
Definition: structures.m:187
Structure containing the coordinates and other quantum number identifiers of the sites in the Hamilto...
Definition: Coordinates.m:24
function structures(name)