From: hackbard Date: Thu, 5 Aug 2004 14:32:32 +0000 (+0000) Subject: plot in atom percentage X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05932e953d5a9c5c83c608a9c26c3d542b46fe63;p=physik%2Fnlsop.git plot in atom percentage --- diff --git a/dfbapi.c b/dfbapi.c index 2f3639e..18cf9cc 100644 --- a/dfbapi.c +++ b/dfbapi.c @@ -377,6 +377,7 @@ int scan_event(d3_lattice *d3_l,int *x,int *y,int *z,int *q,int *esc,int *switch if(ke.key_id==DIKI_A) *ac_distr=1; if(ke.key_id==DIKI_C) *ac_distr=2; if(ke.key_id==DIKI_B) *ac_distr=3; + if(ke.key_id==DIKI_X) *ac_distr=4; } return 1; diff --git a/nlsop.c b/nlsop.c index 7463054..7f7f92c 100644 --- 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); diff --git a/nlsop.h b/nlsop.h index 3231cb7..971a018 100644 --- a/nlsop.h +++ b/nlsop.h @@ -50,7 +50,8 @@ typedef struct __info #define CPI 20 -#define C_SAT (6*6*6*8) +#define C_SAT (168*8) +#define SI_PER_VOLUME (168*8) #define FFT_HEIGHT 64