00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 void read_input_file(void)
00032 {
00033 int index;
00034 double dum;
00035 char s[200];
00036
00037
00038 TEMPO=0.;
00039 DDMAX=0.;
00040 IIFLAG=NO;
00041 Quantum_Flag=0;
00042 NHTFLAG=WRITE;
00043 POISSONUPDATEFLAG=YES;
00044 SAVEPARTICLESFLAG=YES;
00045 SAVEPARTICLESFORMAT=ALL;
00046 SAVEFIELDSFLAG=YES;
00047 SAVEFIELDSFORMAT=ALL;
00048
00049
00050 for(index=0;index<Ng;index++) VIC[index]=0.;
00051 for(index=0;index<Ng;index++) i_front[index]=NOCONTACT;
00052 for(index=0;index<Ne;index++) i_dom[index]=SILICON;
00053 for(index=0;index<Ne;index++) ND[index]=NA[index]=0.;
00054
00055 for(index=0;index<NOAMTIA;index++) XVAL[index]=0.2;
00056
00057 if(fp==NULL){
00058 printf("read_input_file error : problems in opening file.inp!\n");
00059 exit(0);
00060 }
00061
00062 printf("\nProcessing the input file...\n");
00063 printf("******************************\n");
00064 while(!feof(fp)){
00065
00066 fscanf(fp,"%s",s);
00067
00068 if(strcmp(s,"#")==0){
00069 fgets(s,80,fp);
00070 printf("COMMENT ---> %s",s);
00071 } else if(strcmp(s,"TIMESTEP")==0){
00072 fscanf(fp,"%lf",&dum);
00073 DT=dum;
00074 if(DT<=0.){
00075 printf("read_input_file error : negative time step!\n");
00076 exit(0);
00077 }
00078 printf("TIMESTEP ---> %g",DT);
00079 } else if(strcmp(s,"FINALTIME")==0){
00080 fscanf(fp,"%lf",&dum);
00081 TF=dum;
00082 if(TF<=0.){
00083 printf("read_input_file error : negative final time!\n");
00084 exit(0);
00085 }
00086 printf("FINAL TIME = %lg ---> Ok\n",TF);
00087 } else if(strcmp(s,"MEDIA")==0){
00088 fscanf(fp,"%d",&MEAN);
00089 if(MEAN<0){
00090 printf("read_input_file error : number of media is negative!\n");
00091 exit(0);
00092 }
00093 printf("MEDIA = %d ---> Ok\n",MEAN);
00094 } else if(strcmp(s,"LATTICETEMPERATURE")==0){
00095 fscanf(fp,"%lf",&TL);
00096 if(TL<=0.){
00097 printf("read_input_file error : not valid lattice temperature!\n");
00098 exit(0);
00099 }
00100 printf("LATTICE TEMPERATURE = %g ---> Ok\n",TL);
00101 } else if(strcmp(s,"SAVEEVERYNUMSTEPS")==0){
00102 fscanf(fp,"%d",&every_num_steps);
00103 printf("SAVE EVERY %d STEPS ---> Ok\n",every_num_steps);
00104 } else if(strcmp(s,"CIMP")==0){
00105 fscanf(fp,"%lf",&CIMP);
00106 if(CIMP<0.){
00107 printf("read_input_file error : not valid impurity concentration\n");
00108 exit(0);
00109 }
00110 printf("CIMP = %g ---> Ok\n",CIMP);
00111 } else if(strcmp(s,"CONTACT")==0){
00112 int type;
00113 double xi,xf;
00114 double yi,yf;
00115 double zi,zf;
00116 double volt;
00117 fscanf(fp,"%s",s);
00118 if(strcmp(s,"X")==0) fscanf(fp,"%lf %lf",&xi,&xf);
00119 else{
00120 printf("read_input_file error : X contact not specified!\n");
00121 exit(0);
00122 }
00123 fscanf(fp,"%s",s);
00124 if(strcmp(s,"Y")==0) fscanf(fp,"%lf %lf",&yi,&yf);
00125 else{
00126 printf("read_input_file error : Y contact not specified!\n");
00127 exit(0);
00128 }
00129 fscanf(fp,"%s",s);
00130 if(strcmp(s,"Z")==0) fscanf(fp,"%lf %lf",&zi,&zf);
00131 else{
00132 printf("read_input_file error : Z contact not specified!\n");
00133 exit(0);
00134 }
00135 fscanf(fp,"%s",s);
00136 if(strcmp(s,"OHMIC")==0){
00137 type=OHMIC;
00138 fscanf(fp,"%lf",&volt);
00139 }
00140 else if(strcmp(s,"SCHOTTKY")==0){
00141 type=SCHOTTKY;
00142 fscanf(fp,"%lf",&volt);
00143 }
00144 else if(strcmp(s,"INSULATOR")==0) type=INSULATOR;
00145 else{
00146 printf("read_input_file error : unknown specified contact!\n");
00147 printf("contact %s is unknown!\n",s);
00148 exit(0);
00149 }
00150 if(type==OHMIC || type==SCHOTTKY)
00151 printf("CONTACT X=[%g,%g] Y=[%g,%g] Z=[%g,%g] %s %g volts ---> Ok\n",
00152 xi,xf,yi,yf,zi,zf,s,volt);
00153 if(type==INSULATOR)
00154 printf("CONTACT X=[%g,%g] Y=[%g,%g] Z=[%g,%g] %s ---> Ok\n",
00155 xi,xf,yi,yf,zi,zf,s);
00156 for(index=0;index<Ng;index++)
00157 if((xi<=coord[0][index]) &&(coord[0][index]<=xf) &&
00158 (yi<=coord[1][index]) &&(coord[1][index]<=yf) &&
00159 (zi<=coord[2][index]) &&(coord[2][index]<=zf)){
00160 VIC[index]=volt;
00161 i_front[index]=type;
00162 }
00163 } else if(strcmp(s,"STATISTICALWEIGHT")==0){
00164 fscanf(fp,"%d",&NP1);
00165 printf("STATISTICAL WEIGHT = %d ---> Ok\n",NP1);
00166 } else if(strcmp(s,"POISSONSOLVER")==0){
00167 fscanf(fp,"%d",&itol);
00168 printf("POISSONSOLVER %d ---> Ok\n",itol);
00169 } else if(strcmp(s,"POISSONTOLLERANCE")==0){
00170 fscanf(fp,"%lf",&tol);
00171 printf("POISSONTOLLERANCE %g ---> Ok\n",tol);
00172 } else if(strcmp(s,"POISSONITMAX")==0){
00173 fscanf(fp,"%d",&itmax);
00174 printf("POISSONITMAX %d ---> Ok\n",itmax);
00175 } else if(strcmp(s,"MATERIAL")==0){
00176 int type;
00177 double xi,xf;
00178 double yi,yf;
00179 double zi,zf;
00180 fscanf(fp,"%s",s);
00181 if(strcmp(s,"X")==0) fscanf(fp,"%lf %lf",&xi,&xf);
00182 else{
00183 printf("read_input_file error : X material not specified!\n");
00184 exit(0);
00185 }
00186 fscanf(fp,"%s",s);
00187 if(strcmp(s,"Y")==0) fscanf(fp,"%lf %lf",&yi,&yf);
00188 else{
00189 printf("read_input_file error : Y material not specified!\n");
00190 exit(0);
00191 }
00192 fscanf(fp,"%s",s);
00193 if(strcmp(s,"Z")==0) fscanf(fp,"%lf %lf",&zi,&zf);
00194 else{
00195 printf("read_input_file error : Z material not specified!\n");
00196 exit(0);
00197 }
00198 fscanf(fp,"%s",s);
00199 if(strcmp(s,"SILICON")==0) type=SILICON;
00200 else if(strcmp(s,"GAAS")==0) type=GAAS;
00201 else if(strcmp(s,"GERMANIUM")==0) type=GERMANIUM;
00202 else if(strcmp(s,"INSB")==0) type=INSB;
00203 else if(strcmp(s,"ALSB")==0) type=ALSB;
00204 else if(strcmp(s,"ALAS")==0) type=ALAS;
00205 else if(strcmp(s,"ALP")==0) type=ALP;
00206 else if(strcmp(s,"GAP")==0) type=GAP;
00207 else if(strcmp(s,"GASB")==0) type=GASB;
00208 else if(strcmp(s,"INAS")==0) type=INAS;
00209 else if(strcmp(s,"INP")==0) type=INP;
00210 else if(strcmp(s,"SIO2")==0) type=SIO2;
00211 else if(strcmp(s,"ALxINxSB")==0){
00212 type=ALXINXSB;
00213 fscanf(fp,"%lf",&dum);
00214 if(XVAL[type]<=0.){printf("read_input_file error : x negative for AlxInxSb!\n");
00215 exit(0);
00216 }
00217 if(XVAL[type]>1.){printf("read_input_file error : x greater than 1.0 for AlxInxSb!\n");
00218 exit(0);
00219 }
00220 XVAL[type]=dum;
00221 printf("AlxInxSb X = %g\n",XVAL[type]);
00222 }
00223 else if(strcmp(s,"ALxIN1-xSB")==0){
00224 type=ALXIN1XSB;
00225 fscanf(fp,"%lf",&dum);
00226 if(XVAL[type]<=0.){printf("read_input_file error : x negative for AlxIn(1-x)Sb!\n");
00227 exit(0);
00228 }
00229 if(XVAL[type]>1.){printf("read_input_file error : x greater than 1.0 for AlxIn(1-x)Sb!\n");
00230 exit(0);
00231 }
00232 XVAL[type]=dum;
00233 printf("AlxIn(1-x)Sb X = %g\n",XVAL[type]);
00234 }
00235 else{
00236 printf("read_input_file error : unknown specified material!\n");
00237 printf("material %s is unknown!\n",s);
00238 exit(0);
00239 }
00240 printf("MATERIAL %s X=[%g,%g] Y=[%g,%g] Z=[%g,%g] ---> Ok\n",s,xi,xf,yi,
00241 yf,zi,zf);
00242 for(index=0;index<Ne;index++){
00243 double xc,yc,zc;
00244 xc=0.25*(coord[0][noeud_geo[0][index]-1]+coord[0][noeud_geo[1][index]-1]
00245 +coord[0][noeud_geo[2][index]-1]+coord[0][noeud_geo[3][index]-1]);
00246 yc=0.25*(coord[1][noeud_geo[0][index]-1]+coord[1][noeud_geo[1][index]-1]
00247 +coord[1][noeud_geo[2][index]-1]+coord[1][noeud_geo[3][index]-1]);
00248 zc=0.25*(coord[2][noeud_geo[0][index]-1]+coord[2][noeud_geo[1][index]-1]
00249 +coord[2][noeud_geo[2][index]-1]+coord[2][noeud_geo[3][index]-1]);
00250 if((xi<=xc) && (xc<=xf) && (yi<=yc) &&(yc<=yf) && (zi<=zc) &&(zc<=zf))
00251 i_dom[index]=type;
00252 }
00253 } else if(strcmp(s,"DONORDENSITY")==0){
00254 double xi,xf;
00255 double yi,yf;
00256 double zi,zf;
00257 double conc;
00258 fscanf(fp,"%s",s);
00259 if(strcmp(s,"X")==0) fscanf(fp,"%lf %lf",&xi,&xf);
00260 else{
00261 printf("read_input_file error : X donordensity not specified!\n");
00262 exit(0);
00263 }
00264 fscanf(fp,"%s",s);
00265 if(strcmp(s,"Y")==0) fscanf(fp,"%lf %lf",&yi,&yf);
00266 else{
00267 printf("read_input_file error : Y donordensity not specified!\n");
00268 exit(0);
00269 }
00270 fscanf(fp,"%s",s);
00271 if(strcmp(s,"Z")==0) fscanf(fp,"%lf %lf",&zi,&zf);
00272 else{
00273 printf("read_input_file error : Z donordensity not specified!\n");
00274 exit(0);
00275 }
00276 fscanf(fp,"%lf",&conc);
00277 if(DDMAX<conc) DDMAX=conc;
00278
00279 for(index=0;index<Ne;index++){
00280 double xc,yc,zc;
00281 xc=0.25*(coord[0][noeud_geo[0][index]-1]+coord[0][noeud_geo[1][index]-1]
00282 +coord[0][noeud_geo[2][index]-1]+coord[0][noeud_geo[3][index]-1]);
00283 yc=0.25*(coord[1][noeud_geo[0][index]-1]+coord[1][noeud_geo[1][index]-1]
00284 +coord[1][noeud_geo[2][index]-1]+coord[1][noeud_geo[3][index]-1]);
00285 zc=0.25*(coord[2][noeud_geo[0][index]-1]+coord[2][noeud_geo[1][index]-1]
00286 +coord[2][noeud_geo[2][index]-1]+coord[2][noeud_geo[3][index]-1]);
00287 if((xi<=xc) && (xc<=xf) && (yi<=yc) &&(yc<=yf) && (zi<=zc) &&(zc<=zf)){
00288 ND[index]=conc;
00289 NE[noeud_geo[0][index]-1]=conc;
00290 NE[noeud_geo[1][index]-1]=conc;
00291 NE[noeud_geo[2][index]-1]=conc;
00292 NE[noeud_geo[3][index]-1]=conc;
00293 }
00294 }
00295 printf("DONORDENSITY X=[%g,%g] Y=[%g,%g] Z=[%g,%g] %g ---> Ok\n",
00296 xi,xf,yi,yf,zi,zf,conc);
00297 } else if(strcmp(s,"ACCEPTORDENSITY")==0){
00298 double xi,xf;
00299 double yi,yf;
00300 double zi,zf;
00301 double conc;
00302 fscanf(fp,"%s",s);
00303 if(strcmp(s,"X")==0) fscanf(fp,"%lf %lf",&xi,&xf);
00304 else{
00305 printf("read_input_file error : X acceptordensity not specified!\n");
00306 exit(0);
00307 }
00308 fscanf(fp,"%s",s);
00309 if(strcmp(s,"Y")==0) fscanf(fp,"%lf %lf",&yi,&yf);
00310 else{
00311 printf("read_input_file error : Y acceptordensity not specified!\n");
00312 exit(0);
00313 }
00314 fscanf(fp,"%s",s);
00315 if(strcmp(s,"Z")==0) fscanf(fp,"%lf %lf",&zi,&zf);
00316 else{
00317 printf("read_input_file error : Z acceptordensity not specified!\n");
00318 exit(0);
00319 }
00320 fscanf(fp,"%lf",&conc);
00321 for(index=0;index<Ne;index++){
00322 double xc,yc,zc;
00323 xc=0.25*(coord[0][noeud_geo[0][index]-1]+coord[0][noeud_geo[1][index]-1]
00324 +coord[0][noeud_geo[2][index]-1]+coord[0][noeud_geo[3][index]-1]);
00325 yc=0.25*(coord[1][noeud_geo[0][index]-1]+coord[1][noeud_geo[1][index]-1]
00326 +coord[1][noeud_geo[2][index]-1]+coord[1][noeud_geo[3][index]-1]);
00327 zc=0.25*(coord[2][noeud_geo[0][index]-1]+coord[2][noeud_geo[1][index]-1]
00328 +coord[2][noeud_geo[2][index]-1]+coord[2][noeud_geo[3][index]-1]);
00329 if((xi<=xc) && (xc<=xf) && (yi<=yc) &&(yc<=yf) && (zi<=zc) &&(zc<=zf)){
00330 NA[index]=conc;
00331
00332
00333
00334
00335 }
00336 }
00337 printf("ACCEPTORDENSITY X=[%g,%g] Y=[%g,%g] Z=[%g,%g] %g ---> Ok\n",
00338 xi,xf,yi,yf,zi,zf,conc);
00339 } else if(strcmp(s,"NOQUANTUMEFFECTS")==0){
00340 Quantum_Flag=0;
00341 printf("QUANTUM EFFECTS = NO --->Ok\n");
00342 } else if(strcmp(s,"QUANTUMEFFECTS")==0){
00343 Quantum_Flag=1;
00344 printf("QUANTUM EFFECTS = YES --->Ok\n");
00345 } else if(strcmp(s,"LOADMESH")==0){
00346 fscanf(fp,"%s",s);
00347 {int h; for(h=0;h<100;h++) MESHNAME[h]=s[h];}
00348 printf("\n\nLoading the input mesh file...\n");
00349 load_mesh(s);
00350 printf("Mesh input file correctly processed...\n\n");
00351 } else if(strcmp(s,"LOADMSH")==0){
00352 printf("\n\nLoading the input msh file...\n");
00353 fscanf(fp,"%s",s);
00354 {int h; for(h=0;h<100;h++) MESHNAME[h]=s[h];}
00355 load_mshV1(s);
00356 printf("msh input file correctly processed...\n\n");
00357 } else if(strcmp(s,"NEIGHBOURHOODTABLE")==0){
00358 fscanf(fp,"%s",s);
00359 if(strcmp(s,"READ")==0){
00360 NHTFLAG=READ;
00361 printf("NEIGHBOURHOOD = READ ---> Ok\n");
00362 }
00363 if(strcmp(s,"WRITE")==0){
00364 NHTFLAG=WRITE;
00365 printf("NEIGHBOURHOOD = WRITE ---> Ok\n");
00366 }
00367 } else if(strcmp(s,"POISSONUPDATE")==0){
00368 fscanf(fp,"%s",s);
00369 if(strcmp(s,"YES")==0){
00370 POISSONUPDATEFLAG=YES;
00371 printf("POISSON UPDATE = YES ---> Ok\n");
00372 }
00373 if(strcmp(s,"NO")==0){
00374 POISSONUPDATEFLAG=NO;
00375 printf("POISSON UPDATE = NO ---> Ok\n");
00376 }
00377 } else if(strcmp(s,"SAVEPARTICLES")==0){
00378 fscanf(fp,"%s",s);
00379 if(strcmp(s,"NO")==0){
00380 SAVEPARTICLESFLAG=NO;
00381 printf("DO NOT SAVE PARTICLES ---> Ok\n");
00382 }
00383 if(strcmp(s,"YES")==0){
00384 SAVEPARTICLESFLAG=YES;
00385 fscanf(fp,"%s",s);
00386 if(strcmp(s,"POINT3D")==0) SAVEPARTICLESFORMAT=POINT3D;
00387 if(strcmp(s,"MESH")==0) SAVEPARTICLESFORMAT=MESH;
00388 if(strcmp(s,"ALL")==0) SAVEPARTICLESFORMAT=ALL;
00389 printf("PARTICLES OUTPUT SELECTED = %s ---> Ok\n",s);
00390 }
00391 } else if(strcmp(s,"SAVEFIELDS")==0){
00392 fscanf(fp,"%s",s);
00393 if(strcmp(s,"NO")==0){
00394 SAVEFIELDSFLAG=NO;
00395 printf("DO NOT SAVE FIELDS ---> Ok\n");
00396 }
00397 if(strcmp(s,"YES")==0){
00398 SAVEFIELDSFLAG=YES;
00399 fscanf(fp,"%s",s);
00400 if(strcmp(s,"VTK")==0) SAVEFIELDSFORMAT=VTK;
00401 if(strcmp(s,"MESH")==0) SAVEFIELDSFORMAT=MESH;
00402 if(strcmp(s,"ALL")==0) SAVEFIELDSFORMAT=ALL;
00403 printf("FIELDS OUTPUT SELECTED = %s ---> Ok\n",s);
00404 }
00405 } else if(strcmp(s,"DONORDENSITYONELEMENTS")==0){
00406 int idum;
00407 fscanf(fp,"%d",&idum);
00408 fscanf(fp,"%lf",&dum);
00409 for(index=0;index<Ne;index++) if(i_dom[index]==idum) ND[index]=dum;
00410 printf("DONORDENSITYONELEMENTS %g %d ---> Ok\n",dum,idum);
00411 } else if(strcmp(s,"IMPACTIONIZATION")==0){
00412 fscanf(fp,"%s",s);
00413 if(strcmp(s,"YES")==0) IIFLAG=YES;
00414 if(strcmp(s,"NO")==0) IIFLAG=NO;
00415 printf("IMPACT IONIZATION = %s ---> Ok\n",s);
00416 }
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441 }
00442 printf("End of input file.\n");
00443 printf("******************\n\n");
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483 }