Eötvös Quantum Utilities  v4.8.141
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  %> 1/(k_B*T)
33  beta
34  %> treshold temperature (makes difference between T=0 and T>0)
35  T_treshold = 1e-10;
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.beta = [];
51 
52  if strcmpi(class(obj), 'FermiDirac')
53  obj.InputParsing( varargin{:});
54  end
55 
56 
57  end
58 
59 
60 %% Fermi
61 %> @brief A function of the Fermi-Dirac statistics
62 %> @param E The energy value in eV (scalar or an array of energy values).
63 %> @return Returns with the occupation numbers (numbers).
64  function ret = Fermi(obj, E)
65 
66  E = reshape(E, 1, numel(E));
67 
68  ret = zeros( length(obj.beta), length(E) );
69  indexes = logical( abs(obj.T) <= obj.T_treshold);
70 
71  ret( indexes, E-obj.mu<0 ) = 1;
72  ret( indexes ,E-obj.mu==0 ) = 0.5;
73  ret( indexes, E-obj.mu>0) = 0;
74 
75  if ~isempty(obj.beta(~indexes))
76  ret( ~indexes, :) = 1./(1+exp(obj.beta(~indexes)*(E-obj.mu)));
77  end
78  end
79 
80 
81 %% setTemperature
82 %> @brief Sets the temperature for the calculations.
83 %> @param T The temperature in Kelvin (scalar or an array)
84  function setTemperature(obj, T)
85  obj.T = reshape( T, numel(T), 1);
86  obj.beta = 1./(obj.k_B*T);
87  end
88 
89 
90 
91 end % public methods
92 
93 
94 methods (Access=protected)
95 
96 %% InputParsing
97 %> @brief Parses the optional parameters for the class constructor.
98 %> @param varargin Cell array of optional parameters (https://www.mathworks.com/help/matlab/ref/varargin.html):
99 %> @param 'T' The absolute temperature in Kelvins.
100 %> @param 'mu' The Chemical potential in the same unit as other energy scales in the Hamiltonians.
101  function InputParsing( obj, varargin )
102 
103 
104  p = inputParser;
105  p.addParameter('T', 0);
106  p.addParameter('mu', 0, @isscalar);
107 
108  p.parse(varargin{:});
109 
110  T = p.Results.T;
111  obj.mu = p.Results.mu;
112 
113  obj.setTemperature(T);
114 
115 
116  end
117 
118 
119 end % protected methods
120 
121 
122 end
A class describing the Fermi Dirac distribution of fermionic particles.
Definition: FermiDirac.m:25
function Transport(Energy, B)
creating the Ribbon class representing the twoterminal setup
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