]> hackdaworld.org Git - physik/nlsop.git/commitdiff
care for neighbours while recrystalization
authorhackbard <hackbard>
Wed, 28 Jul 2004 17:17:08 +0000 (17:17 +0000)
committerhackbard <hackbard>
Wed, 28 Jul 2004 17:17:08 +0000 (17:17 +0000)
nlsop.c

diff --git a/nlsop.c b/nlsop.c
index 76038765b818560b6ff4d6d0214e922f9835b952..ae629256ef3fb40ee25b56e95d16345d4e0b38c7 100644 (file)
--- a/nlsop.c
+++ b/nlsop.c
@@ -87,11 +87,11 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,info *my_info,u32 nel_z)
  int *conc;
  int i,j;
  int off;
- double p;
+ double p,q;
 
  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_ap*URAND_MAX*nel_z;
+ p=my_info->b_ap*nel_z;
  for(i=-(my_info->range);i<=my_info->range;i++)
  {
   for(j=-(my_info->range);j<=my_info->range;j++)
@@ -110,6 +110,16 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,info *my_info,u32 nel_z)
  } 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);
  }