Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
test_CreateHamiltonians.m
Go to the documentation of this file.
1 %% Eotvos Quantum Transport Utilities
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 unit_tests Unit Tests
18 %> @{
19 %> @file test_CreateHamiltonians.m
20 %> @brief Testfile to check functionalities of the class CreateHamiltonians.
21 %> @Available
22 %> EQuUs v4.8.... or later
23 %> @}
24 %> @brief Testfile to check functionalities of the class CreateHamiltonians.
26 
27 filename = mfilename('fullpath');
28 [directory, fncname] = fileparts( filename );
29 
30  % create input structures
31  [Opt, param] = parseInput( 'Input_Ribbon.xml');
32 
33  % adjusting the shape of the scattering region
34  param.scatter.shape.width = 200;
35  param.scatter.shape.height = 400;
36 
37  % creating class CreateHamiltonians
38  cCreateHamiltonians = CreateHamiltonians( Opt, param );
39 
40  %% test of method of removing indexes from the Hamiltonian
41  disp( '***** test of class Ribbon_Keldysh, Transport_Interface_Keldysh *****' );
42 
43  % creating the Hamiltonian of the scattering region
44  cCreateHamiltonians.CreateScatterH()
45 
46  % retriving the created Hamiltonian
47  Hscatter0 = cCreateHamiltonians.Read('Hscatter');
48 
49  % defining a circle shaped area that should be removed from the Hamiltonian
50  cCircle = structures('circle');
51  cCircle.radius = 30;
52  cCircle.center.x = param.scatter.shape.width/2;
53  cCircle.center.y = param.scatter.shape.height/2;
54 
55  % determine indexes that should be removed
56  cCoordinates0 = cCreateHamiltonians.Read('coordinates');
57  indexes = (cCoordinates0.x - cCircle.center.x).^2 + (cCoordinates0.y - cCircle.center.y).^2 < cCircle.radius^2;
58 
59  % removing sites from the Hamiltonian
60  cCreateHamiltonians.RemoveSites( indexes )
61 
62  % checking the number of remaininng sites
63  Hscatter = cCreateHamiltonians.Read('Hscatter');
64 
65  size_Hscatter0 = size(Hscatter0);
66  size_Hscatter = size(Hscatter);
67 
68  checkpoint = norm( size_Hscatter0 - size_Hscatter - length(find(indexes))*[1 1] );
69  if checkpoint > 1e-10
70  warning(['EQuUs:Tests:', fncname, ':checkpoint failed with error ', num2str( checkpoint)]);
71  end
72 
73  % checking the structure Coordinates
74  cCoordinates = cCreateHamiltonians.Read('coordinates');
75  checkpoint = norm( length(cCoordinates0.x) - length(cCoordinates.x) - length(find(indexes)) );
76  if checkpoint > 1e-10
77  warning(['EQuUs:Tests:', fncname, ':checkpoint failed with error ', num2str( checkpoint)]);
78  end
79 
80 end
function test(arg1, arg2)
Brief description of the function.
Structure circle contains data describing a circle shaped area positioned in a two-dimensional space.
Definition: structures.m:34
Structure Opt contains the basic computational parameters used in EQuUs.
Definition: structures.m:60
Structure shape contains data about the geometry of the scattering region.
Definition: structures.m:106
function Transport(Energy, B)
Calculates the conductance at a given energy value.
function CreateScatterH(varargin)
Creates a Hamiltonian of a rectangle shaped area.
function RemoveSites(indexes)
Removes specific sites from the model of the scattering region.
function CreateHamiltonians(Opt, param, varargin)
Constructor of the class.
function()
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45
scatter_param scatter
An instance of the structure scatter_param containing the physical parameters for the scattering regi...
Definition: structures.m:47
Structure sites contains data to identify the individual sites in a matrix.
Definition: structures.m:187
Property Opt
An instance of structure Opt.
Definition: Messages.m:31
Property Hscatter
The matrix of the Hamiltonian.
function test_CreateHamiltonians()
Testfile to check functionalities of the class CreateHamiltonians.
Property param
An instance of structure param.
function parseInput(filename)
This function parses the input file containing the input parameters.
Structure containing the coordinates and other quantum number identifiers of the sites in the Hamilto...
Definition: Coordinates.m:24
function Read(MemberName)
Query for the value of an attribute in the class.
function structures(name)
A class to create and store Hamiltonian of the scattering region.