printf("-x <value> \t # x cells (default %d)\n",X);
printf("-y <value> \t # y cells (default %d)\n",Y);
printf("-z <value> \t # z cells (default %d)\n",Z);
- /*
- printf("-X <value> \t display x (default %d)\n",X/2-1);
- printf("-Y <value> \t display y (default %d)\n",Y/2-1);
- printf("-Z <value> \t display z (default %d)\n",Z/2-1);
- */
printf("-s <value> \t steps (default %d)\n",STEPS);
printf("-d <value> \t refresh display (default %d)\n",REFRESH);
printf("-r <value> \t amorphous influence range (default %d)\n",RANGE);
printf("-f <value> \t pressure = <value> * 1/distance^2 (default %f)\n",A_AP);
printf("-p <value> \t pressure offset (default %f)\n",B_AP);
+ printf("-F <value> \t proportionality constant between c conc and ability to get amorphous (default %f)\n",A_CP);
printf("-A <value> \t slope of linear c distribution (default %f)\n",A_CD);
printf("-B <value> \t linear c distribution offset (default %f)\n",B_CD);
- /*
- printf("-C <value> \t initial c concentration (default %d)\n",CC);
- */
printf("-D <value> \t diffusion rate from cryst to amorph cells (default %f)\n",DR_AC);
printf("-c <value> \t diffusion rate in cryst cells (default %f)\n",DR_CC);
+ printf("-e <value> \t do diffusion every <value> steps (default %d)\n",DIFF_RATE);
printf("-W <value> \t write every <value> steps to save file (default %d)\n",RESAVE);
puts("-C <file> \t convert file to gnuplot format");
puts("-L <file> \t load from file");
}
}
p+=*conc*my_info->a_cp*URAND_MAX;
- printf("debug: p = %f\n",p);
if(!(*thiz&AMORPH))
{
if(get_rand(URAND_MAX)<=p) MAKE_AMORPH(thiz);
return 1;
}
-int distrib_c(d3_lattice *d3_l,info *my_info) /* double d_r,double a,double b,char z_diff) */
+int distrib_c(d3_lattice *d3_l,info *my_info)
{
u32 x,y,z;
int i,j,k,c;
/* put one c ion somewhere in the lattice */
x=get_rand(d3_l->max_x);
y=get_rand(d3_l->max_y);
- z=get_rand_lgp(d3_l->max_z,a,b);
+ z=get_rand_lgp(d3_l->max_z,my_info->a_cd,my_info->b_cd);
*(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1;
- /* diffusion in layer */
for(i=0;i<d3_l->max_x;i++)
{
for(j=0;j<d3_l->max_y;j++)
for(k=0;k<d3_l->max_z;k++)
{
offset=i+j*d3_l->max_x+k*d3_l->max_x*d3_l->max_y;
- /* case amorph */
+ /* case amorph - amorph <-> cryst diffusion */
if(*(d3_l->status+offset)&AMORPH)
{
- /* look at neighbours and move c ions */
for(c=-1;c<=1;c++)
{
if(c!=0)
{
off=((i+d3_l->max_x+c)%d3_l->max_x)+j*d3_l->max_x+k*d3_l->max_x*d3_l->max_y;
carry=0;
- /* case neighbour not amorph */
- if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(d_r*(*(d3_l->extra+off)));
- /* case neighbour amorph */
- /*
- * no diffusion between amorphous cells
- *
- else carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2;
- */
+ if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off)));
if(carry!=0)
{
*(d3_l->extra+offset)+=carry;
{
off=i+((j+c+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+k*d3_l->max_x*d3_l->max_y;
carry=0;
- /* case neighbour not amorph */
- if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(d_r*(*(d3_l->extra+off)));
- /* case neighbour amorph */
- /*
- *
- * no diffusion between amorphous cells
- *
- else carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2;
- */
+ if(!(*(d3_l->status+off)&AMORPH)) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off)));
if(carry!=0)
{
*(d3_l->extra+offset)+=carry;
}
}
}
+ if(my_info->z_diff)
+ {
+ for(c=-1;c<=1;c++)
+ {
+ if(c!=0)
+ {
+ off=i+j*d3_l->max_x+((k+c+d3_l->max_z)%d3_l->max_z)*d3_l->max_x*d3_l->max_y;
+ carry=0;
+ if(!*(d3_l->status+off)&AMORPH) carry=(int)(my_info->dr_ac*(*(d3_l->extra+off)));
+ if(carry!=0)
+ {
+ *(d3_l->extra+off)-=carry;
+ *(d3_l->extra+offset)+=carry;
+ }
+ }
+ }
+ }
} else
- /* case not amorph */
+ /* case not amorph - cryst <-> cryst diffusion */
{
- /* look at neighbours and move c ions */
for(c=-1;c<=1;c++)
{
if(c!=0)
{
off=i+((j+c+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+k*d3_l->max_x*d3_l->max_y;
carry=0;
- /* case neighbour not amorph */
if(!(*(d3_l->status+off)&AMORPH))
{
carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2;
{
off=((i+c+d3_l->max_x)%d3_l->max_x)+j*d3_l->max_x+k*d3_l->max_x*d3_l->max_y;
carry=0;
- /* case neighbour not amorph */
if(!(*(d3_l->status+off)&AMORPH))
{
carry=(*(d3_l->extra+off)-*(d3_l->extra+offset))/2;
}
}
}
- /* cryst -> amorph diffusion in z direction */
- if(z_diff)
- {
- for(c=1;c>=-1;c--)
- {
- off=i+j*d3_l->max_x+((k+c+d3_l->max_z)%d3_l->max_z)*d3_l->max_x*d3_l->max_y;
- carry=0;
- if(*(d3_l->status+off)&AMORPH) carry=(int)(d_r*(*(d3_l->extra+offset)));
- if(carry!=0)
- {
- *(d3_l->extra+offset)-=carry;
- *(d3_l->extra+off)+=carry;
- }
- }
- } /* if z_diff */
}
} /* for z */
} /* for y */
char el_txt[MAX_TXT];
char cd_txt[MAX_TXT];
char r_txt[MAX_TXT];
- char ap2_txt[MAX_TXT];
- char cd2_txt[MAX_TXT];
- char el2_txt[MAX_TXT];
+ char cp_txt[MAX_TXT];
+ char zdiff_txt[MAX_TXT];
+ char diff_txt[MAX_TXT];
char dr_ac_txt[MAX_TXT];
char dr_cc_txt[MAX_TXT];
char mode_txt[MAX_TXT];
my_info.b_cd=B_CD;
my_info.a_ap=A_AP;
my_info.b_ap=B_AP;
+ my_info.a_cp=A_CP;
my_info.cc=CC;
my_info.dr_ac=DR_AC;
my_info.dr_cc=DR_CC;
+ my_info.diff_rate=DIFF_RATE;
nowait=0;
quit=0;
escape=0;
case 'z':
d3_l.max_z=atoi(argv[++i]);
break;
- /*
- case 'X':
- x=atoi(argv[++i]);
- break;
- case 'Y':
- y=atoi(argv[++i]);
- break;
- */
case 'Z':
my_info.z_diff=1;
break;
- /* */
case 's':
my_info.steps=atoi(argv[++i]);
break;
case 'p':
my_info.b_ap=atof(argv[++i]);
break;
+ case 'F':
+ my_info.a_cp=atof(argv[++i]);
+ break;
case 'A':
my_info.a_cd=atof(argv[++i]);
break;
case 'B':
my_info.b_cd=atof(argv[++i]);
break;
- /*
- case 'C':
- my_info.cc=atoi(argv[++i]);
- break;
- */
case 'W':
resave=atoi(argv[++i]);
break;
case 'c':
my_info.dr_cc=atof(argv[++i]);
break;
+ case 'e':
+ my_info.diff_rate=atoi(argv[++i]);
+ break;
case 'L':
strcpy(l_file,argv[++i]);
break;
strcpy(a_txt,"args:");
sprintf(s_txt,"steps: %d",my_info.steps);
sprintf(r_txt,"pressure range: %d",my_info.range);
- sprintf(ap_txt,"pressure faktor: %.2f",my_info.a_ap);
- sprintf(ap2_txt,"pressure offset: %.2f",my_info.b_ap);
- sprintf(el_txt,"energy loss slope: %.2f",my_info.a_el);
- sprintf(el2_txt,"energy loss offset: %.2f",my_info.b_el);
- sprintf(cd_txt,"c distrib slope: %.2f",my_info.a_cd);
- sprintf(cd2_txt,"c distrib offset: %.2f",my_info.b_cd);
- sprintf(dr_ac_txt,"a/c diffusion rate: %.2f",my_info.dr_ac);
- sprintf(dr_cc_txt,"c/c diffusion rate: %.2f",my_info-dr_cc);
+ sprintf(ap_txt,"a_ap: %.2f b_ap: %.3f",my_info.a_ap,my_info.b_ap);
+ sprintf(el_txt,"a_el: %.2f b_el: %.3f",my_info.a_el,my_info.b_el);
+ sprintf(cd_txt,"a_cd: %.2f b_cd: %.3f",my_info.a_cd,my_info.b_cd);
+ sprintf(cp_txt,"a_cp: %.4f",my_info.a_cp);
+ sprintf(dr_ac_txt,"a/c diffusion rate: %.4f",my_info.dr_ac);
+ sprintf(dr_cc_txt,"c/c diffusion rate: %.4f",my_info.dr_cc);
+ 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;
arg_v[8]=steps_txt;
arg_v[9]=cc_txt;
arg_v[10]=NULL;
- arg_v[11]=NULL;
- arg_v[12]=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]=r_txt;
arg_v[17]=ap_txt;
- arg_v[18]=ap2_txt;
- arg_v[19]=el_txt;
- arg_v[20]=el2_txt;
- arg_v[21]=cd_txt;
- arg_v[22]=cd2_txt;
- arg_v[23]=dr_ac_txt;
- arg_v[24]=dr_cc_txt;
+ arg_v[18]=el_txt;
+ arg_v[19]=cd_txt;
+ arg_v[20]=cp_txt;
+ arg_v[21]=dr_ac_txt;
+ arg_v[22]=dr_cc_txt;
+ arg_v[23]=NULL;
+ arg_v[24]=NULL;
#endif
if(!strcmp(l_file,""))
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);
- distrib_c(&d3_l,my_info.d_r,my_info.a_cd,my_info.b_cd,z_diff);
+ if(i%my_info.diff_rate==0) distrib_c(&d3_l,&my_info);
process_cell(&d3_l,x_c,y_c,z_c,&my_info);
#ifdef USE_DFB_API
if(i%refresh==0)
if(switchmode==1) mode=1;
if(switchmode==2) mode=2;
/* end of bahh! */
- sprintf(x_txt,"x: %d",x+1);
- sprintf(y_txt,"y: %d",y+1);
- sprintf(z_txt,"z: %d",z+1);
+ sprintf(xyz_txt,"x: %d y: %d z: %d",x+1,y+1,z+1);
sprintf(status_txt,"status: %c",(*(d3_l.status+x+y*d3_l.max_x+z*d3_l.max_x*d3_l.max_y)&AMORPH)?'a':'c');
sprintf(conc_txt,"conc: %d",*(d3_l.extra+x+y*d3_l.max_x+z*d3_l.max_x*d3_l.max_y));
strcpy(steps_txt,"step: end!");