3 %> @brief Creates the
Hamiltonians and Overlap matrices from the HSX file data of the SIESTA output.
7 %> @brief Creates the
Hamiltonians and Overlap matrices from the HSX file data of the SIESTA output.
8 %> @
param Param contains general input parameters
9 %> @
param SIESTA_HSX_file is the file, where the hamiltonian is stored in a unique sparse format of SIESTA
10 %> @
param SIESTA_XML_params parameters from SIESTA xml output
11 %> @
param q k-point, where the Hamiltonian and Overlap matrices should be constructed
12 %> @
return The constructed Hamiltonian of the whole system as HS, atomic coordinates and a description of the orbital system
13 function [HS, coordsSC, iorb, Param, Atoms] =
Read_Siesta_Scatter(Param, SIESTA_HSX_file, SIESTA_XML_params, q)
15 %SOME CONSTANTS USE IN SIESTA
16 RytoeV = 1/13.60580; % in SIESTA_HSX_file values are stored in Ry and Bohr
17 Bohr = 0.529177; % These are conversion units to eV and Angstrom
19 %% TODO kpoints needed?
21 Param.scatter.ElementNumber = SIESTA_XML_params.elmtxv;
22 Param.scatter.ElementSymbol = SIESTA_XML_params.spxv;
23 Param.scatter.LatticeVectors = SIESTA_XML_params.Lattice_vectors;
25 %COORDS and %LATTICE VECTORS
29 HSXmat=
'SIESTAHSX.mat';
31 %% READ FILE
"system_label.HSX" 32 if exist(HSXmat,
'file') == 0 |
true 35 %IF USING THE FORTRAN HSX READER, THEN VARIABLES HAVE TO BE CONVERTED TO DOUBLES
37 hsx.listhptr=double(
hsx.listhptr);
38 hsx.indxuo=double(
hsx.indxuo);
40 no_u = double(
hsx.no_u);
41 nspin = double(
hsx.nspin);
42 Param.scatter.nspin =
hsx.nspin;
45 hsx.hamilt =
hsx.hamilt/RytoeV;
47 Atoms = zeros(
hsx.no_u);
49 %% CREATE ORBITAL INFO
53 iphorb =
hsx.iphorb(iuo);
55 element_index = Param.scatter.ElementNumber(iat);
56 coordsSC.x(iuo) = SIESTA_XML_params.coordinates(iat,1);
57 coordsSC.y(iuo) = SIESTA_XML_params.coordinates(iat,2);
58 coordsSC.z(iuo) = SIESTA_XML_params.coordinates(iat,3);
60 dum = [ iat,
hsx.nquant(spec,iphorb),
hsx.lquant(spec,iphorb), 0,
hsx.zeta(spec,iphorb),...
66 %% IF IT IS FROM A COLLINEAR SPIN POLARIZED CALCULATION THEN
67 % WE DOUBLE THE SIZE OF THE HAMILTONIAN AND STORE THEM IN SEPARATE BLOCKS
68 % BUT IN A NONCOLLINEAR CASE
71 coordsSC.x = [coordsSC.x; coordsSC.x];
72 coordsSC.y = [coordsSC.y; coordsSC.y];
73 coordsSC.z = [coordsSC.z; coordsSC.z];
74 element_index = [element_index; element_index];
75 Atoms = [Atoms; Atoms];
78 %% Find supercell size
79 %
Transport direction is always into the direction of the z-coordinate
80 sux = floor( max(
hsx.xij(1,:)) / Param.scatter.LatticeVectors(1,1)+0.5);
82 suy = floor( max(
hsx.xij(2,:)) / Param.scatter.LatticeVectors(2,2)+0.5);
84 suz = floor( max(
hsx.xij(3,:)) / Param.scatter.LatticeVectors(3,3)+0.5);
86 throw(
'It should not have kpoints into z directions, which is the transport direction')
89 %COMPOSING THE Hk FROM HAMILTONIAN ELEMENTS
90 %EM PART, THE SCATTERING REGION
91 %IN CASE OF JOSEPHSON CURRENT MODE, THIS EXCLUDES THE INTERFACE
92 %WHICH IS THE PART OF THE ELECTRODES, CLOSEST TO EM, THAT IS NOT USED
93 %FOR THE LEADS CALCULATION
96 tt = [ tt 1:
hsx.numh(iuo)];
97 tk= [tk
hsx.listhptr(iuo).*ones(
hsx.numh(iuo),1)
'];%' 103 iuo = [iuo double(ii).*ones(
hsx.numh(ii),1)
'];%' 106 juo=(
hsx.indxuo(jo))
';%' 108 % Convert
hsx.xij from Bohr to Angstrom
111 %% TODO maybe coordinates(iuo
',1) = coordsSC.x(iorb(iuo',1)
112 Rbloch(:,1) = xij(1,ind)
' + coordsSC.x(iuo)' - coordsSC.x(juo)
'; 113 Rbloch(:,2) = xij(2,ind)' + coordsSC.y(iuo)
' - coordsSC.y(juo)';
114 Rbloch(:,3) = xij(3,ind)
' + coordsSC.z(iuo)' - coordsSC.z(juo)
'; 116 %save(HSXmat, 'hsx', 'coordsSC
', 'iorb
', 'Rbloch
', 'ind
', 'iuo
', 'juo
', 'no_u
'); 121 %% Find supercell size (experiment with this later) 122 %sux = floor( max(hsx.xij(1,:)) / Param.scatter.LatticeVectors(1,1)+0.5); 124 %suy = floor( max(hsx.xij(2,:)) / Param.scatter.LatticeVectors(2,2)+0.5); 126 %suz = floor( max(hsx.xij(3,:)) / Param.scatter.LatticeVectors(3,3)+0.5); 128 % throw('It should not have kpoints into z directions, which is the transport direction
') 131 %COMPOSING THE Hk FROM HAMILTONIAN ELEMENTS 132 %EM PART, THE SCATTERING REGION 133 %IN CASE OF JOSEPHSON CURRENT MODE, THIS EXCLUDES THE INTERFACE 134 %WHICH IS THE PART OF THE ELECTRODES, CLOSEST TO EM, THAT IS NOT USED 135 %FOR THE LEADS CALCULATION 139 eikr = exp(-1.0i* (q(1).*Rbloch(ind,1)+q(2).*Rbloch(ind,2)+q(3).*Rbloch(ind,3))); 141 eikr = ones(length(ind), 1); 143 if Param.scatter.nspin <= 2 144 HS(1).S = sparse(juo,iuo, hsx.Sover.*eikr,no_u,no_u); 145 for is=1:Param.scatter.nspin 146 HS(is).H = sparse(juo,iuo, hsx.hamilt(:,is).*eikr,no_u,no_u); 148 elseif Param.scatter.nspin == 4 149 HS(1).S = kron(eye(2),sparse(juo,iuo, hsx.Sover.*eikr,no_u,no_u)); 150 H1=kron([1 0; 0 0], sparse(juo,iuo, hsx.hamilt(:,1).*eikr,no_u,no_u)); 151 H2=kron([0 0; 0 1], sparse(juo,iuo, hsx.hamilt(:,2).*eikr,no_u,no_u)); 152 H3=kron([0 1; 0 0], sparse(juo,iuo, (hsx.hamilt(:,3)-1i*hsx.hamilt(:,4)).*eikr,no_u,no_u)); 153 H4=kron([0 0; 1 0], sparse(juo,iuo, (hsx.hamilt(:,3)+1i*hsx.hamilt(:,4)).*eikr,no_u,no_u)); 154 HS(1).H = H1 + H2 + H3 + H4; 155 elseif Param.scatter.nspin == 8 156 HS(1).S = kron(eye(2),sparse(juo,iuo, hsx.Sover.*eikr,no_u,no_u)); 157 H1=kron([1 0; 0 0], sparse(juo,iuo, (hsx.hamilt(:,1)+1i*hsx.hamilt(:,5)).*eikr,no_u,no_u)); 158 H2=kron([0 0; 0 1], sparse(juo,iuo, (hsx.hamilt(:,2)+1i*hsx.hamilt(:,6)).*eikr,no_u,no_u)); 159 H3=kron([0 1; 0 0], sparse(juo,iuo, (hsx.hamilt(:,3)-1i*hsx.hamilt(:,4)).*eikr,no_u,no_u)); 160 H4=kron([0 0; 1 0], sparse(juo,iuo, (hsx.hamilt(:,7)+1i*hsx.hamilt(:,8)).*eikr,no_u,no_u)); 161 HS(1).H = H1 + H2 + H3 + H4;
function Read_Siesta_Scatter(Param, SIESTA_HSX_file, SIESTA_XML_params, q)
Creates the Hamiltonians and Overlap matrices from the HSX file data of the SIESTA output.
subroutine read_hsx(fname, fname_len, eq_struct)
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 ...
scatter_param scatter
An instance of the structure scatter_param containing the physical parameters for the scattering regi...
function Get_Atomic_Mass(Z)
function structures(name)