http://www.aiplab.com/Pinned_Photodiode_Surface_Barrier_Potential.html













/***********************************************

 
Graph Plot Program 2020.09.17

*****************************************************

This program gives three graph-plot outputs

A1.html, A2 html and A3.html as shown above.


*****************************************************

/***********************************************

/***********************************************

  Graph Plot Program 2020.09.17

************************************************

This program gives three graph plots

A1.htmal, A2 html and A3.html shown above.

************************************************

/***********************************************

This Graph Plot C-coding Program computes

the Barrier Potential YY(x) and the hole density H(x)

of the Surface P+P Gaussian Doping Profile D(x)

firstly by analytic approximation and then

the Exact Numerical Solutions of the Barrier Potential ZZ(x)

and the hole density HH(x) by solving Poisson's equation

Esi * d'2 V(x)/dx'2 = D(x) - HH(x) ;

with Hole Density of HH(x) = Npp exp ( - ZZ(x)/kT )

and Gaussian Impurity Doping Profile D(x) give as

D(x) = Np + ( Npp - Np ) exp ( -x*x/R/R ) ;

************************************************

Note that " x'2 " means " x*x " here.

************************************************


************************************************

Important Initial Values

************************************************

A=Npp/Np;

VB = kT*log(A) ;

Vo = kT*( 1 - log(A)/(A-1) ) ;

Wo = sqrt( 2*Vo/Npp) ;

WB = Wo*VB/Vo ;

*************************************************************
Doping Function D(x) and the initial potentail YY( x) are set as followed.
*************************************************************

for ( i=0;i<10001;i++) {

x = ( i - 1000) *dx;

if ( x <= 0 ) D[i] = Npp;

if ( x > 0 ) D[i] = Np + ( Npp - Np ) * exp( -x*x/R/R) ;

if ( i > 9000 ) D[i] = Np;


if( x < 0 ) YY[i] = 0;

if ( x > 0 ) YY[i] = Vo*x*x/Wo/Wo;

if( j ==0 ) { if ( x > Wo ) { j =1 ; k = i-1 ; } }

if( x > Wo ) YY[i] = VB - ( VB - Vo )*( WB - x ) * ( WB - x ) / ( WB - Wo )/( WB - Wo ) ;

if ( x > WB) YY[i] = VB;

H[i]= Npp*exp( - YY[i]/kT) ; }


***********************************************************

Name of Main Control Program is void main( void ) ;

**********************************************************

 This program plots ( NPLOT ) graphs ;

  NPLOT の値は NPLOT = 1 から 最大 NPLOT = 9 迄です。  
 
for NPLOT = 0 A.html に出力します
  for NPLOT = 1 A1.html に出力します、
    for NPLOT = 2 A2.html に出力します、
......................................................................

for NPLOT = 9 A9.html に出力します。

**********************************************************

 関数 PXPY( ) の中で Graphの各点の座標値を決定します。     

     for KPLOT =1 to NP and for i = 0 to N=10000 ;

  各点の座標値は XP[KPLOT][i]、YP[KPLOT][i]  に入ります。

0 < KPLOT < 10 とします。

***********************************************************/

#include <stdio.h>
#include <math.h>

FILE *fpAA;

FILE *fpBB;

FILE *fpCC;

FILE *fpDD;

FILE *fpC;


int TEST,NOTE,READ,KKK,NKK ;

int Ni,Nj,KPLOT,NPLOT,ADD;

double dxmin,dxmax,dymin,dymax,dyoffset,xaxis,yaxis;

char c ;

int N =10000;

double XP[10][10001],YP[10][10001];

double YY[10001],ZZ[10001],TT[10001],D[10001],H[10001],HH[10001];

double xmin,xmax,ymin,ymax;

double xx,yy;

int ixmin,ixmax,iymin,iymax;

int nxx ;

int nx1=100,nx2=600,nyy,ny1=50,ny2=1050 ;

int i,j,k,m;


double X,Y,A,B,S,X1,X2;

double kT,Esi,Np,Npp,Debye,LD;

double R,Wo,Vo,WB,VB,No,WBWo,WoWB;

int kk;

double Err,ErrMax, ErrMin,EEr,EErMax,EErMin,E1,E2;

double FF,FFMax,FFMin,F,Z,Z1,Z2,ZA,DZZ,DD,T1,T2,Hole ;

double dx, x ;

/***************************************************

     出力 File の 定義

  fpAA に 計算結果 data が AA.txt に出力されます。


****************************************************/




/**************************************************************/



/************************************************

In the "main" program, set TEST = 1 for testing.

Set TEST = 0 for normal operations

*************************************************/





/**************************************

Graph を NPLOT 個 描きます。

NPLOT の値は main で決めます。

KPLOT の値は 1 から NPLOT 迄です。

**************************************/



/**************************************

各Graphの点の数は N個です。

     N =10000 で 固定です。

***************************************/






/**************************************************

   Graphの描画範囲(わく)の値を決定します 

   すなわち Graphの描画範囲を決定します。

xmin,xmax,ymin,ymax の値は  PXPY( ) で決めます。

***************************************************/



/****************************************************/



/*********************************************************************

Hasami( ) obtains the value of ZZ(x)

by solving exactly the Poison's Equation

Esi*d'2 ZZ(x)/dx'2 = D(x) - HH(x)

where D(x) = Np + (Npp - Np)*exp( - x'2/R'2 )

and HH(x) = Npp*exp(-ZZ(x)/kT) ;

*********************************************************************

Input j, TT[j+1],TT[j],TT[j-1] ;

Output ZZ[j] = Z ;

**********************************************************************/



