added configure + decker.ttf, small fix in nlsop.c
[physik/nlsop.git] / nlsop.c
diff --git a/nlsop.c b/nlsop.c
index 030db9f..736003a 100644 (file)
--- a/nlsop.c
+++ b/nlsop.c
@@ -79,7 +79,7 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int
  p*=*conc;
  if(!(*thiz&AMORPH))
  {
-  if(rand_get(URAND_MAX)<=p)
+  if(get_rand(URAND_MAX)<=p)
   {
    MAKE_AMORPH(thiz);
    *t_c=*t_c+1-*conc;
@@ -87,7 +87,7 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int
  } else
  {
   /* assume 1-p probability */
-  if(rand_get(URAND_MAX)>p)
+  if(get_rand(URAND_MAX)>p)
   {
    MAKE_CRYST(thiz);
    *t_c=*t_c+1+*conc;
@@ -138,13 +138,14 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b)
   left=(int)(((i+1)*a+b)*t_c/sum)%area_h[i];
   while(left)
   {
-  x=get_rand(d3_l->max_x);
-  y=get_rand(d3_l->max_y);
-  if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH))
-  {
-   *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1;
-   total+=1;
-   left-=1;
+   x=get_rand(d3_l->max_x);
+   y=get_rand(d3_l->max_y);
+   if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH))
+   {
+    *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1;
+    total+=1;
+    left-=1;
+   }
   }
  }
  left=t_c-total;
@@ -270,6 +271,8 @@ int main(int argc,char **argv)
  b_ap=B_AP;
  cc=CC;
  nowait=0;
+ quit=0;
+ escape=0;
  strcpy(s_file,"");
  strcpy(l_file,"");
  strcpy(r_file,"");
@@ -381,9 +384,9 @@ int main(int argc,char **argv)
  {
   while((i<steps) && (quit==0) && (escape==0))
   {
-   x_c=rand_get(d3_l.max_x);
-   y_c=rand_get(d3_l.max_y);
-   z_c=rand_get_lgp(d3_l.max_z,a_el,b_el);
+   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,a_el,b_el);
    distrib_c(&d3_l,cc,a_cd,b_cd);
    process_cell(&d3_l,x_c,y_c,z_c,range,a_ap,b_ap,&cc);
    if(i%refresh==0)
@@ -408,10 +411,12 @@ int main(int argc,char **argv)
     d3_lattice_draw(&d3_l,x,y,z,10,arg_v);
     scan_event(&d3_l,&x,&y,&z,&quit,&escape);
    }
-   ++i;
+   i++;
   }
  }
 
+ if(strcmp(s_file,"")) save_to_file(s_file,&d3_l);
+
  while((quit==0) && (escape==0) && (nowait==0))
  {
   sprintf(x_txt,"x: %d",x);