]> hackdaworld.org Git - physik/nlsop.git/commitdiff
changes in ballistic term & checking for p before getting random value
authorhackbard <hackbard>
Tue, 25 Jan 2005 18:40:45 +0000 (18:40 +0000)
committerhackbard <hackbard>
Tue, 25 Jan 2005 18:40:45 +0000 (18:40 +0000)
nlsop_client.c

index 382cadd765ae347aff529be233bdb4aa2eca4a90..f7938edad2338adb684716f5ce5a375211025ba6 100644 (file)
@@ -111,7 +111,8 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,info *my_info,u32 nel_z)
 
  thiz=d3_l->status+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y;
  conc=d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y;
- p=my_info->b*nel_z;
+ //p=my_info->b*nel_z; // energieuebertrag prop zu nukl. bk
+ p=my_info->b*URAND_MAX; // konstanter energieuebertrag
  for(i=-(my_info->range);i<=my_info->range;i++)
  {
   for(j=-(my_info->range);j<=my_info->range;j++)
@@ -124,24 +125,28 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,info *my_info,u32 nel_z)
   }
  }
  p+=*conc*my_info->c*URAND_MAX;
- if(!(*thiz&AMORPH))
- {
-  if(get_rand(URAND_MAX)<=p) MAKE_AMORPH(thiz);
- } else
- {
-  /* assume 1-p probability */
-  /* also look for neighbours ! */
-  q=(URAND_MAX-p)>0?URAND_MAX-p:0;
-  j=0;
-  j+=(*(d3_l->status+((x+d3_l->max_x+1)%d3_l->max_x)+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
-  j+=(*(d3_l->status+((x+d3_l->max_x-1)%d3_l->max_x)+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
-  j+=(*(d3_l->status+x+((y+1+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
-  j+=(*(d3_l->status+x+((y-1+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
-  j+=(*(d3_l->status+x+y*d3_l->max_x+((z+1+d3_l->max_z)%d3_l->max_z)*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
-  j+=(*(d3_l->status+x+y*d3_l->max_x+((z-1+d3_l->max_z)%d3_l->max_z)*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
-
-  p+=((q/6)*j);
-  if(get_rand(URAND_MAX)>p) MAKE_CRYST(thiz);
+ if(p>=URAND_MAX) MAKE_AMORPH(thiz);
+ else {
+  if(!(*thiz&AMORPH)) {
+   if(get_rand(URAND_MAX)<=p) MAKE_AMORPH(thiz);
+  }
+  else {
+   /* assume 1-p probability */
+   /* also look for neighbours ! */
+   q=(URAND_MAX-p)>0?URAND_MAX-p:0;
+   j=0;
+   j+=(*(d3_l->status+((x+d3_l->max_x+1)%d3_l->max_x)+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
+   j+=(*(d3_l->status+((x+d3_l->max_x-1)%d3_l->max_x)+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
+   j+=(*(d3_l->status+x+((y+1+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
+   j+=(*(d3_l->status+x+((y-1+d3_l->max_y)%d3_l->max_y)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
+   j+=(*(d3_l->status+x+y*d3_l->max_x+((z+1+d3_l->max_z)%d3_l->max_z)*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
+   j+=(*(d3_l->status+x+y*d3_l->max_x+((z-1+d3_l->max_z)%d3_l->max_z)*d3_l->max_x*d3_l->max_y)&AMORPH)?1:0;
+   p+=((q/6)*j);
+   if(p<=URAND_MAX) {
+    if(get_rand(URAND_MAX)>p) MAKE_CRYST(thiz);
+   }
+  }
  }
  
  return 1;
@@ -524,11 +529,8 @@ int get_data_and_calc(t_event *event,void *allineed) {
     for(j=0;j<my_info.cpi;j++) {
       x_c=get_rand(d3_l.max_x);
       y_c=get_rand(d3_l.max_y);
-#ifdef NEL_Z
       z_c=get_rand_reject(d3_l.max_z,ne_max,n_e_loss);
-#else
-      z_c=get_rand(d3_l.max_z);
-#endif
+      //z_c=get_rand(d3_l.max_z);
       process_cell(&d3_l,x_c,y_c,z_c,&my_info,nel_z[z_c]);
     }
     distrib_c(&d3_l,&my_info,i,ip_max,c_profile);