void HASAMI (void) { int i,j,k,kk;


if( T1 == T2 ) { Z = T1; goto FINISH ; }

Z1 = 0 ; Z2 =VB;

kk = 1;


NEXTK:




i = 0; Z = Z1;

if ( x <= 0 )

E1 = Esi*(T1+T2-2*Z)/dx/dx - Npp + Npp*exp( - Z/kT) ;

if ( x > 0 )

E1 = Esi*(T1+T2-2*Z)/dx/dx - Np -(Npp-Np) *exp( - x*x/R/R) + Npp*exp( - Z/kT) ;

if ( TEST == 1 ) printf ( "\n\n kk =%d Z1 = %f Err(Z1) = %f ", kk, Z1, E1);

if (E1 > 0 ) i = 1;



j = 0; Z = Z2;

if ( x <= 0 )

E2 = Esi*(T1+T2-2*Z)/dx/dx - Npp + Npp*exp( - Z/kT) ;

if ( x > 0 )

E2 = Esi*(T1+T2-2*Z)/dx/dx - Np -(Npp-Np) *exp( - x*x/R/R) + Npp*exp( - Z/kT) ;

if ( TEST == 1 ) printf ( "\n kk =%d Z2 = %f Err(Z2) = %f ", kk, Z2, E2);

if (E2 > 0 ) j = 1;


k = 0 ; Z = ( Z2*E1 - Z1*E2 )/( E1 - E2 ) ;

if ( x <= 0 )

Err = Esi*(T1+T2-2*Z)/dx/dx - Npp + Npp*exp( - Z/kT) ;

if ( x > 0 )

Err = Esi*(T1+T2-2*Z)/dx/dx - Np -(Npp-Np) *exp( - x*x/R/R) + Npp*exp( - Z/kT) ;

if ( TEST == 1 ) printf ( "\n kk =%d Z = %f Err(Z) = %f ", kk, Z, Err);

if (Err > 0 ) k = 1;

if (Err < 0 ) Err = - Err;

if ( Err < 0.00000001 ) goto FINISH;



/***********************************************************/

if ( i == j ) { printf("\n\n Error >>>>") ;


printf ( " x = %f T1=%f T2 =%f Z1 = %f Z2 = %f Err = %f ",

x, T1,T2,Z1,Z2,Err);

printf( "\n\n Push Enter Key to End \n\n>" );

c=getchar( ); if(c =='c') printf("\n\n Good Bye ! \n\n");

printf( "\n\n>" );

c=getchar( ); if(c =='c') printf("\n\n Good Bye ! \n\n");

goto FINISH ; }


/***********************************************************/


if ( k == 1 ) { if ( i == 0 ) { Z2 = Z ; goto NEXTZ; }

if ( j == 0 ){ Z1 =Z ; goto NEXTZ; } }



if ( i == 1 ) { Z2 = Z ; goto NEXTZ; }

if ( j == 1 ) Z1 = Z ;


NEXTZ:

/***********************************************************/



kk = kk +1;

if( kk < 10 ) goto NEXTK;

FINISH:

if ( Z < 0 ) Z = 0;

if( Z > VB ) Z = VB;



if ( TEST == 1 ) printf ( "\n\n FINISH: kk = %d x = %f Z = %f Err =%f ", kk,x, Z, Err ); }



/***********************************************************/



/********************************************************************


Newton ( void ) Newton Iteration Method

Initial Values are YY[ ] and Final Values are ZZ[ ] ;

for each point H = Npp exp ( - ZZ[i]/kT ) ;

if ( D[i] > H ) ZZ[i] = VB;


********************************************************************/


void Newton ( void ) { int i,j,k,kk;


ZZ[0] = 0 ;

ZZ[10000]=VB;

ZZ[9999]=VB;

for (i =0;i<10001;i++) TT[i] = ZZ[i] ;


EErMax = 0 ;


kk=0;

NEXTKK:

kk=kk+1;




for ( i = 1; i < 5000 ; i ++ ) {

j = 2*i - 1 ;

x = (j -1000)*dx;


T1 = TT[j-1]; T2=TT[j+1];

HASAMI( );

ZZ[j] = Z ;




j = 2*i ;

x = (j -1000)*dx;

T1 = TT[j-1]; T2=TT[j+1];

HASAMI( );


ZZ[j] = Z ; }







EErMax = 0 ; EErMin = 0 ; FFMax =0; FFMin = 0;



for ( i=1;i<9999;i++) {

Hole = Npp*exp( - ZZ[i]/kT) ;

FF = D[i] - Hole ;

DZZ =Esi* ( ZZ[i+1] - 2*ZZ[i] + ZZ[i-1] )/dx/dx ;

EEr = ( FF - DZZ ) ;

if( FFMax < FF) FFMax = FF ;

if( FFMin > FF) FFMin = FF ;


if( EEr > EErMax) EErMax = EEr;

if( EEr < EErMin) EErMin = EEr; }




printf("\n ( %d / %d ) EErMax = %f EErMin =%f FFMax = %f FFMin = %f ",

kk + KKK, NKK + KKK, EErMax/Npp,EErMin/Npp, FFMax/Np,FFMin/Np ) ;



for ( i = 1; i<10000; i++) TT[i] = ZZ[i] ;



if ( kk < NKK ) goto NEXTKK; }











