From 7c9afc1be2f05b9396a73a84bdfeb5da6016ec34 Mon Sep 17 00:00:00 2001
From: Axel Kohlmeyer <akohlmey@gmail.com>
Date: Fri, 15 Jun 2018 17:27:23 -0400
Subject: [PATCH] change warning and move it do init() as discussed in PR #943

---
 src/USER-MANIFOLD/fix_manifoldforce.cpp | 24 ++++++++++++++----------
 src/USER-MANIFOLD/fix_manifoldforce.h   |  1 +
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/USER-MANIFOLD/fix_manifoldforce.cpp b/src/USER-MANIFOLD/fix_manifoldforce.cpp
index 321ee3292e..04172d5c92 100644
--- a/src/USER-MANIFOLD/fix_manifoldforce.cpp
+++ b/src/USER-MANIFOLD/fix_manifoldforce.cpp
@@ -31,12 +31,12 @@ using namespace user_manifold;
 
 
 // Helper functions for parameters/equal style variables in input script
-inline bool was_var( const char *arg )
+static bool was_var( const char *arg )
 {
   return strstr( arg, "v_" ) == arg;
 }
 
-inline bool str_eq( const char *str1, const char *str2 )
+static bool str_eq( const char *str1, const char *str2 )
 {
   return strcmp(str1,str2) == 0;
 }
@@ -50,14 +50,6 @@ FixManifoldForce::FixManifoldForce(LAMMPS *lmp, int narg, char **arg) :
   MPI_Comm_rank(world,&me);
 
 
-  // Check the min-style:
-  int good_minner = str_eq(update->minimize_style,"hftn") |
-                    str_eq(update->minimize_style,"quickmin");
-  if( !good_minner ){
-    error->warning(FLERR,"Make sure min_style is set to hftn "
-                   "or quickmin before minimizing");
-  }
-
 
   // Command is given as
   // fix <name> <group> manifoldforce manifold_name manifold_args
@@ -122,6 +114,18 @@ int FixManifoldForce::setmask()
 
 /* ---------------------------------------------------------------------- */
 
+void FixManifoldForce::init()
+{
+  // Check the min-style:
+  const bool is_good_min_style = str_eq(update->minimize_style,"hftn")
+                                || str_eq(update->minimize_style,"quickmin");
+  if (!is_good_min_style) {
+    error->all(FLERR,"Fix manifoldforce requires min_style hftn or quickmin");
+  }
+}
+
+/* ---------------------------------------------------------------------- */
+
 void FixManifoldForce::setup(int vflag)
 {
   if (strstr(update->integrate_style,"verlet"))
diff --git a/src/USER-MANIFOLD/fix_manifoldforce.h b/src/USER-MANIFOLD/fix_manifoldforce.h
index 89bd6bd378..527bee3f86 100644
--- a/src/USER-MANIFOLD/fix_manifoldforce.h
+++ b/src/USER-MANIFOLD/fix_manifoldforce.h
@@ -51,6 +51,7 @@ class FixManifoldForce : public Fix {
  public:
   FixManifoldForce(class LAMMPS *, int, char **);
   int setmask();
+  void init();
   void setup(int);
   void min_setup(int);
   void post_force(int);
-- 
GitLab