X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fnlsop.git;a=blobdiff_plain;f=nlsop.c;h=21d9439877ab77f68f4b81a107056166a8e5d542;hp=11f81f5f569e26c02024a23ebe6fc091713f8c3e;hb=08843ccf3744390f19558bd30a0fa619a9f9010e;hpb=a04f85207ca9c68e39c6e2f1b0f29eeb062451bd diff --git a/nlsop.c b/nlsop.c index 11f81f5..21d9439 100644 --- a/nlsop.c +++ b/nlsop.c @@ -78,7 +78,9 @@ int usage(void) puts("-S \t save to file"); puts("-R \t read from random file"); puts("-P \t specify implantation profile file"); + puts("-N \t specify nuclear energy loss profile file"); printf("-H \t collisions per ion in simulation window (default %d)\n",CPI); + puts("-m \t specify c->a carbon saturation"); return 1; } @@ -130,10 +132,7 @@ int distrib_c(d3_lattice *d3_l,info *my_info,int step,double c_ratio,u32 rj_m,u3 { x=get_rand(d3_l->max_x); y=get_rand(d3_l->max_y); - // printf("nd: %d %d\n",x,y); - // z=get_rand_lgp(d3_l->max_z,my_info->a_cd,my_info->b_cd); z=get_rand_reject(d3_l->max_z,rj_m,rj_g); - // printf("%d\n",z); *(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1; (my_info->cc)++; } @@ -149,7 +148,7 @@ int distrib_c(d3_lattice *d3_l,info *my_info,int step,double c_ratio,u32 rj_m,u3 { offset=i+j*d3_l->max_x+k*d3_l->max_x*d3_l->max_y; /* case amorph: amorph <- cryst diffusion */ - if(*(d3_l->status+offset)&AMORPH) + if(*(d3_l->status+offset)&AMORPH && *(d3_l->extra+offset)c_sat) { for(c=-1;c<=1;c++) { @@ -334,7 +333,7 @@ int calc_max_extra(d3_lattice *d3_l) int write_ac_distr(d3_lattice *d3_l,int ac_distr) { int fd,x,y,z; - int count=0,offset; + int count,offset; char file[16]; if(ac_distr==1) strcpy(file,"a.plot"); @@ -349,6 +348,7 @@ int write_ac_distr(d3_lattice *d3_l,int ac_distr) for(z=0;zmax_z;z++) { + count=0; for(x=0;xmax_x;x++) { for(y=0;ymax_y;y++) @@ -368,52 +368,27 @@ int write_ac_distr(d3_lattice *d3_l,int ac_distr) return 1; } -int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) +int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z,int max) { - int fd,i,j,size=0,foo=0,end=0; + int fd,i,j,size=0,foo=0,k,sum; int width=0,height=0; char bmpfile[MAX_CHARS]; char buf[128]; - if(((window==4)||(window==5))&&(d3_l->max_zmax_x; - if(window==1) - { - size=(foo+(4-foo%4))*d3_l->max_z; - height=d3_l->max_z; - } - else - { - size=(foo+(4-foo%4))*FFT_HEIGHT; - end=d3_l->max_z-FFT_HEIGHT; - height=FFT_HEIGHT; - } + size=(foo+(4-foo%4))*d3_l->max_z; + height=d3_l->max_z; width=d3_l->max_x; } - if(window%3==2) + if(window==2) { sprintf(bmpfile,"y-z_%d.bmp",x); foo=3*d3_l->max_y; - if(window==2) - { - size=(foo+(4-foo%4))*d3_l->max_z; - height=d3_l->max_z; - } - else - { - size=(foo+(4-foo%4))*FFT_HEIGHT; - end=d3_l->max_z-FFT_HEIGHT; - height=FFT_HEIGHT; - } + size=(foo+(4-foo%4))*d3_l->max_z; + height=d3_l->max_z; width=d3_l->max_y; } if(window==3) @@ -424,6 +399,30 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) width=d3_l->max_x; height=d3_l->max_y; } + if(window==4) + { + sprintf(bmpfile,"x-z_cdistr_%d.bmp",y); + foo=3*d3_l->max_x; + size=(foo+(4-foo%4))*d3_l->max_z; + height=d3_l->max_z; + width=d3_l->max_x; + } + if(window==5) + { + sprintf(bmpfile,"y-z_cdistr_%d.bmp",x); + foo=3*d3_l->max_y; + size=(foo+(4-foo%4))*d3_l->max_z; + height=d3_l->max_z; + width=d3_l->max_y; + } + if(window==6) + { + sprintf(bmpfile,"x-y_cdistr_%d.bmp",z); + foo=3*d3_l->max_x; + size=(foo+(4-foo%4))*d3_l->max_y; + width=d3_l->max_x; + height=d3_l->max_y; + } if((fd=open(bmpfile,O_WRONLY|O_CREAT))<0) { @@ -468,14 +467,17 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) puts("failed writing bmp header"); return -1; } - if(window%3==1) + if(window==1) { - for(j=0;jmax_z-end;j++) + for(j=0;jmax_z;j++) { for(i=0;imax_x;i++) { - if(*(d3_l->status+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); - else memset(buf,0,3); + sum=0; + for(k=-2;k<=2;k++) + if(*(d3_l->status+i+(((y+k+d3_l->max_y)%d3_l->max_y)*d3_l->max_x)+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) sum+=0xff; + sum/=5; + memset(buf,(unsigned char)sum,3); if(write(fd,buf,3)<3) { puts("failed writing rgb values to bmp file"); @@ -493,14 +495,17 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) } } } - if(window%3==2) + if(window==2) { - for(j=0;jmax_z-end;j++) + for(j=0;jmax_z;j++) { for(i=0;imax_y;i++) { - if(*(d3_l->status+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); - else memset(buf,0,3); + sum=0; + for(k=-2;k<=2;k++) + if(*(d3_l->status+((x+k+d3_l->max_x)%d3_l->max_x)+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) sum+=0xff; + sum/=5; + memset(buf,(unsigned char)sum,3); if(write(fd,buf,3)<3) { puts("failed writing rgb values to bmp file"); @@ -543,6 +548,84 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) } } } + if(window==4) + { + for(j=0;jmax_z;j++) + { + for(i=0;imax_x;i++) + { + sum=*(d3_l->extra+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y); + sum=sum*255/max; + memset(buf,(unsigned char)sum,3); + if(write(fd,buf,3)<3) + { + puts("failed writing rgb values to bmp file"); + return-1; + } + } + if(foo%4) + { + memset(buf,0,4-foo%4); + if(write(fd,buf,4-foo%4)<4-foo%4) + { + puts("failed writing 4 byte ending"); + return -1; + } + } + } + } + if(window==5) + { + for(j=0;jmax_z;j++) + { + for(i=0;imax_x;i++) + { + sum=*(d3_l->extra+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y); + sum=sum*255/max; + memset(buf,(unsigned char)sum,3); + if(write(fd,buf,3)<3) + { + puts("failed writing rgb values to bmp file"); + return-1; + } + } + if(foo%4) + { + memset(buf,0,4-foo%4); + if(write(fd,buf,4-foo%4)<4-foo%4) + { + puts("failed writing 4 byte ending"); + return -1; + } + } + } + } + if(window==6) + { + for(j=0;jmax_z;j++) + { + for(i=0;imax_x;i++) + { + sum=*(d3_l->extra+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y); + sum=sum*255/max; + memset(buf,(unsigned char)sum,3); + if(write(fd,buf,3)<3) + { + puts("failed writing rgb values to bmp file"); + return-1; + } + } + if(foo%4) + { + memset(buf,0,4-foo%4); + if(write(fd,buf,4-foo%4)<4-foo%4) + { + puts("failed writing 4 byte ending"); + return -1; + } + } + } + } close(fd); return 1; @@ -754,8 +837,10 @@ u32 get_reject_graph(info *my_info,d3_lattice *d3_l,char *file,u32 *graph) { free(flag); - // printf("debug: (interpolated c profile)\n"); - // for(i=0;imax_z;i++) printf("%d %d\n",i,graph[i]); +#ifdef DEBUG_INTERPOL_PROFILE + printf("debug: (interpolated profile)\n"); + for(i=0;imax_z;i++) printf("%d %d\n",i,graph[i]); +#endif return max; } @@ -771,6 +856,7 @@ int main(int argc,char **argv) char l_file[MAX_CHARS]; char c_file[MAX_CHARS]; char p_file[MAX_CHARS]; + char n_e_file[MAX_CHARS]; char convert; char r_file[MAX_CHARS]; #ifdef USE_DFB_API @@ -792,6 +878,8 @@ int main(int argc,char **argv) char dr_cc_txt[MAX_TXT]; char dose_txt[MAX_TXT]; char mode_txt[MAX_TXT]; + char hpi_txt[MAX_TXT]; + char csat_txt[MAX_TXT]; char *arg_v[MAX_ARGV]; #endif d3_lattice d3_l; @@ -826,6 +914,7 @@ int main(int argc,char **argv) my_info.dr_cc=DR_CC; my_info.diff_rate=DIFF_RATE; my_info.cpi=CPI; + my_info.c_sat=C_SAT; nowait=0; quit=0; escape=0; @@ -835,6 +924,7 @@ int main(int argc,char **argv) strcpy(l_file,""); strcpy(c_file,""); strcpy(p_file,IMP_PROFILE); + strcpy(n_e_file,NEL_PROFILE); convert=0; strcpy(r_file,""); mode=0; @@ -928,6 +1018,9 @@ int main(int argc,char **argv) case 'P': strcpy(p_file,argv[++i]); break; + case 'N': + strcpy(n_e_file,argv[++i]); + break; case 'g': strcpy(l_file,argv[++i]); if(i