simplify and avoid direct access to the list of fixes in Modify

This commit is contained in:
Axel Kohlmeyer
2024-01-21 11:50:29 -05:00
parent 5b80899fa4
commit 35124fdef3

View File

@ -501,7 +501,7 @@ void Neighbor::init()
// fixchecklist = other classes that can induce reneighboring in decide()
fixchecklist.clear();
for (auto &ifix : modify->get_fix_list()) {
for (const auto &ifix : modify->get_fix_list()) {
if (ifix->force_reneighbor) {
fixchecklist.push_back(ifix);
must_check = 1;
@ -1596,10 +1596,16 @@ void Neighbor::init_topology()
int bond_off = 0;
int angle_off = 0;
for (i = 0; i < modify->nfix; i++)
if (utils::strmatch(modify->fix[i]->style,"^shake")
|| utils::strmatch(modify->fix[i]->style,"^rattle"))
int dihedral_off = 0;
int improper_off = 0;
for (const auto &ifix : modify->get_fix_list()) {
if (utils::strmatch(ifix->style,"^shake") || utils::strmatch(ifix->style,"^rattle"))
bond_off = angle_off = 1;
if (utils::strmatch(ifix->style,"gcmc"))
bond_off = angle_off = dihedral_off = improper_off = 1;
}
if (force->bond)
if (force->bond->partial_flag)
bond_off = 1;
@ -1620,7 +1626,6 @@ void Neighbor::init_topology()
}
}
int dihedral_off = 0;
if (atom->avec->dihedrals_allow && atom->molecular == Atom::MOLECULAR) {
for (i = 0; i < atom->nlocal; i++) {
if (dihedral_off) break;
@ -1629,7 +1634,6 @@ void Neighbor::init_topology()
}
}
int improper_off = 0;
if (atom->avec->impropers_allow && atom->molecular == Atom::MOLECULAR) {
for (i = 0; i < atom->nlocal; i++) {
if (improper_off) break;
@ -1638,10 +1642,6 @@ void Neighbor::init_topology()
}
}
for (i = 0; i < modify->nfix; i++)
if ((strcmp(modify->fix[i]->style,"gcmc") == 0))
bond_off = angle_off = dihedral_off = improper_off = 1;
// sync on/off settings across all procs
int onoff = bond_off;