This commit is contained in:
Axel Kohlmeyer
2022-08-11 09:46:34 -04:00
parent 0b38cbea2d
commit 0e2b51010c
2 changed files with 10 additions and 33 deletions

View File

@ -4841,6 +4841,7 @@ set to an empty string, otherwise 1.
*/
int lammps_id_name(void *handle, const char *category, int idx, char *buffer, int buf_size) {
auto lmp = (LAMMPS *) handle;
if (idx < 0) return 0;
if (strcmp(category,"compute") == 0) {
auto icompute = lmp->modify->get_compute_by_index(idx);
@ -4849,8 +4850,9 @@ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, in
return 1;
}
} else if (strcmp(category,"dump") == 0) {
if ((idx >=0) && (idx < lmp->output->ndump)) {
strncpy(buffer, lmp->output->dump[idx]->id, buf_size);
auto idump = lmp->output->get_dump_by_index(idx);
if (idump) {
strncpy(buffer, idump->id, buf_size);
return 1;
}
} else if (strcmp(category,"fix") == 0) {