Unverified Commit d640c712 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

apply new utility function to most places creating new styles

parent 91660010
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "utils.h"

#ifdef LMP_USER_INTEL
#include "neigh_request.h"
@@ -509,7 +510,7 @@ AtomVec *Atom::new_avec(const char *style, int trysuffix, int &sflag)
    return avec_creator(lmp);
  }

  error->all(FLERR,"Unknown atom style");
  error->all(FLERR,utils::check_packages_for_style("atom",style,lmp).c_str());
  return NULL;
}

+2 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include "fix.h"
#include "memory.h"
#include "error.h"
#include "utils.h"

using namespace LAMMPS_NS;

@@ -96,7 +97,7 @@ void AtomVecBody::process_args(int narg, char **arg)
#undef BodyStyle
#undef BODY_CLASS

  else error->all(FLERR,"Unknown body style");
  else error->all(FLERR,utils::check_packages_for_style("body",arg[0],lmp).c_str());

  bptr->avec = this;
  icp = bptr->icp;
+5 −3
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "utils.h"

using namespace LAMMPS_NS;
using namespace MathConst;
@@ -1714,6 +1715,9 @@ void Domain::add_region(int narg, char **arg)
    return;
  }

  if (strcmp(arg[1],"none") == 0)
    error->all(FLERR,"Unrecognized region style 'none'");

  if (find_region(arg[0]) >= 0) error->all(FLERR,"Reuse of region ID");

  // extend Region list if necessary
@@ -1752,12 +1756,10 @@ void Domain::add_region(int narg, char **arg)
    }
  }

  if (strcmp(arg[1],"none") == 0) error->all(FLERR,"Unknown region style");
  if (region_map->find(arg[1]) != region_map->end()) {
    RegionCreator region_creator = (*region_map)[arg[1]];
    regions[nregion] = region_creator(lmp, narg, arg);
  }
  else error->all(FLERR,"Unknown region style");
  } else error->all(FLERR,utils::check_packages_for_style("region",arg[1],lmp).c_str());

  // initialize any region variables via init()
  // in case region is used between runs, e.g. to print a variable
+6 −18
Original line number Diff line number Diff line
@@ -258,9 +258,7 @@ Pair *Force::new_pair(const char *style, int trysuffix, int &sflag)
    return pair_creator(lmp);
  }

  char str[128];
  sprintf(str,"Unknown pair style %s",style);
  error->all(FLERR,str);
  error->all(FLERR,utils::check_packages_for_style("pair",style,lmp).c_str());

  return NULL;
}
@@ -373,9 +371,7 @@ Bond *Force::new_bond(const char *style, int trysuffix, int &sflag)
    return bond_creator(lmp);
  }

  char str[128];
  sprintf(str,"Unknown bond style %s",style);
  error->all(FLERR,str);
  error->all(FLERR,utils::check_packages_for_style("bond",style,lmp).c_str());

  return NULL;
}
@@ -454,9 +450,7 @@ Angle *Force::new_angle(const char *style, int trysuffix, int &sflag)
    return angle_creator(lmp);
  }

  char str[128];
  sprintf(str,"Unknown angle style %s",style);
  error->all(FLERR,str);
  error->all(FLERR,utils::check_packages_for_style("angle",style,lmp).c_str());

  return NULL;
}
@@ -536,9 +530,7 @@ Dihedral *Force::new_dihedral(const char *style, int trysuffix, int &sflag)
    return dihedral_creator(lmp);
  }

  char str[128];
  sprintf(str,"Unknown dihedral style %s",style);
  error->all(FLERR,str);
  error->all(FLERR,utils::check_packages_for_style("dihedral",style,lmp).c_str());

  return NULL;
}
@@ -617,9 +609,7 @@ Improper *Force::new_improper(const char *style, int trysuffix, int &sflag)
    return improper_creator(lmp);
  }

  char str[128];
  sprintf(str,"Unknown improper style %s",style);
  error->all(FLERR,str);
  error->all(FLERR,utils::check_packages_for_style("improper",style,lmp).c_str());

  return NULL;
}
@@ -702,9 +692,7 @@ KSpace *Force::new_kspace(const char *style, int trysuffix, int &sflag)
    return kspace_creator(lmp);
  }

  char str[128];
  sprintf(str,"Unknown kspace style %s",style);
  error->all(FLERR,str);
  error->all(FLERR,utils::check_packages_for_style("kspace",style,lmp).c_str());

  return NULL;
}
+4 −10
Original line number Diff line number Diff line
@@ -893,11 +893,8 @@ void Modify::add_fix(int narg, char **arg, int trysuffix)
    fix[ifix] = fix_creator(lmp,narg,arg);
  }

  if (fix[ifix] == NULL) {
    char str[128];
    snprintf(str,128,"Unknown fix style %s",arg[2]);
    error->all(FLERR,str);
  }
  if (fix[ifix] == NULL)
    error->all(FLERR,utils::check_packages_for_style("fix",arg[2],lmp).c_str());

  // check if Fix is in restart_global list
  // if yes, pass state info to the Fix so it can reset itself
@@ -1195,11 +1192,8 @@ void Modify::add_compute(int narg, char **arg, int trysuffix)
    compute[ncompute] = compute_creator(lmp,narg,arg);
  }

  if (compute[ncompute] == NULL) {
    char str[128];
    snprintf(str,128,"Unknown compute style %s",arg[2]);
    error->all(FLERR,str);
  }
  if (compute[ncompute] == NULL)
    error->all(FLERR,utils::check_packages_for_style("compute",arg[2],lmp).c_str());

  ncompute++;
}
Loading