plot in atom percentage
[physik/nlsop.git] / nlsop.c
diff --git a/nlsop.c b/nlsop.c
index 7463054..7f7f92c 100644 (file)
--- a/nlsop.c
+++ b/nlsop.c
@@ -341,11 +341,14 @@ int write_ac_distr(d3_lattice *d3_l,int ac_distr)
 {
  int fd,x,y,z;
  int count,offset;
- char file[16];
-
- if(ac_distr==1) strcpy(file,"a.plot");
- if(ac_distr==2) strcpy(file,"c.plot");
- if(ac_distr==3) strcpy(file,"b.plot");
+ char file[32];
+ int si_count;
+ si_count=d3_l->max_x*d3_l->max_y*SI_PER_VOLUME;
+ if(ac_distr==1) strcpy(file,"carbon_in_av.plot");
+ if(ac_distr==2) strcpy(file,"carbon_in_cv.plot");
+ if(ac_distr==3) strcpy(file,"carbon.plot");
+ if(ac_distr==4) strcpy(file,"amorphous_volumes.plot");
 
  if((fd=open(file,O_WRONLY|O_CREAT))<0)
  {
@@ -366,9 +369,12 @@ int write_ac_distr(d3_lattice *d3_l,int ac_distr)
     if(ac_distr==2)
      if(!(*(d3_l->status+offset)&AMORPH)) count+=*(d3_l->extra+offset);
     if(ac_distr==3) count+=*(d3_l->extra+offset);
+    if(ac_distr==4)
+     if(*(d3_l->status+offset)&AMORPH) count+=1;
    }
   }
-  dprintf(fd,"%d %d\n",z,count);
+  if(ac_distr==4) dprintf(fd,"%d %d\n",z*CELL_LENGTH,count);
+  else dprintf(fd,"%d %f\n",z*CELL_LENGTH,100.0*count/si_count);
  }
  close(fd);