Unverified Commit 2f6018b0 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

use regex pattern matching to make style lookup more specific with less code

parent e11374d4
Loading
Loading
Loading
Loading
+5 −16
Original line number Diff line number Diff line
@@ -312,12 +312,7 @@ void FixIntel::init()
  #endif

  const int nstyles = _pair_intel_count;
  if (force->pair_match("hybrid", 1) != NULL) {
    _pair_hybrid_flag = 1;
    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) {
  if (force->pair_match("^hybrid", 0) != NULL) {
    _pair_hybrid_flag = 1;
    if (force->newton_pair != 0 && force->pair->no_virial_fdotr_compute)
      error->all(FLERR,
@@ -513,12 +508,9 @@ void FixIntel::bond_init_check()
      "USER-INTEL package requires same setting for newton bond and non-bond.");

  int intel_pair = 0;
  if (force->pair_match("/intel", 0) != NULL)
  if (force->pair_match("/intel$", 0) != NULL)
    intel_pair = 1;
  else if (force->pair_match("hybrid", 1) != NULL) {
    _hybrid_nonpair = 1;
    if (_pair_intel_count) intel_pair = 1;
  } else if (force->pair_match("hybrid/overlay", 1) != NULL) {
  else if (force->pair_match("^hybrid", 1) != NULL) {
    _hybrid_nonpair = 1;
    if (_pair_intel_count) intel_pair = 1;
  }
@@ -533,12 +525,9 @@ void FixIntel::bond_init_check()
void FixIntel::kspace_init_check()
{
  int intel_pair = 0;
  if (force->pair_match("/intel", 0) != NULL)
  if (force->pair_match("/intel$", 0) != NULL)
    intel_pair = 1;
  else if (force->pair_match("hybrid", 1) != NULL) {
    _hybrid_nonpair = 1;
    if (_pair_intel_count) intel_pair = 1;
  } else if (force->pair_match("hybrid/overlay", 1) != NULL) {
  else if (force->pair_match("^hybrid", 0) != NULL) {
    _hybrid_nonpair = 1;
    if (_pair_intel_count) intel_pair = 1;
  }
+2 −3
Original line number Diff line number Diff line
@@ -85,13 +85,12 @@ class FixIntel : public Fix {
  }
  inline void set_reduce_flag() { if (_nthreads > 1) _need_reduce = 1; }
  inline int lrt() {
    if (force->kspace_match("pppm/intel", 0) && update->whichflag == 1)
    if (force->kspace_match("^pppm/.*intel$", 0) && update->whichflag == 1)
      return _lrt;
    else return 0;
  }
  inline int pppm_table() {
    if (force->kspace_match("pppm/intel", 0) ||
        force->kspace_match("pppm/disp/intel",0))
    if (force->kspace_match("^pppm/.*intel$", 0))
      return INTEL_P3M_TABLE;
    else return 0;
  }