2 * parse srim 2003.26 collision data
4 * author: hackbard@hackdaworld.dyndns.org
6 * this may just work with srim 2003.26 and 180keV c+ -> si,
7 * not quite sure though! :)
16 #include <sys/types.h>
24 int cell_hits_from_ions;
29 int main(int argc,char **argv) {
38 unsigned char hit[MAXZ];
39 char buf[256],*p,value[6],value2[11];
45 printf("opening file %s ...\n",argv[1]);
46 if((fd=open(argv[1],O_RDONLY))<0) {
47 printf("unable to open file %s\n",argv[1]);
56 Z[i].cell_hits_from_ions=0;
73 max_th=Z[0].total_hits;
74 max_chfi=Z[0].cell_hits_from_ions;
76 if(Z[i].energy>max_e) max_e=Z[i].energy;
77 if(Z[i].total_hits>max_th) max_th=Z[i].total_hits;
78 if(Z[i].cell_hits_from_ions>max_chfi) max_chfi=Z[i].cell_hits_from_ions;
79 avg1+=Z[i].total_hits;
80 avg2+=Z[i].cell_hits_from_ions;
83 //printf("%d %f %f %f\n",i*3,1.0*Z[i].total_hits/max_th,
85 // 1.0*Z[i].cell_hits_from_ions/max_chfi);
86 printf("%d %f\n",i*3,1.0*Z[i].total_hits/max_th); // hits
87 //printf("%d %f\n",i*3,1.0*Z[i].energy/max_e); // energy
88 printf("skipped = %d\n",skipped);
89 printf("average hits per ion %d / %d\n",avg1/ion,avg2/ion);
92 if(buf[i]=='\n') break;
97 if((buf[0]=='³')&&(buf[1]!='=')&&(buf[1]!=' ')) {
129 z=(int)(atof(value2)/30.);
130 if(z>232) skipped+=1;
133 //Z[z].total_hits+=1;
136 if(ion!=atoi(value)) {
138 for(i=0;i<MAXZ;i++) Z[i].cell_hits_from_ions+=hit[i];
142 // printf("%d %d %f %d\n",z*3,Z[z].total_hits,
143 // Z[z].energy,Z[z].cell_hits_from_ions);
146 if((buf[0]=='Û')&&(buf[1]==' ')) {
157 z=(int)(atof(value2)/30.);
170 if(z>232) skipped+=1;