vaspposcarplugin.c (pymol-v1.8.6.0.tar.bz2) | : | vaspposcarplugin.c (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 77 | skipping to change at line 77 | |||
/* Read title line */ | /* Read title line */ | |||
fgets(lineptr, LINESIZE, data->file); | fgets(lineptr, LINESIZE, data->file); | |||
data->titleline = strdup(lineptr); | data->titleline = strdup(lineptr); | |||
/* Ignore rest of header up to the line with atom numbers */ | /* Ignore rest of header up to the line with atom numbers */ | |||
for (i = 0; i < 5; ++i) fgets(lineptr, LINESIZE, data->file); | for (i = 0; i < 5; ++i) fgets(lineptr, LINESIZE, data->file); | |||
/* Read the number of atoms per atom type */ | /* Read the number of atoms per atom type */ | |||
data->numatoms = 0; | data->numatoms = 0; | |||
for (i = 0; i < MAXATOMTYPES; ++i) { | for (i = 0; i < MAXATOMTYPES; ++i) { | |||
char const *tmplineptr = strdup(lineptr); | char const *tmplineptr = lineptr; | |||
char const *token = (i == 0 ? strtok(lineptr, " ") : strtok(NULL, " ")); | char const *token = (i == 0 ? strtok(lineptr, " ") : strtok(NULL, " ")); | |||
int const n = (token ? atoi(token) : -1); | int const n = (token ? atoi(token) : -1); | |||
/* if fails to read number of atoms, then assume VASP5 */ | /* if fails to read number of atoms, then assume VASP5 */ | |||
if (i == 0 && n <= 0) { | if (i == 0 && n <= 0) { | |||
data->version = 5; | data->version = 5; | |||
free(data->titleline); | ||||
data->titleline = strdup(tmplineptr); | data->titleline = strdup(tmplineptr); | |||
fgets(lineptr, LINESIZE, data->file); | fgets(lineptr, LINESIZE, data->file); | |||
break; | break; | |||
}else if (n <= 0) break; | }else if (n <= 0) break; | |||
data->eachatom[i] = n; | data->eachatom[i] = n; | |||
data->numatoms += n; | data->numatoms += n; | |||
} | } | |||
if (data->version == 5) { | if (data->version == 5) { | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |