/*********************************************************************/ /*Program: elect */ /*Author: Ting Wang */ /*Email: ting.wang@embl-heidelberg.de */ /*Institution: European Molecular Biology Laboratory */ /*Date: Feb, 2001 */ /*Purpose: calculate the elec energy between the inhibitor and each protein*/ /*residue and the total elec energy between the inhibitor and the protein*/ /*for use in UHBD */ /*COMPILATION: cc -o elect elect.c -lm */ /*USAGE: >elect input_file1 input_file2 output_file */ /*EXAMPLE: >elect complex.phi protein.qcd complex.elect */ #include #include int main ( int argc, /* Number of args */ char ** argv) /* Arg list */ { FILE *fin1,*fin2,*fout; char line1[120],line2[120]; float c,phi,sum=0.0,total=0.0; int nres,oldnres=1; /* fin1: phi.out , fin2: oppa.qcd */ if((fin1 = fopen(argv[1] , "r"))==NULL) {printf("Input file 1 can not be opened .\n");exit(0);} if((fin2 = fopen(argv[2] , "r"))==NULL) {printf("Input file 2 can not be opened .\n");exit(0);} if((fout = fopen(argv[3], "w"))==NULL) {printf("OUT File can not be written .\n");exit(0);} while(fgets(line1,100,fin1)){ sscanf(line1+20,"%d",);/* get the res number */ sscanf(line1+62,"%g",); /* get the phi value */ fgets(line2,100,fin2); sscanf(line2+45,"%f",); /* get the bn atomic charge */ if (nres > oldnres) { fprintf(fout,"%4d %12.6f\n",oldnres,sum); total=total+sum;sum=0.0; oldnres=nres; } sum+=phi*c; }/*end of while line1 */ fprintf(fout,"%d %12.6f\n",nres,sum); total=total+sum; fprintf(fout,"total elect energy is %g\n",total); fclose(fin1); fclose(fin2); fclose(fout); return(1); }