Rename fix python to fix python/invoke

This commit is contained in:
Richard Berger 2017-12-15 13:53:04 -05:00
parent 950bfb84a9
commit bcc5f49d0b
11 changed files with 41 additions and 36 deletions

View File

@ -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,

View File

@ -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

View File

@ -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:]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

4
src/.gitignore vendored
View File

@ -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

View File

@ -18,7 +18,7 @@
#include <Python.h>
#include <stdio.h>
#include <string.h>
#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;

View File

@ -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);

View File

@ -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