/*******************************************

     関数 PXPY( ) を定義して

   Graphの各点の座標値を決定します。     

    for KPLOT =1 to NPLOT and for i = 0 to N,    

 各点の座標 XP[KPLOT][i]、YP[KPLOT][i] を決定します。  

Graph を描いて html file に出力します。

KPLOT= 1 の時は A1.html に
       KPLOT= 2 の時は A2.html に出力します。  
      ..............................................

KPLOT= 9 の時は A9.html に出力します。

***************************************************/











void PXPY ( void ) {


fpAA=fopen("AA.txt","w");




fprintf(fpAA,"\n\n************************************************************** \n\n" );

fprintf(fpAA,"\n\n Step(001) The initial physical parameters are defined in PXPY( ) \n\n" );

fprintf(fpAA,"\n\n************************************************************** \n\n" );


printf("\n\n Step(001) The initial physical parameters are defined in PXPY( ) \n\n" );

kT = 0.0259;

Esi =648;


Np = 100; Debye = sqrt ( Esi*kT/Np) ;

fprintf(fpAA,"\n Debye = %f um for Np = ( 10 の14 乗 per cm の3乗 ) \n", Debye);

Np = 1000; Debye = sqrt ( Esi*kT/Np) ;

fprintf(fpAA,"\n Debye = %f um for Np = ( 10 の15 乗 per cm の3乗 ) \n", Debye);

Np = 10000; Debye = sqrt ( Esi*kT/Np) ;

fprintf(fpAA,"\n Debye = %f um for Np = ( 10 の16 乗 per cm の3乗 ) \n", Debye);

Np = 100000; Debye = sqrt ( Esi*kT/Np) ;

fprintf(fpAA,"\n Debye = %f um for Np = ( 10 の17 乗 per cm の3乗 ) \n", Debye);

Np = 1000000; Debye = sqrt ( Esi*kT/Np) ;

fprintf(fpAA,"\n Debye = %f um for Np = ( 10 の18 乗 per cm の3乗 ) \n", Debye);

Np = 10000000; Debye = sqrt ( Esi*kT/Np) ;

fprintf(fpAA,"\n Debye = %f um for Np = ( 10 の19 乗 per cm の3乗 ) \n", Debye);



Np = 10000;

fprintf(fpAA,"\n Np = %f \n",Np);

LD = sqrt ( Esi*kT/Np);

fprintf(fpAA,"\n LD = sqrt ( Esi*kT/Np) = %f \n",LD);

Npp = 100000;

fprintf(fpAA,"\n Npp = %f \n",Npp);

A=Npp/Np;

fprintf(fpAA,"\n A=Npp/Np = %f \n",A);

R = 0.1;

fprintf(fpAA,"\n R = %f \n",R);

Wo = R / sqrt ( 2.0 ) ;

fprintf(fpAA,"\n Wo = R / sqrt ( 2.0 ) = %f \n",Wo);

No = Np + ( Npp - Np)*exp( - 0.5 );

fprintf(fpAA,"\n No = Np + ( Npp - Np)*exp( - 0.5 ) = %f \n",No);


Vo = kT* log ( (Np + Npp)/ No ) ;

fprintf(fpAA,"\n Vo = kT* log ( (Np + Npp)/ No ) = %f \n",Vo);


VB = kT*log(Npp/Np) ;

fprintf(fpAA,"\n VB = kT*log( Npp/Np) = %f \n",VB);

fprintf(fpAA,"\n Vo = Vo/VB = %f \n",Vo/VB );


WB = Wo*VB/Vo ;

fprintf(fpAA,"\n WB = Wo*VB/Vo= %f \n",WB);

WBWo = WB/Wo ;

fprintf(fpAA,"\n WB/Wo = VB/Vo= %f \n",WBWo );

WoWB = Wo/WB ;

fprintf(fpAA,"\n Wo/WB = Vo/VB = %f \n",WoWB );


dx = WB/5000;

fprintf(fpAA,"\n\n dx = WB/5000 = %f for WB =%f \n\n", dx, WB );





fprintf(fpAA,"\n\n X[0] = - 0.2*WB = %f ", - 0.2*WB);

fprintf(fpAA,"\n\n X[1000] = 0.0 " );

fprintf(fpAA,"\n\n X[6000] = WB = %f ",WB);

fprintf(fpAA,"\n\n X[10000] = 1.8*WB = %f ",1.8*WB);


if( TEST == 1 ) goto FINISH;

fprintf(fpAA,"\n\n************************************************************* \n\n" );

fprintf(fpAA,"\n\n Step(002) Initial Approximated Values of YY(x) is computed \n\n" );

fprintf(fpAA,"\n\n for the P+P Gaussian Doping Profile D(x). \n\n" );

fprintf(fpAA,"\n\n D(x) = Np + ( Npp - Np )*exp( - x'2/R'2 ) \n\n" );

fprintf(fpAA,"\n\n Initial Hole Concentration H(x) is then given as \n\n" );

fprintf(fpAA,"\n\n H(x) = Npp * exp ( - YY(x)/kT ) \n\n" );


fprintf(fpAA,"\n\n************************************************************** \n\n" );

fprintf(fpAA," YY[i] = 0 for x < 0 \n\n" );

fprintf(fpAA," with x[i] = ( i - 1000)*dx from i = 0 to i = 1000 \n\n" );

fprintf(fpAA," YY[i] = V(x) = Vo*(x/Wo)'2 \n\n" );

fprintf(fpAA," if 0 < x < Wo \n\n" );

fprintf(fpAA," with x[i] = ( i - 1000)*dx from i= 1000 to i = 6000 ; \n\n" );

fprintf(fpAA, " YY[i] = V(x) = VB - ( VB - Vo )*(( WB - x ) / ( WB - Wo ))'2 \n\n" );

fprintf(fpAA," if Wo < x < WB \n\n" );

fprintf(fpAA," with x[i] = ( i - 1000)*dx from i = 1000 to i = 6000 \n\n" );

fprintf(fpAA," YY[i] = VB for x > WB \n\n" );

fprintf(fpAA," with x[i] = ( i - 1000)*dx from i = 6000 to i =10000 \n\n" );

fprintf(fpAA,"\n\n************************************************************** \n\n" );


j = 0;


for ( i=0;i<10001;i++) {

x = ( i - 1000) *dx;

if ( x <= 0 ) D[i] = Npp;

if ( x > 0 ) D[i] = Np + ( Npp - Np ) * exp( -x*x/R/R) ;

if ( i > 9000 ) D[i] = Np;


if( x < 0 ) YY[i] = 0;

if ( x > 0 ) YY[i] = Vo*x*x/Wo/Wo;

if( j ==0 ) { if ( x > Wo ) { j =1 ; k = i-1 ; } }

if( x > Wo ) YY[i] = VB - ( VB - Vo )*( WB - x ) * ( WB - x ) / ( WB - Wo )/( WB - Wo ) ;



if ( x > WB) YY[i] = VB;

H[i]= Npp*exp( - YY[i]/kT) ; }


fprintf(fpAA,"\n\n X[%d] = %f < Wo = %f < X[%d] = %f \n\n",

k , ( k -1000 )*dx, Wo, k+1, ( k - 999 )*dx);


fprintf(fpAA,"\n\n X[%d]/WB = %f < Wo/WB = %f < X[%d] /WB = %f \n\n",

k , ( k -1000 )*dx/WB, Wo/WB, k+1, ( k - 999 )*dx/WB);


/**************************************************/


/****************************************************************************/



fprintf(fpAA,"\n\n ***************************************************************** \n\n " );

fprintf(fpAA,"\n\n Initial Approximated Values of YY(x) , D(x), H(x) = Npp*exp( - YY(x)/kT) ; \n\n " );

fprintf(fpAA,"\n\n D(x) = Np + ( Npp -Np ) *exp( - x'2/R'2 ) for 0 < x ; \n\n " );

fprintf(fpAA,"\n\n ***************************************************************** \n\n " );



for ( i = 0 ; i < 10001 ; i++ ) {

x = ( i - 1000 )*dx;

fprintf(fpAA,"\n x[%d] = %f YY(x) = %f D(x) = %f H(x) = %f ( D(x) - H(x) ) = %f ",

i,x,YY[i],D[i]/Npp,H[i]/Npp, ( D[i] - H[i] )/Npp ) ; }

fprintf(fpAA,"\n\n ************************************************************ \n\n " );


/**************************************************/





fprintf(fpAA,"\n\n************************************************************** \n\n" );

fprintf(fpAA,"\n\n Step(003) Check EEr = | FF[ ] - DZZ[ ] | / Npp for YY[ ] \n\n" );

fprintf(fpAA,"\n\n************************************************************** \n\n" );


printf("\n\n Step(003) Check EEr = | FF[ ] - DZZ[ ] | /Npp for YY[ ] \n\n" );

fprintf(fpAA, "\n\n DZZ[i] = Esi*( YY[i+1] - 2*YY[i] + YY[i-1] )/dx/dx \n\n" );

fprintf(fpAA, "\n\n FF[i] = D[i] - H[i] \n\n" );

fprintf(fpAA, "\n\n with H[i] = Npp*exp( - YY[i]/kT ) ) \n\n" );

fprintf(fpAA,"\n\n************************************************************** \n\n" );



EErMax = 0 ; EErMin = 0 ; FFMax =0; FFMin = 0;

for ( i=1;i<9999 ;i++) {

x = ( i - 1000 )*dx ;

FF = ( D[i] - H[i] )/Npp ;

DZZ =Esi* ( YY[i+1] - 2*YY[i] + YY[i-1] )/dx/dx/Npp ;

EEr = FF - DZZ ;

if( FFMax > FF) FFMax = FF ;

if( FFMin < FF) FFMin = FF ;

if( EEr > EErMax) EErMax =EEr;

if( EEr < EErMin) EErMin =EEr;




fprintf(fpAA,"\n x[%d] = %f EEr = ( FF - DZZ ) = %f FF = %f DZZ = %f YY= %f D = %f H = %f ",

i,x, EEr , FF , DZZ ,YY[i]/VB , D[i]/Npp , H[i]/Npp ) ; }



fprintf(fpAA,"\n\n For YY[ ] we have EErMax = Max ( FF - DZZ ) = %f ", EErMax );

fprintf(fpAA,"\n\n For YY[ ] we have EErMin = Min ( FF - DZZ ) = %f", EErMin );


for ( i=0;i<10001; i++) ZZ[i] = YY[i] ;


if( READ == 1 ) {

fpCC=fopen("DD.txt","r");

fscanf(fpCC,"%d",&KKK);

for ( i=0;i<10001; i++) { fscanf(fpCC,"%lf",&ZZ[i] ); ZZ[i] = ZZ[i]/1000000; }

fclose(fpCC) ; }


fprintf(fpAA,"\n\n************************************************************** \n\n" );

fprintf(fpAA,"\n\n Step(004) Newton Method is used to obtain ZZ[ ] \n\n" );


fprintf(fpAA,"\n\n************************************************************** \n\n" );


printf("\n\n Step(004) Newton Method is used to obtain ZZ[ ] \n\n" );



Newton( );




fpDD=fopen("DD.txt","w");

fprintf(fpDD,"%d \n", NKK+KKK );

for ( i=0;i<10001; i++) fprintf(fpDD,"%f \n", ZZ[i]*1000000 );

fclose(fpDD) ;


/***************************************************************************/








fprintf(fpAA,"\n\n************************************************************** \n\n" );

fprintf(fpAA,"\n\n Step(005) Calculated values of YY[ ] and ZZ[ ] are shown here \n\n" );

fprintf(fpAA,"\n\n ( ZZ -YY ) = ( ZZ[i] -YY[i] )*1000/VB \n\n" );

fprintf(fpAA,"\n\n ( HH - H ) = ( HH[i] - H[i] )*1000/Npp \n\n" );

fprintf(fpAA,"\n\n************************************************************** \n\n" );


printf("\n\n Step(005) Calculated values of YY[ ] and ZZ[ ] are shown here \n\n" );

/**********************************************/

for ( i = 0; i<10001; i++) {

x = ( i -1000)*dx;

HH[i] = Npp*exp ( - ZZ[i]/kT ) ;

fprintf(fpAA, "\n X[%d] = %f ZZ = %f YY = %f ( ZZ - YY ) = %f HH = %f H =%f ( HH - H ) =%f ",


i,x/WB,ZZ[i]/VB,YY[i]/VB,( ZZ[i] -YY[i] )*1000/VB,H[i]/Npp, HH[i]/Npp, ( HH[i] - H[i] )*1000/Npp ) ; }


/**********************************************/



fprintf(fpAA,"\n\n************************************************************** \n\n" );

fprintf(fpAA,"\n\n Step(006) Check EEr = | FF[ ] - DZZ[ ] | /Npp for ZZ[ ] \n\n" );

fprintf(fpAA,"\n\n************************************************************** \n\n" );


printf("\n\n Step(006) Check EEr = | FF[ ] - DZZ[ ] | /Npp for ZZ[ ] \n\n" );



EErMax = 0 ; EErMin = 0 ; FFMax =0; FFMin = 0;

for ( i=1;i<10000;i++) {

x = ( i - 1000 )*dx ;

FF = ( D[i] - HH[i] )/Npp ;

DZZ =Esi* ( ZZ[i+1] - 2*ZZ[i] + ZZ[i-1] )/dx/dx/Npp ;

EEr = FF - DZZ ;

if( FFMax > FF) FFMax = FF ;

if( FFMin < FF) FFMin = FF ;

if( EEr > EErMax) EErMax =EEr;

if( EEr < EErMin) EErMin =EEr;


fprintf(fpAA,"\n x[%d] = %f EEr = ( FF - DZZ ) = %f FF = %f DZZ = %f ZZ = %f D = %f HH = %f ",

i,x, EEr , FF , DZZ , ZZ[i]/VB , D[i]/Npp , HH [i]/Npp ) ; }


fprintf(fpAA,"\n\n For ZZ[ ] we have EErMax = Max ( FF - DZZ ) = %f ", EErMax );

fprintf(fpAA,"\n\n For ZZ[ ] we have EErMin = Min ( FF - DZZ ) = %f", EErMin );



/**************************************/




/***********************************************************************************/



fprintf(fpAA,"\n\n************************************************************** \n\n" );

fprintf(fpAA,"\n\n Step(007) Total of NPLOT = 5 Graph Plot Data are generaed here \n\n" );

fprintf(fpAA,"\n\n************************************************************** \n\n" );



printf("\n\n Step(007) Total of NPLOT = 5 Graph Plot Data are generaed here \n\n" );


for (i=0;i<10001;i++) {


x = ( i - 1000)*dx ;

XP[1][i] = x/WB;XP[2][i] = x/WB;XP[3][i] = x/WB;
XP[4][i] = x/WB;XP[5][i] = x/WB;





/********* KPLOT = 1 ; ADD = 0 ; ***************************

if( KPLOT == 1 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," The surface P+P Gaussian impurity atom doping profile D(x) \n\n<BR>" ) ; }

**********************************************************/

YP[1][i] = D[i]/Npp;

/********* KPLOT = 2 ; ADD = 0 ; ****************************

if( KPLOT == 2 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = VB , Ymax = 0 ) \n<BR> " ) ;

fprintf(fpC," Initial Value YY(x) of the surface P+P Barrier Potential \n\n<BR>" ) ; }

**********************************************************/

YP[2][i]= 1 - YY[i]/VB;


/********* KPLOT = 3 ; ADD = 1 ; ****************************

if( KPLOT == 3 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC,"Intial Hole Densiy H (x) and ImpurityAtom Doping Profile D(x) and are compared \n\n<BR>" ) ; }

**********************************************************/

YP[3][i] = H[i]/Npp;


/********* KPLOT = 4 ; ADD = 2 ; ****************************


if( KPLOT == 4 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = VB , Ymax = 0 ) \n<BR> " ) ;

fprintf(fpC," Exact Numerical Barrier Potential ZZ(x) and Initial Value YY(x) are compared \n\n<BR>" ) ; }

**********************************************************/

YP[4][i] = 1 - ZZ[i]/VB ;


/********* KPLOT = 5 ; ADD = 1 ; ****************************

if( KPLOT == 5 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," Final Hole Densiy H(x) and the P+P doping profile D(x) are compared \n\n<BR>" ) ; }

**********************************************************/

YP[5][i] = HH[i]/Npp; }

/**********************************************************/



FINISH: fclose(fpAA) ; }




