Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
test_graphene_kpoints_siesta_SZ.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_Graphene_kpoint_siesta.m
20 %> @brief Testfile to check SIESTA (dft) interface on a graphene strip with k-point sampling.
21 %> @Available
22 %> EQuUs v4.9.... or later
23 %> @}
24 function test_graphene_kpoints_siesta_SZ( filenum )
25 
26  filename = mfilename('fullpath');
27  [directory, fncname] = fileparts( filename );
28 
29  Label = 'graphene_kpoints_siesta_SZ';
30 
31  % create input structures
32  filenameIn = ['Input_',Label,'.xml'];
33  filenameOut = ['output-',Label,'.xml'];
34  [Opt, param] = parseInput( filenameIn );
35 
36  Silent=1;
37 
38  %THESE ARE THE FIELDS FROM XML THAT ARE USED LATER
39  fieldsfromxml = {'siesta:kpoints', 'siesta:E_Fermi', 'siesta:nkpoints', 'Initial System', 'siesta:kpoints', 'siesta:kpt_band'};
40  siestaxml = [Opt.WorkingDir, '/', param.scatter.FileName(1:end-4),'.xml'];
41  xml_params = Read_Siesta_XML(siestaxml, fieldsfromxml);
42  kpoints = xml_params.kpoints(:,1:3);
43  kweights = xml_params.kpoints(kpoints(:,3)<1e-9, 4); %only kpoints that are zero in the direction of the transport
44  kweights = kweights/sum(kweights);
45  Bohr = 0.529177; % Conversion from Bohr to Angstrom
46 
47  kpoints = kpoints(kpoints(:,3)<1e-9,:)/Bohr; % For some reason Siesta stores K-point everywhere in 1/Bohr
48 
49  Evec = [-3.2];
50  check_conductivity = [1.533333333333339 ];
51 
52  format long;
53 
54  disp( '***** test of SIESTA interface, Transport of graphene system with multiple transversal K-points *****' );
55 
56  Conductivity = NaN(length(Evec),1);
57  Open_channels1 = NaN(length(Evec),1);
58  Open_channels2 = NaN(length(Evec),1);
59 
60  for idx = 1:length(Evec)
61  [Conductivity(idx), Open_channels1(idx), Open_channels2(idx)] = CalculateTransport(Evec(idx));
62  end
63 
64  function [T, ny1, ny2] = CalculateTransport(E)
65 
66  num = length(kpoints);
67  T_k = NaN(num,1);
68  ny1_k = NaN(num,1);
69  ny2_k = NaN(num,1);
70  for ikp=1:length(kpoints)
71  kpoint = kpoints(ikp, 1:3);
72  kweight = kweights(ikp);
73 
74  cTwoTerminal = NTerminal('filenameIn', fullfile( pwd, filenameIn), 'filenameOut', fullfile( filenameOut), 'Silent',1, 'q', kpoint);
75 
76  DeltaC_tmp = 0;
77  [Conductivity_tmp, ny_tmp, DeltaC_tmp] = cTwoTerminal.Transport(E, 'constant_channels', false, 'SelfEnergy', 1);
78 
79  T_k(ikp) = -Conductivity_tmp(1,1)*kweight;
80  ny1_k(ikp) = ny_tmp(1)*kweight;
81  ny2_k(ikp) = ny_tmp(2)*kweight;
82 
83  end
84  T = sum(T_k);
85  ny1 = sum(ny1_k);
86  ny2 = sum(ny2_k);
87  end
88 
89  % checking conductances
90  checkpoint = max(Conductivity - check_conductivity);
91  if checkpoint > 1e-7
92  warning(['EQuUs:Tests:', fncname, ':checkpoint failed with error ', num2str( checkpoint)]);
93  Conductivity
94  end
95 
96 
97 end
98 
99 
A class describing an N-terminal geometry for equilibrium calculations mostly in the zero temperature...
Definition: NTerminal.m:38
Structure Opt contains the basic computational parameters used in EQuUs.
Definition: structures.m:60
function test_graphene_kpoints_siesta_SZ(filenum)
function Transport(Energy, B)
Calculates the conductance at a given energy value.
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
function Read_Siesta_XML(xmlfile, fields, readanyway)
function parseInput(filename)
This function parses the input file containing the input parameters.
function structures(name)
function CalculateTransport(E)