From 4d915dba08a9b77a560a2938ac155db3a5699455 Mon Sep 17 00:00:00 2001
From: Richard Berger <richard.berger@temple.edu>
Date: Tue, 5 Dec 2017 23:33:24 -0500
Subject: [PATCH] Rename fix python/move to move/python

---
 ...fix_python_move => README.fix_move_python} |  8 +--
 ...n_nve_melt => in.fix_move_python_nve_melt} |  2 +-
 ...lt_opt => in.fix_move_python_nve_melt_opt} |  2 +-
 ...ix_python_move.cpp => fix_move_python.cpp} | 71 +++++++++----------
 .../{fix_python_move.h => fix_move_python.h}  | 14 ++--
 5 files changed, 47 insertions(+), 50 deletions(-)
 rename examples/python/{README.fix_python_move => README.fix_move_python} (77%)
 rename examples/python/{in.fix_python_nve_melt => in.fix_move_python_nve_melt} (90%)
 rename examples/python/{in.fix_python_nve_melt_opt => in.fix_move_python_nve_melt_opt} (89%)
 rename src/PYTHON/{fix_python_move.cpp => fix_move_python.cpp} (73%)
 rename src/PYTHON/{fix_python_move.h => fix_move_python.h} (87%)

diff --git a/examples/python/README.fix_python_move b/examples/python/README.fix_move_python
similarity index 77%
rename from examples/python/README.fix_python_move
rename to examples/python/README.fix_move_python
index 308d154119..9ab15f0b67 100644
--- a/examples/python/README.fix_python_move
+++ b/examples/python/README.fix_move_python
@@ -1,16 +1,16 @@
 This folder contains several LAMMPS input scripts and a python module
-file py_nve.py to demonstrate the use of the fix style python/move
+file py_nve.py to demonstrate the use of the fix style move/python
 to reimplement NVE using Python.
 
-in.fix_python_nve_melt:
+in.fix_move_python_nve_melt:
 This is a version of the melt example which replaces the default NVE integrator
-with a Python implementation. Fix python/move is used to create an
+with a Python implementation. Fix move/python is used to create an
 instance of the py_nve.NVE class which implements the required interface.
 It demonstrates how to access LAMMPS data as numpy arrays. This gives direct
 access to memory owned by the C++ code, allows easy manipulation through numpy
 operations and avoids unnecessary copies.
 
-in.fix_python_nve_melt_opt:
+in.fix_move_python_nve_melt_opt:
 This version of melt example uses NVE_Opt instead of NVE. While this Python
 implementation is still much slower than the native version, it shows that
 simple code transformations can lead to speedups.
diff --git a/examples/python/in.fix_python_nve_melt b/examples/python/in.fix_move_python_nve_melt
similarity index 90%
rename from examples/python/in.fix_python_nve_melt
rename to examples/python/in.fix_move_python_nve_melt
index 24828d7445..0274b8994d 100644
--- a/examples/python/in.fix_python_nve_melt
+++ b/examples/python/in.fix_move_python_nve_melt
@@ -17,7 +17,7 @@ pair_coeff	1 1 1.0 1.0 2.5
 neighbor	0.3 bin
 neigh_modify	every 20 delay 0 check no
 
-fix		1 all python/move py_nve.NVE
+fix		1 all move/python py_nve.NVE
 
 thermo		50
 run		250
diff --git a/examples/python/in.fix_python_nve_melt_opt b/examples/python/in.fix_move_python_nve_melt_opt
similarity index 89%
rename from examples/python/in.fix_python_nve_melt_opt
rename to examples/python/in.fix_move_python_nve_melt_opt
index 9564ffa02e..5f7bca3096 100644
--- a/examples/python/in.fix_python_nve_melt_opt
+++ b/examples/python/in.fix_move_python_nve_melt_opt
@@ -17,7 +17,7 @@ pair_coeff	1 1 1.0 1.0 2.5
 neighbor	0.3 bin
 neigh_modify	every 20 delay 0 check no
 
-fix		1 all python/move py_nve.NVE_Opt
+fix		1 all move/python py_nve.NVE_Opt
 
 thermo		50
 run		250
diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_move_python.cpp
similarity index 73%
rename from src/PYTHON/fix_python_move.cpp
rename to src/PYTHON/fix_move_python.cpp
index 2c216d8aad..a910e13aee 100644
--- a/src/PYTHON/fix_python_move.cpp
+++ b/src/PYTHON/fix_move_python.cpp
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "fix_python_move.h"
+#include "fix_move_python.h"
 #include "atom.h"
 #include "comm.h"
 #include "force.h"
@@ -34,7 +34,7 @@ using namespace FixConst;
 
 /* ---------------------------------------------------------------------- */
 
-FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
+FixMovePython::FixMovePython(LAMMPS *lmp, int narg, char **arg) :
   Fix(lmp, narg, arg)
 {
   dynamic_group_allow = 1;
@@ -42,7 +42,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
 
   python->init();
 
-  py_integrator = NULL;
+  py_move = NULL;
 
   PyGILState_STATE gstate = PyGILState_Ensure();
 
@@ -51,12 +51,12 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
   PyList_Append(py_path, PY_STRING_FROM_STRING("."));
 
 
-  // create integrator instance
+  // create move instance
   char * full_cls_name = arg[3];
   char * lastpos = strrchr(full_cls_name, '.');
 
   if (lastpos == NULL) {
-    error->all(FLERR,"Fix python/integrate requires fully qualified class name");
+    error->all(FLERR,"Fix move/python requires fully qualified class name");
   }
 
   size_t module_name_length = strlen(full_cls_name) - strlen(lastpos);
@@ -74,18 +74,15 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
     PyErr_Print();
     PyErr_Clear();
     PyGILState_Release(gstate);
-    error->all(FLERR,"Loading python integrator module failure");
+    error->all(FLERR,"Loading python move module failure");
   }
 
-  // create LAMMPS atom type to potential file type mapping in python class
-  // by calling 'lammps_pair_style.map_coeff(name,type)'
-
-  PyObject *py_integrator_type = PyObject_GetAttrString(pModule, cls_name);
-  if (!py_integrator_type) {
+  PyObject *py_move_type = PyObject_GetAttrString(pModule, cls_name);
+  if (!py_move_type) {
     PyErr_Print();
     PyErr_Clear();
     PyGILState_Release(gstate);
-    error->all(FLERR,"Could not find integrator class in module'");
+    error->all(FLERR,"Could not find move class in module'");
   }
 
   delete [] module_name;
@@ -93,34 +90,34 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
 
   PyObject * ptr = PY_VOID_POINTER(lmp);
   PyObject * arglist = Py_BuildValue("(O)", ptr);
-  PyObject * py_integrator_obj = PyObject_CallObject(py_integrator_type, arglist);
+  PyObject * py_move_obj = PyObject_CallObject(py_move_type, arglist);
   Py_DECREF(arglist);
 
-  if (!py_integrator_obj) {
+  if (!py_move_obj) {
     PyErr_Print();
     PyErr_Clear();
     PyGILState_Release(gstate);
-    error->all(FLERR,"Could not instantiate instance of integrator class'");
+    error->all(FLERR,"Could not instantiate instance of move class'");
   }
 
   // check object interface
-  py_integrator = (void *) py_integrator_obj;
+  py_move = (void *) py_move_obj;
 
   PyGILState_Release(gstate);
 }
 
 /* ---------------------------------------------------------------------- */
 
-FixPythonMove::~FixPythonMove()
+FixMovePython::~FixMovePython()
 {
   PyGILState_STATE gstate = PyGILState_Ensure();
-  if(py_integrator) Py_DECREF((PyObject*) py_integrator);
+  if(py_move) Py_DECREF((PyObject*) py_move);
   PyGILState_Release(gstate);
 }
 
 /* ---------------------------------------------------------------------- */
 
-int FixPythonMove::setmask()
+int FixMovePython::setmask()
 {
   int mask = 0;
   mask |= INITIAL_INTEGRATE;
@@ -132,11 +129,11 @@ int FixPythonMove::setmask()
 
 /* ---------------------------------------------------------------------- */
 
-void FixPythonMove::init()
+void FixMovePython::init()
 {
   PyGILState_STATE gstate = PyGILState_Ensure();
-  PyObject *py_integrator_obj = (PyObject *) py_integrator;
-  PyObject *py_init = PyObject_GetAttrString(py_integrator_obj,"init");
+  PyObject *py_move_obj = (PyObject *) py_move;
+  PyObject *py_init = PyObject_GetAttrString(py_move_obj,"init");
   if (!py_init) {
     PyErr_Print();
     PyErr_Clear();
@@ -149,11 +146,11 @@ void FixPythonMove::init()
 
 /* ---------------------------------------------------------------------- */
 
-void FixPythonMove::initial_integrate(int vflag)
+void FixMovePython::initial_integrate(int vflag)
 {
   PyGILState_STATE gstate = PyGILState_Ensure();
-  PyObject *py_integrator_obj = (PyObject *) py_integrator;
-  PyObject *py_initial_integrate = PyObject_GetAttrString(py_integrator_obj,"initial_integrate");
+  PyObject *py_move_obj = (PyObject *) py_move;
+  PyObject *py_initial_integrate = PyObject_GetAttrString(py_move_obj,"initial_integrate");
   if (!py_initial_integrate) {
     PyErr_Print();
     PyErr_Clear();
@@ -168,11 +165,11 @@ void FixPythonMove::initial_integrate(int vflag)
 
 /* ---------------------------------------------------------------------- */
 
-void FixPythonMove::final_integrate()
+void FixMovePython::final_integrate()
 {
   PyGILState_STATE gstate = PyGILState_Ensure();
-  PyObject *py_integrator_obj = (PyObject *) py_integrator;
-  PyObject *py_final_integrate = PyObject_GetAttrString(py_integrator_obj,"final_integrate");
+  PyObject *py_move_obj = (PyObject *) py_move;
+  PyObject *py_final_integrate = PyObject_GetAttrString(py_move_obj,"final_integrate");
   if (!py_final_integrate) {
     PyErr_Print();
     PyErr_Clear();
@@ -185,11 +182,11 @@ void FixPythonMove::final_integrate()
 
 /* ---------------------------------------------------------------------- */
 
-void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop)
+void FixMovePython::initial_integrate_respa(int vflag, int ilevel, int iloop)
 {
   PyGILState_STATE gstate = PyGILState_Ensure();
-  PyObject *py_integrator_obj = (PyObject *) py_integrator;
-  PyObject *py_initial_integrate_respa = PyObject_GetAttrString(py_integrator_obj,"initial_integrate_respa");
+  PyObject *py_move_obj = (PyObject *) py_move;
+  PyObject *py_initial_integrate_respa = PyObject_GetAttrString(py_move_obj,"initial_integrate_respa");
   if (!py_initial_integrate_respa) {
     PyErr_Print();
     PyErr_Clear();
@@ -204,11 +201,11 @@ void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop)
 
 /* ---------------------------------------------------------------------- */
 
-void FixPythonMove::final_integrate_respa(int ilevel, int iloop)
+void FixMovePython::final_integrate_respa(int ilevel, int iloop)
 {
   PyGILState_STATE gstate = PyGILState_Ensure();
-  PyObject *py_integrator_obj = (PyObject *) py_integrator;
-  PyObject *py_final_integrate_respa = PyObject_GetAttrString(py_integrator_obj,"final_integrate_respa");
+  PyObject *py_move_obj = (PyObject *) py_move;
+  PyObject *py_final_integrate_respa = PyObject_GetAttrString(py_move_obj,"final_integrate_respa");
   if (!py_final_integrate_respa) {
     PyErr_Print();
     PyErr_Clear();
@@ -223,11 +220,11 @@ void FixPythonMove::final_integrate_respa(int ilevel, int iloop)
 
 /* ---------------------------------------------------------------------- */
 
-void FixPythonMove::reset_dt()
+void FixMovePython::reset_dt()
 {
   PyGILState_STATE gstate = PyGILState_Ensure();
-  PyObject *py_integrator_obj = (PyObject *) py_integrator;
-  PyObject *py_reset_dt = PyObject_GetAttrString(py_integrator_obj,"reset_dt");
+  PyObject *py_move_obj = (PyObject *) py_move;
+  PyObject *py_reset_dt = PyObject_GetAttrString(py_move_obj,"reset_dt");
   if (!py_reset_dt) {
     PyErr_Print();
     PyErr_Clear();
diff --git a/src/PYTHON/fix_python_move.h b/src/PYTHON/fix_move_python.h
similarity index 87%
rename from src/PYTHON/fix_python_move.h
rename to src/PYTHON/fix_move_python.h
index 0d06305fb9..0573ea5062 100644
--- a/src/PYTHON/fix_python_move.h
+++ b/src/PYTHON/fix_move_python.h
@@ -23,21 +23,21 @@
 
 #ifdef FIX_CLASS
 
-FixStyle(python/move,FixPythonMove)
+FixStyle(move/python,FixMovePython)
 
 #else
 
-#ifndef LMP_FIX_PYTHON_MOVE_H
-#define LMP_FIX_PYTHON_MOVE_H
+#ifndef LMP_FIX_MOVE_PYTHON_H
+#define LMP_FIX_MOVE_PYTHON_H
 
 #include "fix.h"
 
 namespace LAMMPS_NS {
 
-class FixPythonMove : public Fix {
+class FixMovePython : public Fix {
  public:
-  FixPythonMove(LAMMPS *lmp, int narg, char **arg);
-  virtual ~FixPythonMove();
+  FixMovePython(LAMMPS *lmp, int narg, char **arg);
+  virtual ~FixMovePython();
 
   int setmask();
   virtual void init();
@@ -48,7 +48,7 @@ class FixPythonMove : public Fix {
   virtual void reset_dt();
 
  protected:
-  void * py_integrator;
+  void * py_move;
 };
 
 }
-- 
GitLab