1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
while((fgets(s, 256, fp)) != NULL) {
if (strncmp(s, "ATOM ", 6) != 0)
continue;
natoms++ ;
}
atoms = (Atom *) calloc ( natoms, sizeof(Atoms) );
if ( atoms == NULL )
return ERROR ;
fseek ( fp, 0L, 0 );
i = 0 ;
while((fgets(s, 256, fp)) != NULL) {
if (strncmp(s, "ATOM ", 6) != 0)
continue;
strncpy(atom[i].name, s+12, 4);
strncpy(atom[i].res_name, s+17, 3);
atom[i].res_seq = atoi(s+22);
atom[i].x = atof(s+30);
atom[i].y = atof(s+38);
atom[i].z = atof(s+46);
strncpy(atom[i].elt, s+76, 2);
i++ ;
} |
Partager