/******************************************

End of Function void PXPY ( void )

*********************************************/









/*******************************************

Graph を描いて html file に出力します 

********************************************/



/******************************************


void Graph_Plot(void)

  グラフ描画出力用の定義です。

*********************************************/



void Graph_Plot(void) {





if ( NPLOT == 0 ) fpC=fopen( "A.html","w");
if ( NPLOT == 1 ) fpC=fopen("A1.html","w");
if ( NPLOT == 2 ) fpC=fopen("A2.html","w");
if ( NPLOT == 3 ) fpC=fopen("A3.html","w");
if ( NPLOT == 4 ) fpC=fopen("A4.html","w");
if ( NPLOT == 5 ) fpC=fopen("A5.html","w");
if ( NPLOT == 6 ) fpC=fopen("A6.html","w");
if ( NPLOT == 7 ) fpC=fopen("A7.html","w");
if ( NPLOT == 8 ) fpC=fopen("A8.html","w");
if ( NPLOT == 9 ) fpC=fopen("A9.html","w");


fprintf(fpC,"<!DOCTYPE HTML PUBLIC \"");

fprintf(fpC,"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");

fprintf(fpC,"<HTML>\n<HEAD>\n<META http-equiv=\"Content-Type\"");

fprintf(fpC," content=\"text/html; charset=Shift_JIS\">\n");

fprintf(fpC,"<META http-equiv=\"Content-Style-Type\" content=\"text/css\">\n");

fprintf(fpC,"<TITLE></TITLE>\n</HEAD>\n<BODY>\n<BR>\n");


fprintf(fpC,"<BR>\n<FONT size=\"+2\"><BR>\n<FONT size=\"+2\"></FONT><I><B><FONT color=\"#ff0000\">\n\n");


/********* NPLOT =1; KPLOT = 4 ; ADD = 2 ; ************/

if( NPLOT == 1 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin =VB , Ymax = 0 ) \n<BR> " ) ;

fprintf(fpC," Exact Numerical Barrier Potential ZZ(x) and Initial Value YY(x) are compared \n\n<BR>" ) ; }


