diff --git a/src/USER-INTEL/fix_intel.cpp b/src/USER-INTEL/fix_intel.cpp index e0865f043164a21a88e1aaee5115b72a6080c9ec..b3055907293918b8e94b51857dab724af89e3be5 100644 --- a/src/USER-INTEL/fix_intel.cpp +++ b/src/USER-INTEL/fix_intel.cpp @@ -65,6 +65,7 @@ FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) _nbor_pack_width = 1; _three_body_neighbor = 0; + _pair_intel_count = 0; _hybrid_nonpair = 0; _precision_mode = PREC_MODE_MIXED; @@ -312,22 +313,14 @@ void FixIntel::init() } #endif - int nstyles = 0; + const int nstyles = _pair_intel_count; if (force->pair_match("hybrid", 1) != NULL) { _pair_hybrid_flag = 1; - PairHybrid *hybrid = (PairHybrid *) force->pair; - for (int i = 0; i < hybrid->nstyles; i++) - if (strstr(hybrid->keywords[i], "/intel") != NULL) - nstyles++; if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR, "Intel package requires fdotr virial with newton on."); } else if (force->pair_match("hybrid/overlay", 1) != NULL) { _pair_hybrid_flag = 1; - PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair; - for (int i = 0; i < hybrid->nstyles; i++) - if (strstr(hybrid->keywords[i], "/intel") != NULL) - nstyles++; if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute) error->all(FLERR, "Intel package requires fdotr virial with newton on."); @@ -345,6 +338,8 @@ void FixIntel::init() _pair_hybrid_zero = 1; _hybrid_nonpair = 0; + _pair_intel_count = 0; + #ifdef _LMP_INTEL_OFFLOAD if (offload_balance() != 0.0) { _pair_hybrid_zero = 0; @@ -458,7 +453,7 @@ void FixIntel::pair_init_check(const bool cdmessage) force->special_coul[3] == 0.0) flag = 1; if (flag) error->all(FLERR,"Add -DLMP_INTEL_NBOR_COMPAT to build for special_bond" - "exclusions with Intel"); + " exclusions with Intel"); } #endif @@ -478,6 +473,8 @@ void FixIntel::pair_init_check(const bool cdmessage) get_double_buffers()->need_tag(need_tag); } + _pair_intel_count++; + #ifdef _LMP_INTEL_OFFLOAD set_offload_affinity(); #endif @@ -521,16 +518,10 @@ void FixIntel::bond_init_check() intel_pair = 1; else if (force->pair_match("hybrid", 1) != NULL) { _hybrid_nonpair = 1; - PairHybrid *hybrid = (PairHybrid *) force->pair; - for (int i = 0; i < hybrid->nstyles; i++) - if (strstr(hybrid->keywords[i], "/intel") != NULL) - intel_pair = 1; + if (_pair_intel_count) intel_pair = 1; } else if (force->pair_match("hybrid/overlay", 1) != NULL) { _hybrid_nonpair = 1; - PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair; - for (int i = 0; i < hybrid->nstyles; i++) - if (strstr(hybrid->keywords[i], "/intel") != NULL) - intel_pair = 1; + if (_pair_intel_count) intel_pair = 1; } if (intel_pair == 0) @@ -547,16 +538,10 @@ void FixIntel::kspace_init_check() intel_pair = 1; else if (force->pair_match("hybrid", 1) != NULL) { _hybrid_nonpair = 1; - PairHybrid *hybrid = (PairHybrid *) force->pair; - for (int i = 0; i < hybrid->nstyles; i++) - if (strstr(hybrid->keywords[i], "/intel") != NULL) - intel_pair = 1; + if (_pair_intel_count) intel_pair = 1; } else if (force->pair_match("hybrid/overlay", 1) != NULL) { _hybrid_nonpair = 1; - PairHybridOverlay *hybrid = (PairHybridOverlay *) force->pair; - for (int i = 0; i < hybrid->nstyles; i++) - if (strstr(hybrid->keywords[i], "/intel") != NULL) - intel_pair = 1; + if (_pair_intel_count) intel_pair = 1; } if (intel_pair == 0) diff --git a/src/USER-INTEL/fix_intel.h b/src/USER-INTEL/fix_intel.h index 81dd0b5d975886d6c6a5444b6bf666543ffc9a56..a01ed18bfed97af04a1d5c69c54e7ce30f80fe1b 100644 --- a/src/USER-INTEL/fix_intel.h +++ b/src/USER-INTEL/fix_intel.h @@ -101,7 +101,7 @@ class FixIntel : public Fix { IntelBuffers<double,double> *_double_buffers; int _precision_mode, _nthreads, _nbor_pack_width, _three_body_neighbor; - int _pair_hybrid_flag; + int _pair_intel_count, _pair_hybrid_flag; // These should be removed in subsequent update w/ simpler hybrid arch int _pair_hybrid_zero, _hybrid_nonpair, _zero_master;