1function [fd]=Uinvfermidirac(eta,par);
2
3%  [fd]=Uinvfermidirac(eta,par);
4
5% This file is part of
6%
7%            SECS2D - A 2-D Drift--Diffusion Semiconductor Device Simulator
8%         -------------------------------------------------------------------
9%            Copyright (C) 2004-2006  Carlo de Falco
10%
11%
12%
13%  SECS2D is free software; you can redistribute it and/or modify
14%  it under the terms of the GNU General Public License as published by
15%  the Free Software Foundation; either version 2 of the License, or
16%  (at your option) any later version.
17%
18%  SECS2D is distributed in the hope that it will be useful,
19%  but WITHOUT ANY WARRANTY; without even the implied warranty of
20%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21%  GNU General Public License for more details.
22%
23%  You should have received a copy of the GNU General Public License
24%  along with SECS2D; If not, see <http://www.gnu.org/licenses/>.
25
26% reshape eta into a sorted vector
27s = size(eta);
28eta = eta(:);
29[eta,order] = sort(eta);
30
31limits = Ufermidirac([-18,18],par);
32low  = limits(1);
33high = limits(2);
34
35etalow  = find(eta<=low);
36etahigh = find(eta>=high);
37etamid  = find((eta<high)&(eta>low));
38
39switch par
40case 1/2
41    load fdhalf;
42    fd(etalow) =log(eta(etalow));
43    fd(etahigh)=(eta(etahigh)*3*sqrt(pi)/4).^(2/3);
44    if length(etamid)
45        fd(etamid) =log(linterp(a(:,2),exp(a(:,1)),eta(etamid)));
46    end
47case -1/2
48    load fdmhalf;
49    fd(etalow) =log(eta(etalow));
50    fd(etahigh)=pi*(eta(etahigh).^2)/4;
51    if length(etamid)
52        fd(etamid) =log(linterp(a(:,2),exp(a(:,1)),eta(etamid)));
53    end
54otherwise
55    error(['wrong parameter: par=' num2str(par)])
56    return
57end
58
59
60% give answer in original order and shape
61fd(order) = fd;
62fd = reshape(fd,s);
63