X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fnlsop.git;a=blobdiff_plain;f=parse_trim_collision.c;fp=parse_trim_collision.c;h=ea59d6b669ec59d97e6d2260e25232a7109759f0;hp=0000000000000000000000000000000000000000;hb=3cf265bb194147846ad6be9f7b870802185e5bbc;hpb=102459c28900614566fc18826c6acdf07b572550 diff --git a/parse_trim_collision.c b/parse_trim_collision.c new file mode 100644 index 0000000..ea59d6b --- /dev/null +++ b/parse_trim_collision.c @@ -0,0 +1,131 @@ +/* + * parse srim 2003.26 collision data + * + * author: hackbard@hackdaworld.dyndns.org + * + * this may just work with srim 2003.26 and 180keV c+ -> si, + * not quite sure though! :) + * + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include + +#define MAXION 5000 +#define MAXZ 233 + +typedef struct s_z { + int cell_hits_from_ions; + int total_hits; + double energy; +} t_z; + +int main(int argc,char **argv) { + + int fd,ion,i,j; + int z,skipped; + float en; + t_z Z[MAXZ]; + unsigned char hit[MAXZ]; + char buf[256],*p,value[6],value2[10]; + + i=0; + + if(argc!=2) return 0; + + printf("opening file %s ...\n",argv[1]); + if((fd=open(argv[1],O_RDONLY))<0) { + printf("unable to open file %s\n",argv[1]); + return 0; + } + + ion=1; + skipped=0; + for(i=0;i232) skipped+=1; + else { + Z[z].energy+=en; + Z[z].total_hits+=1; + hit[z]=1; + } + if(ion!=atoi(value)) { + /* new ion */ + for(i=0;i