simplify through using {fmt}

This commit is contained in:
Axel Kohlmeyer
2020-06-17 01:25:22 -04:00
parent 32c1dcf44f
commit d990c1e7c0

View File

@ -2507,31 +2507,21 @@ int AtomVec::process_fields(char *str, const char *default_str, Method *method)
for (match = 0; match < nperatom; match++) for (match = 0; match < nperatom; match++)
if (strcmp(field, peratom[match].name) == 0) break; if (strcmp(field, peratom[match].name) == 0) break;
if (match == nperatom) { if (match == nperatom)
char str[128]; error->all(FLERR,fmt::format("Peratom field {} not recognized", field));
sprintf(str,"Peratom field %s not recognized", field);
error->all(FLERR,str);
}
index[i] = match; index[i] = match;
// error if field appears multiple times // error if field appears multiple times
for (match = 0; match < i; match++) for (match = 0; match < i; match++)
if (index[i] == index[match]) { if (index[i] == index[match])
char str[128]; error->all(FLERR,fmt::format("Peratom field {} is repeated", field));
sprintf(str,"Peratom field %s is repeated", field);
error->all(FLERR,str);
}
// error if field is in default str // error if field is in default str
for (match = 0; match < ndef; match++) for (match = 0; match < ndef; match++)
if (strcmp(field, def_words[match].c_str()) == 0) { if (strcmp(field, def_words[match].c_str()) == 0)
char str[128]; error->all(FLERR,fmt::format("Peratom field {} is a default", field));
sprintf(str,"Peratom field %s is a default", field);
error->all(FLERR,str);
}
} }
method->index = index; method->index = index;