int main(int argc, char **argv) { char *filename = "test.pdb"; WHOLEPDB *wpdb; FILE *fp; PDB *pdb1, *pdb2, *p; int natoms; if((fp=fopen(filename, "r"))==NULL) { fprintf(stderr,"Can't open %s\n", filename); return(1); } if(((wpdb=blReadWholePDB(fp))==NULL)||(wpdb->pdb == NULL)) { fprintf(stderr,"Can't read atoms from %s\n", filename); return(1); } fclose(fp); pdb1 = wpdb->pdb; if((pdb2 = blStripHPDBAsCopy(pdb1, &natoms))==NULL) { fprintf(stderr,"Stripping hydrogens failed\n"); return(1); } if(!blCopyConects(pdb2, pdb1)) { fprintf(stderr,"Failed to copy CONECT data\n"); return(1); } printf(">>> Original CONECT data\n"); wpdb->pdb = pdb1; blWriteWholePDBTrailer(stdout, wpdb, 1); /* Reset atom numbers in original list to prove we aren't picking up the old atoms */ for(p=pdb1; p!=NULL; NEXT(p)) p->atnum = 0; printf(">>> New CONECT data\n"); wpdb->pdb = pdb2; blWriteWholePDBTrailer(stdout, wpdb, 1); return(0); }
/*>void WriteWholePDB(FILE *fp, WHOLEPDB *wpdb) -------------------------------------------- *//** \param[in] *fp File pointer \param[in] *wpdb Whole PDB structure pointer Writes a PDB file including header and trailer information - 30.05.02 Original By: ACRM - 21.06.14 Deprecated function. By CTP. - 07.07.14 Use bl prefix for functions. Moved to deprecated.h By: CTP - 31.07.14 Moved to deprecated.c and converted from macro to function. By: CTP - 04.03.15 Changed to use blWritePDBAsPDBorGromos() and to count TER cards */ void WriteWholePDB(FILE *fp, WHOLEPDB *wpdb) { int numTer; DEPRECATED("WriteWholePDB","blWriteWholePDB()"); if((wpdb!=NULL) && (wpdb->pdb!=NULL)) { blWriteWholePDBHeader(fp, wpdb); numTer = blWritePDBAsPDBorGromos(fp, wpdb->pdb, FALSE); blWriteWholePDBTrailer(fp, wpdb, numTer); } }
/*>void WriteWholePDBTrailer(FILE *fp, WHOLEPDB *wpdb) --------------------------------------------------- *//** \param[in] *fp File pointer \param[in] *wpdb Whole PDB structure pointer Writes the trailer of a PDB file - 30.05.02 Original By: ACRM - 21.06.14 Deprecated By: CTP - 07.07.14 Moved to deprecated.h By: CTP - 31.07.14 Moved to deprecated.c and converted from macro to function. By: CTP */ void WriteWholePDBTrailer(FILE *fp, WHOLEPDB *wpdb) { DEPRECATED("WriteWholePDBTrailer()","blWriteWholePDBTrailer()"); blWriteWholePDBTrailer(fp, wpdb, 0); }