/********* NPLOT =2; KPLOT = 3 ; ADD = 1 ; ************/

if( NPLOT == 2 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," Initial Hole Densiy HH(x) and the P+P doping profile D(x) are compared \n\n<BR>" ) ; }




/********* NPLOT =3; KPLOT = 5 ; ADD = 1 ; ************/

if( NPLOT == 3 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin =0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," Final Hole Densiy HH(x) and Initial Hole Denisty H(x) are compared \n\n<BR>" ) ; }


/********* NPLOT =4; KPLOT = 1 ; ADD = 0; ************/

if( NPLOT == 4 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," The surface P+P Gaussian impurity atom doping profile D(x) \n\n<BR>" ) ; }




/********* NPLOT = 5 ;KPLOT = 5 ; ADD = 1 ; ************/

if( NPLOT == 5 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," Intial Hole Densiy H (x) = Npp * exp ( - YY(x)/kT ) ; \n\n<BR>" ) ; }


/********* NPLOT = 6 ; KPLOT = 5 ; ADD = 3 ; ************/

if( NPLOT == 6 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," Final Hole Densiy HH(x) and Initial Hole Denisty H(x) are compared \n\n<BR>" ) ; }



fprintf(fpC,"</FONT><BR><FONT color=\"#ff0000\">\n");

