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:
17 %> @addtogroup unit_tests Unit Tests
19 %> @file test_Graphene_kpoint_siesta.m
20 %> @brief Testfile to check SIESTA (dft)
interface on a graphene strip with k-point sampling.
22 %> EQuUs v4.9.... or later
26 filename = mfilename(
'fullpath');
27 [directory, fncname] = fileparts( filename );
29 Label =
'graphene_kpoints_siesta_SZ';
32 filenameIn = [
'Input_',Label,
'.xml'];
33 filenameOut = [
'output-',Label,
'.xml'];
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'];
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
47 kpoints = kpoints(kpoints(:,3)<1e-9,:)/Bohr; % For some reason Siesta stores K-point everywhere in 1/Bohr
50 check_conductivity = [1.533333333333339 ];
54 disp(
'***** test of SIESTA interface, Transport of graphene system with multiple transversal K-points *****' );
56 Conductivity = NaN(length(Evec),1);
57 Open_channels1 = NaN(length(Evec),1);
58 Open_channels2 = NaN(length(Evec),1);
60 for idx = 1:length(Evec)
61 [Conductivity(idx), Open_channels1(idx), Open_channels2(idx)] =
CalculateTransport(Evec(idx));
66 num = length(kpoints);
70 for ikp=1:length(kpoints)
71 kpoint = kpoints(ikp, 1:3);
72 kweight = kweights(ikp);
74 cTwoTerminal =
NTerminal(
'filenameIn', fullfile( pwd, filenameIn),
'filenameOut', fullfile( filenameOut),
'Silent',1,
'q', kpoint);
77 [Conductivity_tmp, ny_tmp, DeltaC_tmp] = cTwoTerminal.Transport(E,
'constant_channels',
false,
'SelfEnergy', 1);
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;
89 % checking conductances
90 checkpoint = max(Conductivity - check_conductivity);
92 warning([
'EQuUs:Tests:', fncname,
':checkpoint failed with error ', num2str( checkpoint)]);
A class describing an N-terminal geometry for equilibrium calculations mostly in the zero temperature...
Structure Opt contains the basic computational parameters used in EQuUs.
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 ...
scatter_param scatter
An instance of the structure scatter_param containing the physical parameters for the scattering regi...
function Read_Siesta_XML(xmlfile, fields, readanyway)
function structures(name)
function CalculateTransport(E)