handle exceptions in destructors
This commit is contained in:
@ -160,7 +160,12 @@ FixChargeRegulation::~FixChargeRegulation() {
|
||||
|
||||
if (exclusion_group_bit && group) {
|
||||
auto group_id = std::string("FixChargeRegulation:gcmc_exclusion_group:") + id;
|
||||
group->assign(group_id + " delete");
|
||||
try {
|
||||
group->assign(group_id + " delete");
|
||||
} catch (std::exception &e) {
|
||||
if (comm->me == 0)
|
||||
fprintf(stderr, "Error deleting group %s: %s\n", group_id.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if (group) {
|
||||
|
||||
@ -427,12 +427,22 @@ FixGCMC::~FixGCMC()
|
||||
|
||||
if (exclusion_group_bit && group) {
|
||||
auto group_id = std::string("FixGCMC:gcmc_exclusion_group:") + id;
|
||||
group->assign(group_id + " delete");
|
||||
try {
|
||||
group->assign(group_id + " delete");
|
||||
} catch (std::exception &e) {
|
||||
if (comm->me == 0)
|
||||
fprintf(stderr, "Error deleting group %s: %s\n", group_id.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if (molecule_group_bit && group) {
|
||||
auto group_id = std::string("FixGCMC:rotation_gas_atoms:") + id;
|
||||
group->assign(group_id + " delete");
|
||||
try {
|
||||
group->assign(group_id + " delete");
|
||||
} catch (std::exception &e) {
|
||||
if (comm->me == 0)
|
||||
fprintf(stderr, "Error deleting group %s: %s\n", group_id.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if (full_flag && group && neighbor) {
|
||||
|
||||
@ -255,12 +255,22 @@ FixWidom::~FixWidom()
|
||||
|
||||
if (exclusion_group_bit && group) {
|
||||
auto group_id = std::string("FixWidom:widom_exclusion_group:") + id;
|
||||
group->assign(group_id + " delete");
|
||||
try {
|
||||
group->assign(group_id + " delete");
|
||||
} catch (std::exception &e) {
|
||||
if (comm->me == 0)
|
||||
fprintf(stderr, "Error deleting group %s: %s\n", group_id.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if (molecule_group_bit && group) {
|
||||
auto group_id = std::string("FixWidom:rotation_gas_atoms:") + id;
|
||||
group->assign(group_id + " delete");
|
||||
try {
|
||||
group->assign(group_id + " delete");
|
||||
} catch (std::exception &e) {
|
||||
if (comm->me == 0)
|
||||
fprintf(stderr, "Error deleting group %s: %s\n", group_id.c_str(), e.what());
|
||||
}
|
||||
}
|
||||
|
||||
if (full_flag && group && neighbor) {
|
||||
|
||||
Reference in New Issue
Block a user