use references instead of copies when looping over list of selected fixes
This commit is contained in:
@ -136,7 +136,7 @@ ComputeStressCartesian::ComputeStressCartesian(LAMMPS *lmp, int narg, char **arg
|
||||
|
||||
// check for variable box dimension
|
||||
int box_incompatible = 0;
|
||||
for (auto ifix : modify->get_fix_list()) {
|
||||
for (auto &ifix : modify->get_fix_list()) {
|
||||
if (((dir1 == 0) && (ifix->box_change & Fix::BOX_CHANGE_X)) ||
|
||||
((dir1 == 1) && (ifix->box_change & Fix::BOX_CHANGE_Y)) ||
|
||||
((dir1 == 2) && (ifix->box_change & Fix::BOX_CHANGE_Z)))
|
||||
|
||||
@ -120,7 +120,7 @@ void FixDampingCundall::init()
|
||||
}
|
||||
|
||||
bool fflag = false;
|
||||
for (auto ifix : modify->get_fix_list()) {
|
||||
for (auto &ifix : modify->get_fix_list()) {
|
||||
if (fflag && (comm->me == 0) && (ifix->setmask() & POST_FORCE))
|
||||
error->warning(FLERR, "Fix {} alters forces after fix damping/cundall", ifix->id);
|
||||
if (ifix == this) fflag = true;
|
||||
|
||||
@ -83,7 +83,7 @@ void FixNVTSllodIntel::init()
|
||||
auto deform = modify->get_fix_by_style("^deform");
|
||||
if (deform.size() < 1) error->all(FLERR,"Using fix nvt/sllod/intel with no fix deform defined");
|
||||
|
||||
for (auto ifix : deform) {
|
||||
for (auto &ifix : deform) {
|
||||
auto f = dynamic_cast<FixDeform *>(ifix);
|
||||
if (f && (f->remapflag != Domain::V_REMAP))
|
||||
error->all(FLERR,"Using fix nvt/sllod/intel with inconsistent fix deform remap option");
|
||||
|
||||
@ -91,7 +91,7 @@ void FixNVTSllodKokkos<DeviceType>::init()
|
||||
if (deform.size() < 1)
|
||||
this->error->all(FLERR,"Using fix nvt/sllod/kk with no fix deform defined");
|
||||
|
||||
for (auto ifix : deform) {
|
||||
for (auto &ifix : deform) {
|
||||
auto f = dynamic_cast<FixDeform *>(ifix);
|
||||
if (f && (f->remapflag != Domain::V_REMAP))
|
||||
this->error->all(FLERR,"Using fix ntv/sllod/kk with inconsistent fix deform remap option");
|
||||
|
||||
@ -90,7 +90,7 @@ void FixNVTSllodOMP::init()
|
||||
auto deform = modify->get_fix_by_style("^deform");
|
||||
if (deform.size() < 1) error->all(FLERR,"Using fix nvt/sllod/omp with no fix deform defined");
|
||||
|
||||
for (auto ifix : deform) {
|
||||
for (auto &ifix : deform) {
|
||||
auto f = dynamic_cast<FixDeform *>(ifix);
|
||||
if (f && (f->remapflag != Domain::V_REMAP))
|
||||
error->all(FLERR,"Using fix nvt/sllod/omp with inconsistent fix deform remap option");
|
||||
|
||||
@ -196,7 +196,7 @@ void FixAlchemy::init()
|
||||
synchronize_box(domain, samerank);
|
||||
|
||||
sync_box = 0;
|
||||
for (auto ifix : modify->get_fix_list())
|
||||
for (const auto &ifix : modify->get_fix_list())
|
||||
if (ifix->box_change) sync_box = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -609,7 +609,7 @@ void FixDeform::init()
|
||||
|
||||
rfix.clear();
|
||||
|
||||
for (auto ifix : modify->get_fix_list())
|
||||
for (auto &ifix : modify->get_fix_list())
|
||||
if (ifix->rigid_flag) rfix.push_back(ifix);
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ void FixNVTSllod::init()
|
||||
auto deform = modify->get_fix_by_style("^deform");
|
||||
if (deform.size() < 1) error->all(FLERR,"Using fix {} with no fix deform defined", style);
|
||||
|
||||
for (auto ifix : deform) {
|
||||
for (auto &ifix : deform) {
|
||||
auto f = dynamic_cast<FixDeform *>(ifix);
|
||||
if (f && (f->remapflag != Domain::V_REMAP))
|
||||
error->all(FLERR,"Using fix {} with inconsistent fix deform remap option", style);
|
||||
|
||||
Reference in New Issue
Block a user