fprintf(fpC,"</FONT> <BR>\n</B><BR>\n</I><BR>\n");



/*******************************************************

グラフの枠 を描きます 

*******************************************************/


for ( i =0 ; i<N; i++) {

if(i<2000) { xx = xmin ;

yy= ymin + ( 2000 - i )*( ymax - ymin)/2000; goto NEXTT;}


if(i<4000) { xx = xmax ;

yy = ymin + ( 4000 - i )*( ymax - ymin)/2000; goto NEXTT;}


if(i<6000) { yy = ymin ;

xx = xmin + ( 6000 - i )*( xmax - xmin)/2000;goto NEXTT; }


if(i<8000) { yy = ymax ;

xx = xmin + ( 8000 - i )*( xmax - xmin)/2000; goto NEXTT; }

if(i<9000) { yy = yaxis ;

xx = xmin + ( 9000 - i )*( xmax - xmin)/1000; goto NEXTT; }



/************ Now 9000<= i <=10000 **********************/

xx = xaxis ;

yy= ymin + (10000 - i )*( ymax - ymin)/1000;


NEXTT:

/********************************************************/





/**************************************************************

  グラフの枠 を描くための 描画したい点 (xx,yy)の値を

     Graph 上での絶対座標 (nxx,nyy) に変換します

**************************************************************/



nyy = ny1 + (xx-xmin)*(ny2-ny1)/(xmax-xmin) ;

nxx = nx2 + (yy-ymin)*(nx1-nx2)/(ymax-ymin) ;


/************************************************************** 

    Graph 上での絶対座標 (nxx,nyy) に 点(.)を描きます。

**************************************************************/


fprintf(fpC,"<DIV style=\"top :");

fprintf(fpC,"%d",nxx) ;

fprintf(fpC,"px;left :") ;

fprintf(fpC,"%d",nyy);

fprintf(fpC,"px; position : absolute; z-index : 1;\" id=\"Layer1\"><P>");

fprintf(fpC,".");

fprintf(fpC,"</P></DIV>\n" ); }


/**************************************************************/


/*******************************************************

グラフのまわりの目盛りの 点(*) を描きます 

*******************************************************/


