Fix reading empty type label string in restart

This commit is contained in:
k-harris27
2024-07-31 10:02:04 +01:00
parent a54e67bf1c
commit 9c9fac49d7

View File

@ -369,35 +369,35 @@ void LabelMap::read_restart(FILE *fp)
for (int i = 0; i < natomtypes; i++) {
charlabel = read_string(fp);
typelabel[i] = charlabel;
typelabel_map[charlabel] = i + 1;
if (strlen(charlabel) > 0) typelabel_map[charlabel] = i + 1;
delete[] charlabel;
}
for (int i = 0; i < nbondtypes; i++) {
charlabel = read_string(fp);
btypelabel[i] = charlabel;
btypelabel_map[charlabel] = i + 1;
if (strlen(charlabel) > 0) btypelabel_map[charlabel] = i + 1;
delete[] charlabel;
}
for (int i = 0; i < nangletypes; i++) {
charlabel = read_string(fp);
atypelabel[i] = charlabel;
atypelabel_map[charlabel] = i + 1;
if (strlen(charlabel) > 0) atypelabel_map[charlabel] = i + 1;
delete[] charlabel;
}
for (int i = 0; i < ndihedraltypes; i++) {
charlabel = read_string(fp);
dtypelabel[i] = charlabel;
dtypelabel_map[charlabel] = i + 1;
if (strlen(charlabel) > 0) dtypelabel_map[charlabel] = i + 1;
delete[] charlabel;
}
for (int i = 0; i < nimpropertypes; i++) {
charlabel = read_string(fp);
itypelabel[i] = charlabel;
itypelabel_map[charlabel] = i + 1;
if (strlen(charlabel) > 0) itypelabel_map[charlabel] = i + 1;
delete[] charlabel;
}
}