always return initialized data when extracting per-type info

This commit is contained in:
Axel Kohlmeyer
2024-06-18 06:58:26 -04:00
parent 82b86031ef
commit c3c72a3bff

View File

@ -691,24 +691,28 @@ void *PairReaxFF::extract(const char *str, int &dim)
{
dim = 1;
if (strcmp(str,"chi") == 0 && chi) {
chi[0] = 0.0;
for (int i = 1; i <= atom->ntypes; i++)
if (map[i] >= 0) chi[i] = api->system->reax_param.sbp[map[i]].chi;
else chi[i] = 0.0;
return (void *) chi;
}
if (strcmp(str,"eta") == 0 && eta) {
eta[0] = 0.0;
for (int i = 1; i <= atom->ntypes; i++)
if (map[i] >= 0) eta[i] = api->system->reax_param.sbp[map[i]].eta;
else eta[i] = 0.0;
return (void *) eta;
}
if (strcmp(str,"gamma") == 0 && gamma) {
gamma[0] = 0.0;
for (int i = 1; i <= atom->ntypes; i++)
if (map[i] >= 0) gamma[i] = api->system->reax_param.sbp[map[i]].gamma;
else gamma[i] = 0.0;
return (void *) gamma;
}
if (strcmp(str,"bcut_acks2") == 0 && bcut_acks2) {
bcut_acks2[0] = 0.0;
for (int i = 1; i <= atom->ntypes; i++)
if (map[i] >= 0) bcut_acks2[i] = api->system->reax_param.sbp[map[i]].bcut_acks2;
else bcut_acks2[i] = 0.0;