Eötvös Quantum Utilities  v4.9.146
Providing the Horsepowers in the Quantum Realm
FermiDirac.m
Go to the documentation of this file.
1 %% Eotvos Quantum Transport Utilities - FermiDirac
2 % Copyright (C) 2016 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 %
18 %> @addtogroup basic Basic Functionalities
19 %> @{
20 %> @file FermiDirac.m
21 %> @brief A class describing the Fermi Dirac distribution of fermionic particles.
22 %> @}
23 %> @brief A class describing the Fermi Dirac distribution of fermionic particles.
24 %%
25 classdef FermiDirac < handle
26 
27  properties (Access = protected)
28  %> Boltzmann constant in eV/K
29  k_B
30  %> The temperature in Kelvin
31  T
32  %> \f$\beta = 1/(k_BT)\f$
33  beta
34  %> treshold temperature (makes difference between T=0 and T>0)
35  T_treshold
36  %> The Chemical potential in the same unit as other energy scales in the Hamiltonians.
37  mu
38  end
39 
40 
41 methods (Access=public)
42 
43 %% FermiDirac
44 %> @brief A constructor of the class
45 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html), for details see #InputParsing.
46 %> @return Returns with an instance of the class.
47  function obj = FermiDirac( varargin )
48 
49  obj.k_B = 8.6173324e-5; % Boltzmann constant in eV/K
50  obj.T_treshold = 1e-10;
51  obj.beta = [];
52  obj.T = 0;
53  obj.mu = 0;
54 
55  if strcmpi(class(obj), 'FermiDirac')
56  obj.InputParsing( varargin{:});
57  end
58 
59 
60  end
61 
62 
63 %% Fermi
64 %> @brief A function of the Fermi-Dirac statistics
65 %> @param E The energy value in eV (scalar or an array of energy values).
66 %> @return Returns with the occupation number (numbers).
67  function ret = Fermi(obj, E)
68 
69  E = reshape(E, 1, numel(E));
70 
71  ret = zeros( length(obj.beta), length(E) );
72  indexes = logical( abs(obj.T) <= obj.T_treshold);
73 
74  ret( indexes, E-obj.mu<0 ) = 1;
75  ret( indexes ,E-obj.mu==0 ) = 0.5;
76  ret( indexes, E-obj.mu>0) = 0;
77 
78  if ~isempty(obj.beta(~indexes))
79  ret( ~indexes, :) = 1./(1+exp(obj.beta(~indexes)*(E-obj.mu)));
80  end
81  end
82 
83 
84 %% setTemperature
85 %> @brief Sets the temperature for the calculations.
86 %> @param T The temperature in Kelvin (scalar or an array)
87  function setTemperature(obj, T)
88  obj.T = reshape( T, numel(T), 1);
89  obj.beta = 1./(obj.k_B*T);
90  end
91 
92 
93 
94 end % public methods
95 
96 
97 methods (Access=protected)
98 
99 %% InputParsing
100 %> @brief Parses the optional parameters for the class constructor.
101 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
102 %> @param 'T' The absolute temperature in Kelvins.
103 %> @param 'mu' The Chemical potential in the same unit as other energy scales in the Hamiltonians.
104  function InputParsing( obj, varargin )
105 
106 
107  p = inputParser;
108  p.addParameter('T', obj.T);
109  p.addParameter('mu', obj.mu, @isscalar);
110 
111  p.parse(varargin{:});
112 
113  obj.mu = p.Results.mu;
114 
115  obj.setTemperature(p.Results.T);
116 
117 
118  end
119 
120 
121 end % protected methods
122 
123 
124 end
A class describing the Fermi Dirac distribution of fermionic particles.
Definition: FermiDirac.m:25
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.
Property k_B
Boltzmann constant in eV/K.
Definition: FermiDirac.m:32
Structure param contains data structures describing the physical parameters of the scattering center ...
Definition: structures.m:45