puts("-P <file> \t specify implantation profile file");
puts("-N <file> \t specify nuclear energy loss profile file");
printf("-H <value> \t collisions per ion in simulation window (default %d)\n",CPI);
+ puts("-m <value> \t specify c->a carbon saturation");
return 1;
}
{
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)++;
}
{
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)<my_info->c_sat)
{
for(c=-1;c<=1;c++)
{
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_z<FFT_HEIGHT) )
- {
- puts("error: z < FFT_HEIGHT!");
- puts("not writing bmp file ...");
- return -1;
- }
-
- if(window%3==1)
+ if(window==1)
{
sprintf(bmpfile,"x-z_%d.bmp",y);
foo=3*d3_l->max_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)
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)
{
puts("failed writing bmp header");
return -1;
}
- if(window%3==1)
+ if(window==1)
{
- for(j=0;j<d3_l->max_z-end;j++)
+ for(j=0;j<d3_l->max_z;j++)
{
for(i=0;i<d3_l->max_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");
}
}
}
- if(window%3==2)
+ if(window==2)
{
- for(j=0;j<d3_l->max_z-end;j++)
+ for(j=0;j<d3_l->max_z;j++)
{
for(i=0;i<d3_l->max_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");
}
}
}
+ if(window==4)
+ {
+ for(j=0;j<d3_l->max_z;j++)
+ {
+ for(i=0;i<d3_l->max_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;j<d3_l->max_z;j++)
+ {
+ for(i=0;i<d3_l->max_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;j<d3_l->max_z;j++)
+ {
+ for(i=0;i<d3_l->max_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;
free(flag);
- // printf("debug: (interpolated c profile)\n");
- // for(i=0;i<d3_l->max_z;i++) printf("%d %d\n",i,graph[i]);
+#ifdef DEBUG_INTERPOL_PROFILE
+ printf("debug: (interpolated profile)\n");
+ for(i=0;i<d3_l->max_z;i++) printf("%d %d\n",i,graph[i]);
+#endif
return max;
}
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;
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;
case 'H':
my_info.cpi=atoi(argv[++i]);
break;
+ case 'm':
+ my_info.c_sat=atoi(argv[++i]);
+ break;
default:
usage();
return -1;
sprintf(zdiff_txt,"diffusion in z direction: %c",my_info.z_diff?'y':'n');
sprintf(diff_txt,"diffusion every %d steps",my_info.diff_rate);
strcpy(mode_txt,"view: a/c mode");
- arg_v[1]=xyz_txt;
- arg_v[2]=NULL;
+ sprintf(hpi_txt,"hits per ion: %d",my_info.cpi);
+ sprintf(csat_txt,"carbon saturation: %d",my_info.c_sat);
+ arg_v[1]=mode_txt;
+ arg_v[2]=xyz_txt;
arg_v[3]=status_txt;
arg_v[4]=conc_txt;
arg_v[5]=NULL;
- arg_v[6]=mode_txt;
- arg_v[7]=NULL;
- arg_v[8]=steps_txt;
- arg_v[9]=cc_txt;
- arg_v[10]=NULL;
- arg_v[11]=diff_txt;
- arg_v[12]=zdiff_txt;
- arg_v[13]=NULL;
- arg_v[14]=a_txt;
- arg_v[15]=s_txt;
- arg_v[16]=dose_txt;
- arg_v[17]=NULL;
- arg_v[18]=r_txt;
- arg_v[19]=ap_txt;
- arg_v[20]=el_txt;
- arg_v[21]=cd_txt;
- arg_v[22]=cp_txt;
+ arg_v[6]=steps_txt;
+ arg_v[7]=cc_txt;
+ arg_v[8]=NULL;
+ arg_v[9]=a_txt;
+ arg_v[10]=s_txt;
+ arg_v[11]=dose_txt;
+ arg_v[12]=diff_txt;
+ arg_v[13]=zdiff_txt;
+ arg_v[14]=r_txt;
+ arg_v[15]=ap_txt;
+ arg_v[16]=el_txt;
+ arg_v[17]=cd_txt;
+ arg_v[18]=cp_txt;
+ arg_v[19]=dr_ac_txt;
+ arg_v[20]=dr_cc_txt;
+ arg_v[21]=hpi_txt;
+ arg_v[22]=csat_txt;
arg_v[23]=NULL;
- arg_v[24]=dr_ac_txt;
- arg_v[25]=dr_cc_txt;
+ arg_v[24]=NULL;
+ arg_v[25]=NULL;
#endif
if((!strcmp(l_file,""))||(c_step))
#endif
#ifdef DEBUG_NEL
printf("%d\n",get_rand_reject(d3_l.max_z,ne_max,n_e_loss));
+#endif
+#ifdef DEBUG_NORM
+ printf("%d\n",get_rand(d3_l.max_z));
#endif
}
#endif
{
x_c=get_rand(d3_l.max_x);
y_c=get_rand(d3_l.max_y);
- // z_c=get_rand_lgp(d3_l.max_z,my_info.a_el,my_info.b_el);
z_c=get_rand_reject(d3_l.max_z,ne_max,n_e_loss);
process_cell(&d3_l,x_c,y_c,z_c,&my_info);
}
bmp=0;
ac_distr=0;
scan_event(&d3_l,&x,&y,&z,&quit,&escape,&switchmode,&bmp,&ac_distr);
- if(bmp) write_bmp(&d3_l,bmp,x,y,z);
+ if(bmp) write_bmp(&d3_l,bmp,x,y,z,max_extra);
if(ac_distr) write_ac_distr(&d3_l,ac_distr);
}