implemented saturation value of carbon in amorph cells
[physik/nlsop.git] / nlsop.c
diff --git a/nlsop.c b/nlsop.c
index da983b3..07313e4 100644 (file)
--- a/nlsop.c
+++ b/nlsop.c
@@ -80,6 +80,7 @@ int usage(void)
  puts("-P <file> \t specify implantation profile file");
  puts("-N <file> \t specify nuclear energy loss profile file");
  printf("-H <value> \t collisions per ion in simulation window (default %d)\n",CPI);
+ puts("-m <value> \t specify c->a carbon saturation");
  
  return 1;
 }
@@ -150,7 +151,7 @@ int distrib_c(d3_lattice *d3_l,info *my_info,int step,double c_ratio,u32 rj_m,u3
    {
     offset=i+j*d3_l->max_x+k*d3_l->max_x*d3_l->max_y;
     /* case amorph: amorph <- cryst diffusion */
-    if(*(d3_l->status+offset)&AMORPH)
+    if(*(d3_l->status+offset)&AMORPH && *(d3_l->extra+offset)<my_info->c_sat)
     {
      for(c=-1;c<=1;c++)
      {
@@ -335,7 +336,7 @@ int calc_max_extra(d3_lattice *d3_l)
 int write_ac_distr(d3_lattice *d3_l,int ac_distr)
 {
  int fd,x,y,z;
- int count=0,offset;
+ int count,offset;
  char file[16];
 
  if(ac_distr==1) strcpy(file,"a.plot");
@@ -350,6 +351,7 @@ int write_ac_distr(d3_lattice *d3_l,int ac_distr)
 
  for(z=0;z<d3_l->max_z;z++)
  {
+  count=0;
   for(x=0;x<d3_l->max_x;x++)
   {
    for(y=0;y<d3_l->max_y;y++)
@@ -828,6 +830,7 @@ int main(int argc,char **argv)
  my_info.dr_cc=DR_CC;
  my_info.diff_rate=DIFF_RATE;
  my_info.cpi=CPI;
+ my_info.c_sat=C_SAT;
  nowait=0;
  quit=0;
  escape=0;
@@ -941,6 +944,9 @@ int main(int argc,char **argv)
     case 'H':
      my_info.cpi=atoi(argv[++i]);
      break;
+    case 'm':
+     my_info.c_sat=atoi(argv[++i]);
+     break;
     default:
      usage();
      return -1;
@@ -1006,12 +1012,12 @@ int main(int argc,char **argv)
  sprintf(s_txt,"steps: %d",my_info.steps);
  sprintf(dose_txt,"dose: %.2fe+17 C/cm²",my_info.steps*1.0/(d3_l.max_x*d3_l.max_y*CELL_LENGTH*CELL_LENGTH*1000));
  sprintf(r_txt,"pressure range: %d",my_info.range);
- sprintf(ap_txt,"a_ap: %.4f  b_ap: %.3f",my_info.a_ap,my_info.b_ap);
- sprintf(el_txt,"a_el: %.3f  b_el: %.3f",my_info.a_el,my_info.b_el);
- sprintf(cd_txt,"a_cd: %.3f  b_cd: %.3f",my_info.a_cd,my_info.b_cd);
- sprintf(cp_txt,"a_cp: %.5f",my_info.a_cp);
- sprintf(dr_ac_txt,"a/c diffusion rate: %.4f",my_info.dr_ac);
- if(my_info.c_diff!=0) sprintf(dr_cc_txt,"c/c diffusion rate: %.4f",my_info.dr_cc);
+ sprintf(ap_txt,"a_ap: %f  b_ap: %f",my_info.a_ap,my_info.b_ap);
+ sprintf(el_txt,"a_el: %f  b_el: %f",my_info.a_el,my_info.b_el);
+ sprintf(cd_txt,"a_cd: %f  b_cd: %f",my_info.a_cd,my_info.b_cd);
+ sprintf(cp_txt,"a_cp: %f",my_info.a_cp);
+ sprintf(dr_ac_txt,"a/c diffusion rate: %f",my_info.dr_ac);
+ if(my_info.c_diff!=0) sprintf(dr_cc_txt,"c/c diffusion rate: %f",my_info.dr_cc);
  else sprintf(dr_cc_txt,"c/c diffusion rate: none");
  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);