for ( j = 0 ; j < Nj +1 ; j++) {

nxx = 100 + j*500/Nj + dyoffset ;

nyy = 50 - dymin;


/************************************************************** 

    Graph 上での絶対座標 (nxx,nyy) に 点(*)を描きます。

**************************************************************/


fprintf(fpC,"<DIV style=\"top :");

fprintf(fpC,"%d",nxx) ;

fprintf(fpC,"px;left :") ;

fprintf(fpC,"%d",nyy);

fprintf(fpC,"px; position : absolute; z-index : 1;\" id=\"Layer1\"><P>");

fprintf(fpC,"*");

fprintf(fpC,"</P></DIV>\n" );
/****************************************************************/


nyy = 1050+dymax ;


/************************************************************** 

    Graph 上での絶対座標 (nxx,nyy) に 点(*)を描きます。

**************************************************************/


fprintf(fpC,"<DIV style=\"top :");

fprintf(fpC,"%d",nxx) ;

fprintf(fpC,"px;left :") ;

fprintf(fpC,"%d",nyy);

fprintf(fpC,"px; position : absolute; z-index : 1;\" id=\"Layer1\"><P>");

fprintf(fpC,"*");

fprintf(fpC,"</P></DIV>\n" ); }

/****************************************************************/

for ( i = 0 ; i < Ni +1 ; i++) {

nyy = 50 + i*1000/Ni ;

nxx = 100 - dxmin;


/************************************************************** 

    Graph 上での絶対座標 (nxx,nyy) に 点(*)を描きます。

**************************************************************/


fprintf(fpC,"<DIV style=\"top :");

fprintf(fpC,"%d",nxx) ;

fprintf(fpC,"px;left :") ;

fprintf(fpC,"%d",nyy);

fprintf(fpC,"px; position : absolute; z-index : 1;\" id=\"Layer1\"><P>");

fprintf(fpC,"*");

fprintf(fpC,"</P></DIV>\n" );

/****************************************************************/


nxx = 600 + dxmax;

/************************************************************** 

    Graph 上での絶対座標 (nxx,nyy) に 点(*)を描きます。

**************************************************************/

fprintf(fpC,"<DIV style=\"top :");

fprintf(fpC,"%d",nxx) ;

fprintf(fpC,"px;left :") ;

fprintf(fpC,"%d",nyy);

fprintf(fpC,"px; position : absolute; z-index : 1;\" id=\"Layer1\"><P>");

fprintf(fpC,"*");

fprintf(fpC,"</P></DIV>\n" ); }


/****************************************************************/






/*******************************************************

KPLOT 番目の Graph(KPLOT) を描きます。

*******************************************************/

for ( i =0; i<N+1 ;i++) {

xx= XP[KPLOT][i];

yy= YP[KPLOT][i];


/**************************************************************

 描画したい点 (xx,yy) のGraph 上での絶対座標 (nxx,nyy) の計算

**************************************************************/

nyy = ny1 + (xx-xmin)*(ny2-ny1)/(xmax-xmin) ;

nxx = nx2 + (yy-ymin)*(nx1-nx2)/(ymax-ymin) ;


/************************************************************** 

    Graph 上での絶対座標 (nxx,nyy) に 点(.)を描きます。

**************************************************************/

fprintf(fpC,"<DIV style=\"top :");

fprintf(fpC,"%d",nxx) ;

fprintf(fpC,"px;left :") ;

fprintf(fpC,"%d",nyy);

fprintf(fpC,"px; position : absolute; z-index : 1;\" id=\"Layer1\"><P>");

fprintf(fpC,".");

fprintf(fpC,"</P></DIV>\n" ); }



/*******************************************************

KPLOT 番目の ADD 番目の Graph を 追加して 描きます。

*******************************************************/


if(ADD==0) goto SKIP;

for ( i =0; i<N+1 ;i++) {

xx= XP[ADD][i];

yy= YP[ADD][i];


/**************************************************************

 描画したい点 (xx,yy) のGraph 上での絶対座標 (nxx,nyy) の計算

**************************************************************/

nyy = ny1 + (xx-xmin)*(ny2-ny1)/(xmax-xmin) ;

nxx = nx2 + (yy-ymin)*(nx1-nx2)/(ymax-ymin) ;


/**************************************************************/


fprintf(fpC,"<DIV style=\"top :");

fprintf(fpC,"%d",nxx) ;

fprintf(fpC,"px;left :") ;

fprintf(fpC,"%d",nyy);

fprintf(fpC,"px; position : absolute; z-index : 1;\" id=\"Layer1\"><P>");

fprintf(fpC,".");

fprintf(fpC,"</P></DIV>\n" ); }




/**************************************************************/


SKIP:



fprintf(fpC,"</B></I></FONT>\n</BODY></HTML>\n");



fclose(fpC);

printf( "\n\n NPLOT = %d Push Enter Key >", NPLOT );

c=getchar( ); if(c =='c') printf("\n\n Good Bye ! \n\n");


if ( NPLOT == 0 )

printf("\n\n ******* See A.html *******\n\n");

if ( NPLOT > 0 )

printf("\n\n ******* See A%d.html *******\n\n",NPLOT); }







/***********************************************************

Main Program の名称は void main( void ) です。

 NPLOT 個の graph を描きます。


Graph を描いて html file に出力します。

KPLOT= 0 の時は  A.html に
KPLOT= 1 の時は  A1.html に
       KPLOT= 2 の時は  A2.html に出力します。  
       ..............................................

KPLOT= 9 の時は  A9.html に出力します。


関数 PXPY( ) を定義し、Graphの各点の座標値を決定します。     

       for KPLOT =0 to NPLOT and for i = 0 to N,

  各点の座標値は XP[KPLOT][i]、YP[KPLOT][i]  に入ります。  

************************************************************


************************************************************/

