initial checkin, based on GSS 0.46 CVS
[gss-tcad.git] / src / include / doping.h
blob0f9b36ddb092809f9b3cdf8a79d8e2fd8b426a3e
1 /*****************************************************************************/
2 /* 8888888 88888888 88888888 */
3 /* 8 8 8 */
4 /* 8 8 8 */
5 /* 8 88888888 88888888 */
6 /* 8 8888 8 8 */
7 /* 8 8 8 8 */
8 /* 888888 888888888 888888888 */
9 /* */
10 /* A Two-Dimensional General Purpose Semiconductor Simulator. */
11 /* */
12 /* GSS 0.4x */
13 /* Last update: March 29, 2006 */
14 /* */
15 /* Gong Ding */
16 /* gdiso@ustc.edu */
17 /* NINT, No.69 P.O.Box, Xi'an City, China */
18 /* */
19 /*****************************************************************************/
21 #ifndef _doping_h_
22 #define _doping_h_
24 #include "mathfunc.h"
25 #include "typedef.h"
26 const int Uniform = 1011;
27 const int Gauss = 1012;
28 const int Erf = 1013;
30 const double DONOR = 1.0;
31 const double ACCEPTOR = -1.0;
33 enum PROFILE_CARD_ERROR
35 PROFILE_NO_ERROR,
36 PROFILE_UNKNOW_PARAMETER,
37 PROFILE_ION_TYPE,
38 PROFILE_XLOCATION,
39 PROFILE_YLOCATION,
40 PROFILE_NEGTIVE_DOSE,
41 PROFILE_NEGTIVE_CONCENTR,
42 PROFILE_DOPING_CHAR_LENGTH
46 class DopingFunc
48 public:
49 double ion; // N-ion or P-ion
50 double xmin; // bound box
51 double xmax;
52 double ymin;
53 double ymax;
54 public:
55 virtual double profile(double x,double y)=0;
58 class UniformDopingFunc : public DopingFunc
60 public:
61 double PEAK;
62 UniformDopingFunc(double xleft, double xright, double ytop, double ybottom, double doping_ion, double N)
64 PEAK = N;
65 xmin = xleft;
66 xmax = xright;
67 ymin = ybottom;
68 ymax = ytop;
69 ion = doping_ion;
71 double profile(double x,double y)
73 if(x>=xmin-1e-6 && x<=xmax+1e-6 && y>=ymin-1e-6 &&y<=ymax+1e-6)
74 return ion*PEAK;
75 else
76 return 0;
80 class GaussDopingFunc : public DopingFunc
82 public:
83 double PEAK;
84 double XCHAR;
85 double YCHAR;
86 GaussDopingFunc(double xleft, double xright, double ytop, double ybottom,
87 double doping_ion, double N, double ax, double ay)
89 PEAK = N;
90 XCHAR = ax;
91 YCHAR = ay;
92 xmin = xleft;
93 xmax = xright;
94 ymin = ybottom;
95 ymax = ytop;
96 ion = doping_ion;
98 double profile(double x,double y)
100 double dx,dy;
101 if(x<xmin)
102 dx = exp(-(x-xmin)*(x-xmin)/(XCHAR*XCHAR));
103 else if(x>=xmin&&x<=xmax)
104 dx = 1.0;
105 else
106 dx = exp(-(x-xmax)*(x-xmax)/(XCHAR*XCHAR));
108 if(y<ymin)
109 dy = exp(-(y-ymin)*(y-ymin)/(YCHAR*YCHAR));
110 else if(y>=ymin&&y<=ymax)
111 dy = 1.0;
112 else
113 dy = exp(-(y-ymax)*(y-ymin)/(YCHAR*YCHAR));
115 return ion*PEAK*dx*dy;
119 class ErfDopingFunc : public DopingFunc
121 public:
122 double PEAK;
123 double XCHAR;
124 double YCHAR;
125 ErfDopingFunc(double xleft, double xright, double ytop, double ybottom,
126 double doping_ion, double N, double ax, double ay)
128 PEAK = N;
129 XCHAR = ax;
130 YCHAR = ay;
131 xmin = xleft;
132 xmax = xright;
133 ymin = ybottom;
134 ymax = ytop;
135 ion = doping_ion;
137 double profile(double x,double y)
139 double dx,dy;
140 dx = (erfc((x-xmax)/XCHAR)-erfc((x-xmin)/XCHAR))/2;
141 if(y<ymin)
142 dy = exp(-(y-ymin)*(y-ymin)/(YCHAR*YCHAR));
143 else if(y>=ymin&&y<=ymax)
144 dy = 1.0;
145 else
146 dy = exp(-(y-ymax)*(y-ymin)/(YCHAR*YCHAR));
147 return ion*PEAK*dx*dy;
150 #endif