From bcc5f49d0b00dde08beba15b7a5aea0e51a90088 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 15 Dec 2017 13:53:04 -0500 Subject: [PATCH] Rename fix python to fix python/invoke --- doc/src/Section_commands.txt | 4 ++-- doc/src/Section_python.txt | 4 ++-- .../{fix_python.txt => fix_python_invoke.txt} | 10 +++++----- .../{fix_move_python.txt => fix_python_move.txt} | 12 ++++++------ doc/src/lammps.book | 3 ++- doc/src/python.txt | 4 ++-- .../{in.fix_python => in.fix_python_invoke} | 4 ++-- src/.gitignore | 4 ++-- .../{fix_python.cpp => fix_python_invoke.cpp} | 16 ++++++++-------- src/PYTHON/{fix_python.h => fix_python_invoke.h} | 13 +++++++------ src/Purge.list | 3 +++ 11 files changed, 41 insertions(+), 36 deletions(-) rename doc/src/{fix_python.txt => fix_python_invoke.txt} (89%) rename doc/src/{fix_move_python.txt => fix_python_move.txt} (90%) rename examples/python/{in.fix_python => in.fix_python_invoke} (88%) rename src/PYTHON/{fix_python.cpp => fix_python_invoke.cpp} (86%) rename src/PYTHON/{fix_python.h => fix_python_invoke.h} (81%) diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt index d2b837581a..3ad1249ace 100644 --- a/doc/src/Section_commands.txt +++ b/doc/src/Section_commands.txt @@ -585,7 +585,6 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "lineforce"_fix_lineforce.html, "momentum (k)"_fix_momentum.html, "move"_fix_move.html, -"move/python"_fix_move_python.html, "mscg"_fix_mscg.html, "msst"_fix_msst.html, "neb"_fix_neb.html, @@ -621,7 +620,8 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "press/berendsen"_fix_press_berendsen.html, "print"_fix_print.html, "property/atom"_fix_property_atom.html, -"python"_fix_python.html, +"python/invoke"_fix_python_invoke.html, +"python/move"_fix_python_move.html, "qeq/comb (o)"_fix_qeq_comb.html, "qeq/dynamic"_fix_qeq.html, "qeq/fire"_fix_qeq.html, diff --git a/doc/src/Section_python.txt b/doc/src/Section_python.txt index f4b6bdad97..26e1c84c09 100644 --- a/doc/src/Section_python.txt +++ b/doc/src/Section_python.txt @@ -123,7 +123,7 @@ code directly from an input script: "python"_python.html "variable python"_variable.html -"fix python"_fix_python.html +"fix python/invoke"_fix_python_invoke.html "pair_style python"_pair_python.html :ul The "python"_python.html command which can be used to define and @@ -165,7 +165,7 @@ doc page for its python-style variables for more info, including examples of Python code you can write for both pure Python operations and callbacks to LAMMPS. -The "fix python"_fix_python.html command can execute +The "fix python/invoke"_fix_python_invoke.html command can execute Python code at selected timesteps during a simulation run. The "pair_style python"_pair_python command allows you to define diff --git a/doc/src/fix_python.txt b/doc/src/fix_python_invoke.txt similarity index 89% rename from doc/src/fix_python.txt rename to doc/src/fix_python_invoke.txt index c6e1ad9dac..787940d9eb 100644 --- a/doc/src/fix_python.txt +++ b/doc/src/fix_python_invoke.txt @@ -6,14 +6,14 @@ :line -fix python command :h3 +fix python/invoke command :h3 [Syntax:] -fix ID group-ID python N callback function_name :pre +fix ID group-ID python/invoke N callback function_name :pre ID, group-ID are ignored by this fix :ulb,l -python = style name of this fix command :l +python/invoke = style name of this fix command :l N = execute every N steps :l callback = {post_force} or {end_of_step} :l {post_force} = callback after force computations on atoms every N time steps @@ -36,8 +36,8 @@ def end_of_step_callback(lammps_ptr): # access LAMMPS state using Python interface """ :pre -fix pf all python 50 post_force post_force_callback -fix eos all python 50 end_of_step end_of_step_callback :pre +fix pf all python/invoke 50 post_force post_force_callback +fix eos all python/invoke 50 end_of_step end_of_step_callback :pre [Description:] diff --git a/doc/src/fix_move_python.txt b/doc/src/fix_python_move.txt similarity index 90% rename from doc/src/fix_move_python.txt rename to doc/src/fix_python_move.txt index 156fde9f49..f10f607a9b 100644 --- a/doc/src/fix_move_python.txt +++ b/doc/src/fix_python_move.txt @@ -6,22 +6,22 @@ :line -fix move/python command :h3 +fix python/move command :h3 [Syntax:] -fix move/python pymodule.CLASS :pre +fix python/move pymodule.CLASS :pre pymodule.CLASS = use class [CLASS] in module/file [pymodule] to compute how to move atoms [Examples:] -fix 1 all move/python py_nve.NVE -fix 1 all move/python py_nve.NVE_OPT :pre +fix 1 all python/move py_nve.NVE +fix 1 all python/move py_nve.NVE_OPT :pre [Description:] -The {move/python} fix style provides a way to define ways how particles +The {python/move} fix style provides a way to define ways how particles are moved during an MD run from python script code, that is loaded from a file into LAMMPS and executed at the various steps where other fixes can be executed. This python script must contain specific python class @@ -96,7 +96,7 @@ LAMMPS"_Section_start.html#start_3 section for more info. [Related commands:] -"fix nve"_fix_nve.html, "fix python"_fix_python.html +"fix nve"_fix_nve.html, "fix python/invoke"_fix_python_invoke.html [Default:] none diff --git a/doc/src/lammps.book b/doc/src/lammps.book index b62ec3e5be..30eff08e29 100644 --- a/doc/src/lammps.book +++ b/doc/src/lammps.book @@ -245,7 +245,8 @@ fix_pour.html fix_press_berendsen.html fix_print.html fix_property_atom.html -fix_python.html +fix_python_invoke.html +fix_python_move.html fix_qbmsst.html fix_qeq.html fix_qeq_comb.html diff --git a/doc/src/python.txt b/doc/src/python.txt index c6538ded45..1ac2b48528 100644 --- a/doc/src/python.txt +++ b/doc/src/python.txt @@ -406,7 +406,7 @@ cases, LAMMPS has no simple way to check that something illogical is being attempted. The same applies to Python functions called during a simulation run at -each time step using "fix python"_fix_python.html. +each time step using "fix python/invoke"_fix_python_invoke.html. :line @@ -493,6 +493,6 @@ different source files, problems may occur. [Related commands:] -"shell"_shell.html, "variable"_variable.html, "fix python"_fix_python.html +"shell"_shell.html, "variable"_variable.html, "fix python/invoke"_fix_python_invoke.html [Default:] none diff --git a/examples/python/in.fix_python b/examples/python/in.fix_python_invoke similarity index 88% rename from examples/python/in.fix_python rename to examples/python/in.fix_python_invoke index c98029a63b..f77cc15c90 100644 --- a/examples/python/in.fix_python +++ b/examples/python/in.fix_python_invoke @@ -33,8 +33,8 @@ def post_force_callback(lmp, v): """ fix 1 all nve -fix 2 all python 50 end_of_step end_of_step_callback -fix 3 all python 50 post_force post_force_callback +fix 2 all python/invoke 50 end_of_step end_of_step_callback +fix 3 all python/invoke 50 post_force post_force_callback #dump id all atom 50 dump.melt diff --git a/src/.gitignore b/src/.gitignore index 23ce8390ed..694a43adb2 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -910,8 +910,8 @@ /python_compat.h /fix_python_move.cpp /fix_python_move.h -/fix_python.cpp -/fix_python.h +/fix_python_invoke.cpp +/fix_python_invoke.h /pair_python.cpp /pair_python.h /reader_molfile.cpp diff --git a/src/PYTHON/fix_python.cpp b/src/PYTHON/fix_python_invoke.cpp similarity index 86% rename from src/PYTHON/fix_python.cpp rename to src/PYTHON/fix_python_invoke.cpp index ffca66e77c..9a4db51d99 100644 --- a/src/PYTHON/fix_python.cpp +++ b/src/PYTHON/fix_python_invoke.cpp @@ -18,7 +18,7 @@ #include #include #include -#include "fix_python.h" +#include "fix_python_invoke.h" #include "atom.h" #include "force.h" #include "update.h" @@ -32,13 +32,13 @@ using namespace FixConst; /* ---------------------------------------------------------------------- */ -FixPython::FixPython(LAMMPS *lmp, int narg, char **arg) : +FixPythonInvoke::FixPythonInvoke(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg) { - if (narg != 6) error->all(FLERR,"Illegal fix python command"); + if (narg != 6) error->all(FLERR,"Illegal fix python/invoke command"); nevery = force->inumeric(FLERR,arg[3]); - if (nevery <= 0) error->all(FLERR,"Illegal fix python command"); + if (nevery <= 0) error->all(FLERR,"Illegal fix python/invoke command"); // ensure Python interpreter is initialized python->init(); @@ -48,7 +48,7 @@ FixPython::FixPython(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[4],"end_of_step") == 0) { selected_callback = END_OF_STEP; } else { - error->all(FLERR,"Unsupported callback name for fix/python"); + error->all(FLERR,"Unsupported callback name for fix python/invoke"); } // get Python function @@ -74,14 +74,14 @@ FixPython::FixPython(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -int FixPython::setmask() +int FixPythonInvoke::setmask() { return selected_callback; } /* ---------------------------------------------------------------------- */ -void FixPython::end_of_step() +void FixPythonInvoke::end_of_step() { PyGILState_STATE gstate = PyGILState_Ensure(); @@ -96,7 +96,7 @@ void FixPython::end_of_step() /* ---------------------------------------------------------------------- */ -void FixPython::post_force(int vflag) +void FixPythonInvoke::post_force(int vflag) { if (update->ntimestep % nevery != 0) return; diff --git a/src/PYTHON/fix_python.h b/src/PYTHON/fix_python_invoke.h similarity index 81% rename from src/PYTHON/fix_python.h rename to src/PYTHON/fix_python_invoke.h index 2e740dedcd..05f0bd08c6 100644 --- a/src/PYTHON/fix_python.h +++ b/src/PYTHON/fix_python_invoke.h @@ -13,21 +13,22 @@ #ifdef FIX_CLASS -FixStyle(python,FixPython) +FixStyle(python,FixPythonInvoke) +FixStyle(python/invoke,FixPythonInvoke) #else -#ifndef LMP_FIX_PYTHON_H -#define LMP_FIX_PYTHON_H +#ifndef LMP_FIX_PYTHON_INVOKE_H +#define LMP_FIX_PYTHON_INVOKE_H #include "fix.h" namespace LAMMPS_NS { -class FixPython : public Fix { +class FixPythonInvoke : public Fix { public: - FixPython(class LAMMPS *, int, char **); - virtual ~FixPython() {} + FixPythonInvoke(class LAMMPS *, int, char **); + virtual ~FixPythonInvoke() {} int setmask(); virtual void end_of_step(); virtual void post_force(int); diff --git a/src/Purge.list b/src/Purge.list index 312994fdb7..e4a9e46309 100644 --- a/src/Purge.list +++ b/src/Purge.list @@ -16,6 +16,9 @@ style_region.h style_neigh_bin.h style_neigh_pair.h style_neigh_stencil.h +# deleted on 15 December 2017 +fix_python.cpp +fix_python.h # deleted on 11 October 2017 fix_shear_history_omp.cpp fix_shear_history_omp.h