void main( void ) {


TEST = 0; KKK=0;


printf("\n\n NKK = ");

scanf("%d",&NKK);

printf("\n\n READ = ");

scanf("%d",&READ);

if ( READ == 0 ) KKK= 0;




PXPY( );


if( TEST== 0 ) goto NEXT;


x = 0.5*WB ;

T1 = 0.2 *VB ;

T2 = 0.4 * VB ;


Newton( );


printf( "\n\n Push Enter Key to End Testing \n\n>" );

c=getchar( ); if(c =='c') printf("\n\n Good Bye ! \n\n");



if( TEST == 1 ) goto FINISH;


NEXT:




xmin = -0.2 ; xmax = 1.8 ; ymin = 0 ; ymax = 1;


Ni =10; Nj =10;

dxmin = 5 ; dxmax = 10 ; dymin = 10 ; dymax = 10 ;

dyoffset = 5;



xaxis = Wo/WB ;

yaxis = 0.5 ;


/*******************************************************************


YP[1][ ] = The surface P+P Gaussian impurity atom doping profile D(x)

YP[2][ ] = Initial Value YY(x) of the surface P+P Barrier Potential

YP[3][ ] = Intial Hole Densiy H (x) = Npp * exp ( - YY(x)/kT )

YP[4][ ] = Exact Numerical P+P Surface Barrier Potential Value ZZ(x)

YP[5][ ] = Final Hole Densiy HH (x) = Npp * exp ( - ZZ(x)/kT )


/***********************************************************


NPLOT =1; KPLOT = 4 ; ADD = 2 ; Graph_Plot( ) ;

NPLOT =2; KPLOT = 3 ; ADD = 1 ; Graph_Plot( ) ;

NPLOT =3; KPLOT = 5 ; ADD = 1 ; Graph_Plot( ) ;

NPLOT =4; KPLOT = 1 ; ADD = 0; Graph_Plot( ) ;

NPLOT =5; KPLOT = 2 ; ADD = 0; Graph_Plot( ) ;

NPLOT =6; KPLOT = 5 ; ADD = 3 ; Graph_Plot( ) ;


/**********************************************************/



/********* NPLOT =1; KPLOT = 4 ; ADD = 2 ; ************

if( NPLOT == 1 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin =VB , Ymax = 0 ) \n<BR> " ) ;

fprintf(fpC," Exact Numerical Barrier Potential ZZ(x) and Initial Value YY(x) are compared \n\n<BR>" ) ; }

*********************************************************/

NPLOT =1; KPLOT = 4 ; ADD = 2 ; Graph_Plot( ) ;





/********* NPLOT =2; KPLOT = 3 ; ADD = 1 ; ************

if( NPLOT == 2 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," Initial Hole Densiy HH(x) and the P+P doping profile D(x) are compared \n\n<BR>" ) ; }

*********************************************************/

NPLOT =2; KPLOT = 3 ; ADD = 1 ; Graph_Plot( ) ;







/********* NPLOT =3; KPLOT = 5 ; ADD = 1 ; ************

if( NPLOT == 3 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin =0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," Final Hole Densiy HH(x) and Initial Hole Denisty H(x) are compared \n\n<BR>" ) ; }


*********************************************************/

NPLOT =3; KPLOT = 5 ; ADD = 1 ; Graph_Plot( ) ;





/********* NPLOT =4; KPLOT = 1 ; ADD = 0; ************

if( NPLOT == 4 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," The surface P+P Gaussian impurity atom doping profile D(x) \n\n<BR>" ) ; }

*********************************************************/

NPLOT =4; KPLOT = 1 ; ADD = 0; Graph_Plot( ) ;






/********* NPLOT = 5 ;KPLOT = 5 ; ADD = 1 ; ************

if( NPLOT == 5 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax = Npp ) \n<BR> " ) ;

fprintf(fpC," Intial Hole Densiy H (x) = Npp * exp ( - YY(x)/kT ) ; \n\n<BR>" ) ; }

*********************************************************/

NPLOT =5; KPLOT = 2 ; ADD = 0; Graph_Plot( ) ;



/********* NPLOT = 6 ; KPLOT = 5 ; ADD = 3 ; ************

if( NPLOT == 6 ) {

fprintf(fpC,"Frame ( Xmin = -0.125 WB, Xmax = 1.125 WB , Ymin = 0 , Ymax =Npp ) \n<BR> " ) ;

fprintf(fpC," Final Hole Densiy HH(x) and Initial Hole Denisty H(x) are compared \n\n<BR>" ) ; }

*********************************************************/

NPLOT =6; KPLOT = 5 ; ADD = 3 ; Graph_Plot( ) ;






/*******************************************

Program のすべての計算が完了しますと、

  Standby 状態のなります。

  最後に Enter Key を押すと 

  Programが終了します。

********************************************/

printf( "\n\n Push Enter Key to End > " );

c=getchar( ); if(c =='c') printf("\n\n Good Bye ! \n\n");


FINISH:

printf( "\n\n One More Push >" );

c=getchar( ); if(c =='c') printf("\n\n Good Bye ! \n\n"); }






/*************** END of Program Coding ****************
/







http://www.aiplab.com/P2020_Pinned_Photodiode_Solar_Cell_1.pdf

http://www.aiplab.com/P2020_Pinned_Photodiode_Solar_Cell_2.pdf






return to http://www.aiplab.com