/*********************************************************************/ /*Program: whatiftopdb */ /*Author: Ting Wang */ /*Email: ting.wang@embl-heidelberg.de */ /*Institution: European Molecular Biology Laboratory */ /*Date: Nov, 2000 */ /*Purpose: convert the WHATIF names of water to pdb format */ /*COMPILATION: cc -o whatiftopdb whatiftopdb.c */ /*USAGE: >whatiftopdb protein.whatif.pdb protein.modif.pdb */ #include #include int main ( int argc, /* Number of args */ char ** argv) /* Arg list */ { FILE *finput,*foutput; char line[120],newline[120]; int mark=0; if((finput = fopen(argv[1] , "r"))==NULL) {printf("Input file can not be opened .\n");exit(0);} if((foutput = fopen(argv[2], "w"))==NULL) {printf("OUT File can not be written .\n");exit(0);} while(fgets(line,100,finput)){/*printf("%s",line);*/ if(strncmp(line+13,"H HOH",7)==0) { strncpy(newline,line,13);newline[13]='\0'; if (mark==0) {strcat(newline,"H1 HOH"); mark=1;} else {strcat(newline,"H2 HOH"); mark=0;} strncat(newline,line+20,46); fprintf(foutput,"%s\n",newline); } else fprintf(foutput,"%s",line); } fclose(finput); fclose(foutput); return(1); }