17 int main(int argc,char **argv) {
21 int area,size,x,y,z,d;
25 unsigned char *status;
31 printf("usage: %s <x> <y> <z> <conc>\n",argv[0]);
35 if((fd=open("cbox.save",O_WRONLY))<0) {
37 printf("unable to open save file!\n");
44 d=500/3; /* maximum 180keV, so ... */
48 C=(1.0*atp*SI_PER_VOLUME)/(1-atp);
49 sigma=(1.0*((700-500)/3)*((700-500)/3))/(log(C));
51 printf("sanity checks ...\n");
59 printf("even more stupid!\n");
63 printf("malloc ...\n");
65 status=malloc(size*sizeof(unsigned char));
66 memset(status,0,size*sizeof(unsigned char));
67 conc=malloc(size*sizeof(int));
69 printf("computing c profile ...\n");
73 printf(" first constant part -> %d\n",C0);
74 for(k=0;k<i;k++) *(conc+k)=C0;
75 printf(" last gauss part:\n");
77 C=C0*exp(-1.0*(k-167)*(k-167)/sigma);
78 printf(" c = %d\n",C);
79 for(j=0;j<area;j++) *(conc+k*area+j)=C;
82 printf("nlsp header stuff ...\n");
87 memset(&info,0,sizeof(info));
89 printf("writing file ...\n");
91 write(fd,&d3l,sizeof(d3_lattice));
92 write(fd,&info,sizeof(info));
93 write(fd,status,size*sizeof(unsigned char));
94 write(fd,conc,size*sizeof(int));