#include #include #include #include #define NS 300 #define NA 1000 double x[NA],y[NA],z[NA], x2[NA],y2[NA],z2[NA],x3[NA],y3[NA],z3[NA],q[NA],q2[NA],q3[NA]; char an[NA][10],an2[NA][10]; FILE *f1, *f2, *f3; char s[NS],fn1[NS],fn2[NS],fn3[NS],str[]="Electrostatic Properties Using The SCF Density"; int na,k,na2; main(int ks, char *ss[]) { //printf("ks=%d\n",ks); if(ks<2) {printf("Add a file name of the output g03 file to the command string!\n"); exit(1);} strcpy(fn1,ss[1]); if((f1=fopen(fn1,"rt"))==NULL){printf("Can not open %s file to read!\n",fn1);exit(1);} //printf("%s file is opened!\n",fn1); if(ks<3) {printf("Add an another output g03 file to the command string!\n"); exit(1);} strcpy(fn2,ss[2]); if((f2=fopen(fn2,"rt"))==NULL){printf("Can not open %s file to read!\n",fn2);exit(1);} //printf("%s file is opened!\n",fn2); while(!feof(f1)) { fgets(s,NS,f1); if(feof(f1) )break; if(strstr(s,str)!=NULL) { /*printf("%s",s);*/ fgets(s,NS,f1); /*printf("%s",s);*/ if(feof(f1) )break; fgets(s,NS,f1); /*printf("%s",s);*/ if(feof(f1) )break; fgets(s,NS,f1); /*printf("%s",s);*/ if(feof(f1) )break; int i=0; while(!feof(f1)) { fgets(s,NS,f1); /*printf("%s",s);*/ if(feof(f1) )break; if(strstr(s,"Atomic Center")==NULL) break; sscanf(s+31, "%lg %lg %lg", &x[i],&y[i],&z[i]); /*printf("%s",s);*/ //printf("%g %g %g\n",x[i],y[i],z[i]); i++; } //printf("%d\n",i); na=i; fgets(s,NS,f1); /*printf("%s",s);*/ if(feof(f1) )break; fgets(s,NS,f1); /*printf("%s",s);*/ if(feof(f1) )break; fgets(s,NS,f1); /*printf("%s",s);*/ if(feof(f1) )break; fgets(s,NS,f1); /*printf("%s",s);*/ if(feof(f1) )break; for(int i=0;iq3[i]){dmin=q3[i];imin=i;} if(dmax