Rename fix python to fix python/invoke
This commit is contained in:
@ -585,7 +585,6 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
|
|||||||
"lineforce"_fix_lineforce.html,
|
"lineforce"_fix_lineforce.html,
|
||||||
"momentum (k)"_fix_momentum.html,
|
"momentum (k)"_fix_momentum.html,
|
||||||
"move"_fix_move.html,
|
"move"_fix_move.html,
|
||||||
"move/python"_fix_move_python.html,
|
|
||||||
"mscg"_fix_mscg.html,
|
"mscg"_fix_mscg.html,
|
||||||
"msst"_fix_msst.html,
|
"msst"_fix_msst.html,
|
||||||
"neb"_fix_neb.html,
|
"neb"_fix_neb.html,
|
||||||
@ -621,7 +620,8 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT.
|
|||||||
"press/berendsen"_fix_press_berendsen.html,
|
"press/berendsen"_fix_press_berendsen.html,
|
||||||
"print"_fix_print.html,
|
"print"_fix_print.html,
|
||||||
"property/atom"_fix_property_atom.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/comb (o)"_fix_qeq_comb.html,
|
||||||
"qeq/dynamic"_fix_qeq.html,
|
"qeq/dynamic"_fix_qeq.html,
|
||||||
"qeq/fire"_fix_qeq.html,
|
"qeq/fire"_fix_qeq.html,
|
||||||
|
|||||||
@ -123,7 +123,7 @@ code directly from an input script:
|
|||||||
|
|
||||||
"python"_python.html
|
"python"_python.html
|
||||||
"variable python"_variable.html
|
"variable python"_variable.html
|
||||||
"fix python"_fix_python.html
|
"fix python/invoke"_fix_python_invoke.html
|
||||||
"pair_style python"_pair_python.html :ul
|
"pair_style python"_pair_python.html :ul
|
||||||
|
|
||||||
The "python"_python.html command which can be used to define and
|
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
|
examples of Python code you can write for both pure Python operations
|
||||||
and callbacks to LAMMPS.
|
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.
|
Python code at selected timesteps during a simulation run.
|
||||||
|
|
||||||
The "pair_style python"_pair_python command allows you to define
|
The "pair_style python"_pair_python command allows you to define
|
||||||
|
|||||||
@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
fix python command :h3
|
fix python/invoke command :h3
|
||||||
|
|
||||||
[Syntax:]
|
[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
|
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
|
N = execute every N steps :l
|
||||||
callback = {post_force} or {end_of_step} :l
|
callback = {post_force} or {end_of_step} :l
|
||||||
{post_force} = callback after force computations on atoms every N time steps
|
{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
|
# access LAMMPS state using Python interface
|
||||||
""" :pre
|
""" :pre
|
||||||
|
|
||||||
fix pf all python 50 post_force post_force_callback
|
fix pf all python/invoke 50 post_force post_force_callback
|
||||||
fix eos all python 50 end_of_step end_of_step_callback :pre
|
fix eos all python/invoke 50 end_of_step end_of_step_callback :pre
|
||||||
|
|
||||||
[Description:]
|
[Description:]
|
||||||
|
|
||||||
@ -6,22 +6,22 @@
|
|||||||
|
|
||||||
:line
|
:line
|
||||||
|
|
||||||
fix move/python command :h3
|
fix python/move command :h3
|
||||||
|
|
||||||
[Syntax:]
|
[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
|
pymodule.CLASS = use class [CLASS] in module/file [pymodule] to compute how to move atoms
|
||||||
|
|
||||||
[Examples:]
|
[Examples:]
|
||||||
|
|
||||||
fix 1 all move/python py_nve.NVE
|
fix 1 all python/move py_nve.NVE
|
||||||
fix 1 all move/python py_nve.NVE_OPT :pre
|
fix 1 all python/move py_nve.NVE_OPT :pre
|
||||||
|
|
||||||
[Description:]
|
[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
|
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
|
a file into LAMMPS and executed at the various steps where other fixes
|
||||||
can be executed. This python script must contain specific python class
|
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:]
|
[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
|
[Default:] none
|
||||||
|
|
||||||
@ -245,7 +245,8 @@ fix_pour.html
|
|||||||
fix_press_berendsen.html
|
fix_press_berendsen.html
|
||||||
fix_print.html
|
fix_print.html
|
||||||
fix_property_atom.html
|
fix_property_atom.html
|
||||||
fix_python.html
|
fix_python_invoke.html
|
||||||
|
fix_python_move.html
|
||||||
fix_qbmsst.html
|
fix_qbmsst.html
|
||||||
fix_qeq.html
|
fix_qeq.html
|
||||||
fix_qeq_comb.html
|
fix_qeq_comb.html
|
||||||
|
|||||||
@ -406,7 +406,7 @@ cases, LAMMPS has no simple way to check that something illogical is
|
|||||||
being attempted.
|
being attempted.
|
||||||
|
|
||||||
The same applies to Python functions called during a simulation run at
|
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
|
:line
|
||||||
|
|
||||||
@ -493,6 +493,6 @@ different source files, problems may occur.
|
|||||||
|
|
||||||
[Related commands:]
|
[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
|
[Default:] none
|
||||||
|
|||||||
@ -33,8 +33,8 @@ def post_force_callback(lmp, v):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
fix 1 all nve
|
fix 1 all nve
|
||||||
fix 2 all python 50 end_of_step end_of_step_callback
|
fix 2 all python/invoke 50 end_of_step end_of_step_callback
|
||||||
fix 3 all python 50 post_force post_force_callback
|
fix 3 all python/invoke 50 post_force post_force_callback
|
||||||
|
|
||||||
#dump id all atom 50 dump.melt
|
#dump id all atom 50 dump.melt
|
||||||
|
|
||||||
4
src/.gitignore
vendored
4
src/.gitignore
vendored
@ -910,8 +910,8 @@
|
|||||||
/python_compat.h
|
/python_compat.h
|
||||||
/fix_python_move.cpp
|
/fix_python_move.cpp
|
||||||
/fix_python_move.h
|
/fix_python_move.h
|
||||||
/fix_python.cpp
|
/fix_python_invoke.cpp
|
||||||
/fix_python.h
|
/fix_python_invoke.h
|
||||||
/pair_python.cpp
|
/pair_python.cpp
|
||||||
/pair_python.h
|
/pair_python.h
|
||||||
/reader_molfile.cpp
|
/reader_molfile.cpp
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "fix_python.h"
|
#include "fix_python_invoke.h"
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "update.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)
|
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]);
|
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
|
// ensure Python interpreter is initialized
|
||||||
python->init();
|
python->init();
|
||||||
@ -48,7 +48,7 @@ FixPython::FixPython(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
} else if (strcmp(arg[4],"end_of_step") == 0) {
|
} else if (strcmp(arg[4],"end_of_step") == 0) {
|
||||||
selected_callback = END_OF_STEP;
|
selected_callback = END_OF_STEP;
|
||||||
} else {
|
} else {
|
||||||
error->all(FLERR,"Unsupported callback name for fix/python");
|
error->all(FLERR,"Unsupported callback name for fix python/invoke");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get Python function
|
// get Python function
|
||||||
@ -74,14 +74,14 @@ FixPython::FixPython(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
int FixPython::setmask()
|
int FixPythonInvoke::setmask()
|
||||||
{
|
{
|
||||||
return selected_callback;
|
return selected_callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
void FixPython::end_of_step()
|
void FixPythonInvoke::end_of_step()
|
||||||
{
|
{
|
||||||
PyGILState_STATE gstate = PyGILState_Ensure();
|
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;
|
if (update->ntimestep % nevery != 0) return;
|
||||||
|
|
||||||
@ -13,21 +13,22 @@
|
|||||||
|
|
||||||
#ifdef FIX_CLASS
|
#ifdef FIX_CLASS
|
||||||
|
|
||||||
FixStyle(python,FixPython)
|
FixStyle(python,FixPythonInvoke)
|
||||||
|
FixStyle(python/invoke,FixPythonInvoke)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef LMP_FIX_PYTHON_H
|
#ifndef LMP_FIX_PYTHON_INVOKE_H
|
||||||
#define LMP_FIX_PYTHON_H
|
#define LMP_FIX_PYTHON_INVOKE_H
|
||||||
|
|
||||||
#include "fix.h"
|
#include "fix.h"
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class FixPython : public Fix {
|
class FixPythonInvoke : public Fix {
|
||||||
public:
|
public:
|
||||||
FixPython(class LAMMPS *, int, char **);
|
FixPythonInvoke(class LAMMPS *, int, char **);
|
||||||
virtual ~FixPython() {}
|
virtual ~FixPythonInvoke() {}
|
||||||
int setmask();
|
int setmask();
|
||||||
virtual void end_of_step();
|
virtual void end_of_step();
|
||||||
virtual void post_force(int);
|
virtual void post_force(int);
|
||||||
@ -16,6 +16,9 @@ style_region.h
|
|||||||
style_neigh_bin.h
|
style_neigh_bin.h
|
||||||
style_neigh_pair.h
|
style_neigh_pair.h
|
||||||
style_neigh_stencil.h
|
style_neigh_stencil.h
|
||||||
|
# deleted on 15 December 2017
|
||||||
|
fix_python.cpp
|
||||||
|
fix_python.h
|
||||||
# deleted on 11 October 2017
|
# deleted on 11 October 2017
|
||||||
fix_shear_history_omp.cpp
|
fix_shear_history_omp.cpp
|
||||||
fix_shear_history_omp.h
|
fix_shear_history_omp.h
|
||||||
|
|||||||
Reference in New Issue
Block a user