********> bugfix.56 Author: Bill Ross Date: 11/27/95 Programs: Carnal Severity: Moderate Problem: bugfix.40 for reading PDB files with lines shorter than 80 chars introduced a bug reading lines > 80. Also, this fix allows reading of PDB files with REMARK and other non-atom lines. Fix: Make the following change to util.c: replace routine scanpdb(): ------------------------------------------------------------------------------ int scanpdb(file, xyz) FILE *file; _REAL xyz[]; { int c; /* * get an 'ATOM' or 'HETATM' line */ while (1) { if (fgets(scanbuf, 80, file) == NULL) return(-1); /* * make sure lines > 80 are fully read */ scanbuf[80] = '\0'; if (strchr(scanbuf, '\n') == NULL) { while (1) { /* skip to eoln */ c = getc(file); if ( c == 10 || c == EOF) break; } } scanbuf[78] = '\0'; if (!strncmp(scanbuf, "ATOM", 4)) break; if (!strncmp(scanbuf, "HETATM", 6)) break; } #ifdef DOUBLE if (sscanf(scanbuf+29, "%12lf", &xyz[0]) != 1) return(-2); if (sscanf(scanbuf+38, "%12lf", &xyz[1]) != 1) return(-2); if (sscanf(scanbuf+46, "%12lf", &xyz[2]) != 1) return(-2); #else if (sscanf(scanbuf+29, "%12f", &xyz[0]) != 1) return(-2); if (sscanf(scanbuf+38, "%12f", &xyz[1]) != 1) return(-2); if (sscanf(scanbuf+46, "%12f", &xyz[2]) != 1) return(-2); #endif return(0); } ------------------------------------------------------------------------------ Temporary workarounds: Shorten lines in pdb files to <= 80 and delete all non-atom records from non-AMBER pdb's. --