From: hackbard Date: Fri, 7 Aug 2009 12:04:08 +0000 (+0200) Subject: feature to fix atoms at x=0 or y=0 or z=0 X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f1d51c4fc5fa63f84668316fde538f77de17a6b7;p=physik%2Fposic.git feature to fix atoms at x=0 or y=0 or z=0 --- diff --git a/vasp_tools/create_lattice.c b/vasp_tools/create_lattice.c index 6232cdf..658fdb4 100644 --- a/vasp_tools/create_lattice.c +++ b/vasp_tools/create_lattice.c @@ -50,12 +50,13 @@ int main(int argc,char **argv) { t_3dvec o[3]; t_3dvec dia; t_3dvec r,h; - char type,fccdia; + char type,fccdia,foa,fixstr[6]; - if(argc!=6) { + if(argc<6) { printf("usage: %s type fcc/dia lx ly lz\n",argv[0]); printf(" basis types: 0, 1, 2 (see code)\n"); printf(" fcc/dia: 0=fcc, 1=dia\n"); + printf(" optional: foa (fix outer atoms)\n"); return -1; } @@ -66,6 +67,10 @@ int main(int argc,char **argv) { y=atoi(argv[4]); z=atoi(argv[5]); + foa=0; + if(argc==7) + foa=1; + dia.x=0.25; dia.y=0.25; dia.z=0.25; @@ -145,13 +150,19 @@ int main(int argc,char **argv) { r.x=i; r.y=j; r.z=k; - - printf(" %.5f %.5f %.5f T T T\n",r.x/x,r.y/y,r.z/z); + + strcpy(fixstr,"T T T"); + if(((r.x==0)||(r.y==0)||(r.z==0))&foa) + strcpy(fixstr,"F F F"); + printf(" %.5f %.5f %.5f %s\n",r.x/x,r.y/y,r.z/z,fixstr); cnt+=1; // second atom (type 1) if(type=='1') { v3_add(&h,&r,&(o[0])); + strcpy(fixstr,"T T T"); + if(((h.x==0)||(h.y==0)||(h.z==0))&foa) + strcpy(fixstr,"F F F"); printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z); cnt+=1; } @@ -160,6 +171,9 @@ int main(int argc,char **argv) { if(type=='2') { for(l=0;l<3;l++) { v3_add(&h,&r,&(o[l])); + strcpy(fixstr,"T T T"); + if(((h.x==0)||(h.y==0)||(h.z==0))&foa) + strcpy(fixstr,"F F F"); printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z); cnt+=1; } @@ -184,12 +198,18 @@ int main(int argc,char **argv) { // add the diagonal v3_add(&r,&r,&dia); + strcpy(fixstr,"T T T"); + if(((r.x==0)||(r.y==0)||(r.z==0))&foa) + strcpy(fixstr,"F F F"); printf(" %.5f %.5f %.5f T T T\n",r.x/x,r.y/y,r.z/z); cnt+=1; // second atom (type 1) if(type=='1') { v3_add(&h,&r,&(o[0])); + strcpy(fixstr,"T T T"); + if(((h.x==0)||(h.y==0)||(h.z==0))&foa) + strcpy(fixstr,"F F F"); printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z); cnt+=1; } @@ -198,6 +218,9 @@ int main(int argc,char **argv) { if(type=='2') { for(l=0;l<3;l++) { v3_add(&h,&r,&(o[l])); + strcpy(fixstr,"T T T"); + if(((h.x==0)||(h.y==0)||(h.z==0))&foa) + strcpy(fixstr,"F F F"); printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z); cnt+=1; }