GLYLIB
0.3.0b
|
00001 void outputMolPDB(molecule* mol, char* file_name) 00002 { 00003 char current_line[80] = ""; char temporary[40] = ""; 00004 char* curLine = current_line; char* temp = temporary; 00005 char* resName; char* atmName; 00006 file = myfopen(file_name,"w"); 00007 for(i = 0; i < resTot; i++) 00008 { 00009 resName = (*((*mol).r+i)).N; 00010 resNum = (*((*mol).r+i)).n; 00011 atmTot = (*((*mol).r+i)).na; 00012 for(j = 0; j < atmTot; j++) 00013 { 00014 curAtm = (*((*((*mol).r+i)).a+j)); 00015 atmName = curAtm.N; 00016 strcpy(curLine,""); 00017 strcat(curLine,"ATOM"); 00018 00019 sprintf(temp,"%d", curAtm.n); 00020 //Based on how large the atom # is, depends on the # of spaces 00021 strcat(curLine,spacing(strlen(temp),7)); 00022 //"ATOM atom# atom_name" 00023 sprintf(temp,"%d %s", curAtm.n, atmName); 00024 strcat(curLine,temp); 00025 00026 //Based on how many char are in the residue name, " " spaces 00027 strcat(curLine,spacing(strlen(atmName),4)); 00028 //"ATOM atom# atom_name res_name" 00029 strcat(curLine,resName); 00030 00031 sprintf(temp,"%d",resNum); 00032 //Based on how large the residue # is, " " spaces 00033 strcat(curLine,spacing(strlen(temp),6)); 00034 //"ATOM atom# atom_name res_name res#" 00035 strcat(curLine,temp); 00036 00037 sprintf(temp,"%.3lf",curAtm.x.i); 00038 //Based on how large the x cordinate is, " " spaces 00039 strcat(curLine,spacing(strlen(temp),12)); 00040 //"ATOM atom# atom_name res_name x" 00041 strcat(curLine,temp); 00042 00043 sprintf(temp,"%.3lf",curAtm.x.j); 00044 //Based on how large the y cordinate is, " " spaces 00045 strcat(curLine,spacing(strlen(temp),8)); 00046 //"ATOM atom# atom_name res_name x y" 00047 strcat(curLine,temp); 00048 00049 sprintf(temp,"%.3lf",curAtm.x.k); 00050 //Based on how large the z cordinate is, " " spaces 00051 strcat(curLine,spacing(strlen(temp),8)); 00052 //"ATOM atom# atom_name res_name x y z 1.00 0.00" 00053 sprintf(temp,"%.3lf 1.00 0.00",curAtm.x.k); 00054 strcat(curLine,temp); 00055 00056 //Output the line to the new .pbd file 00057 fprintf(file,"%s\n",curLine); 00058 } 00059 } 00060 fclose(file); 00061 }