From 53c3c379eeffe5029987baee26e8a93927527632 Mon Sep 17 00:00:00 2001 From: hackbard Date: Sun, 13 Sep 2009 16:06:01 +0200 Subject: [PATCH] added average feature (needs to get extended) --- vasp_tools/pc_calc.c | 85 +++++++++++++++++++++++--------------------- vasp_tools/pc_script | 23 ++++++++---- 2 files changed, 61 insertions(+), 47 deletions(-) diff --git a/vasp_tools/pc_calc.c b/vasp_tools/pc_calc.c index 10275d2..f37506f 100644 --- a/vasp_tools/pc_calc.c +++ b/vasp_tools/pc_calc.c @@ -47,28 +47,61 @@ int main(int argc,char **argv) { t_atom *atom; double *aslot,*bslot,*cslot; - int acnt,bcnt,ccnt,cnt,count,slots; + int cnt,count,fcnt,slots; int fd; char buf[256],*wptr; int i,j,k; double dx2,dy2,dz2,dist,norm; double sx,sy,sz; - if(argc!=5) { - printf("usage: %s file sx sy sz\n",argv[0]); + atom=NULL; + + if(argc<5) { + printf("usage: %s sx sy sz file1 file2 ...\n",argv[0]); return -1; } - fd=open(argv[1],O_RDONLY); + sx=atof(argv[1]); + sy=atof(argv[2]); + sz=atof(argv[3]); + + // prepare pc + + slots=MAXR/DELTA; + aslot=malloc(slots*sizeof(double)); + if(aslot==NULL) { + perror("slot a\n"); + return -1; + } + memset(aslot,0,slots*sizeof(double)); + bslot=malloc(slots*sizeof(double)); + if(bslot==NULL) { + perror("slot a\n"); + return -1; + } + memset(bslot,0,slots*sizeof(double)); + cslot=malloc(slots*sizeof(double)); + if(cslot==NULL) { + perror("slot a\n"); + return -1; + } + memset(cslot,0,slots*sizeof(double)); + + printf("i: allocated 3 times %d slots ...\n",slots); + + // use all given files ... + printf("using files:\n"); + for(fcnt=4;fcnt reading in sx sy and sz is not correct ..." echo "WARNING !!!!" echo -line=`sed -n -e '/length of/,/FORCES/p' $1/OUTCAR | grep ^\ \ \ | tail -1` +line=`sed -n -e '/length of/,/FORCES/p' $1/OUTCAR${app} | \ + grep ^\ \ \ | tail -1` sx=`echo $line | awk '{ print $1 }'` sy=`echo $line | awk '{ print $2 }'` sz=`echo $line | awk '{ print $3 }'` -file=`ls $1/video/atomic_conf*.xyz | tail -1` +if [ -z $2 ] ; then + files=`ls $1/video/atomic_conf*.xyz | tail -1` +else + files=`ls $1/video${app}/atomic_conf*.xyz` +fi -echo "running on $file using $sx $sy $sz ..." +echo "running on $files using $sx $sy $sz ..." -./pc_calc $file $sx $sy $sz | grep ^pc | \ +#./pc_calc $sx $sy $sz $files +./pc_calc $sx $sy $sz $files | grep ^pc | \ awk '{ print $2 " " $3 " " $4 " "$5 }' > pc.txt echo "done" -- 2.39.2