forked from lijiext/lammps
Clean up after renaming back to fix python/move
This commit is contained in:
parent
4d725c3153
commit
950bfb84a9
|
@ -2,7 +2,7 @@ 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
|
||||
to reimplement NVE using Python.
|
||||
|
||||
in.fix_python_nve_melt:
|
||||
in.fix_python_move_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
|
||||
instance of the py_nve.NVE class which implements the required interface.
|
||||
|
@ -10,7 +10,7 @@ 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_python_move_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.
|
||||
|
|
|
@ -908,8 +908,8 @@
|
|||
/python_impl.cpp
|
||||
/python_impl.h
|
||||
/python_compat.h
|
||||
/fix_move_python.cpp
|
||||
/fix_move_python.h
|
||||
/fix_python_move.cpp
|
||||
/fix_python_move.h
|
||||
/fix_python.cpp
|
||||
/fix_python.h
|
||||
/pair_python.cpp
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
@ -80,8 +80,8 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
|
|||
// 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);
|
||||
|
@ -93,10 +93,10 @@ 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);
|
||||
|
@ -104,7 +104,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
|
|||
}
|
||||
|
||||
// check object interface
|
||||
py_integrator = (void *) py_integrator_obj;
|
||||
py_move = (void *) py_move_obj;
|
||||
|
||||
PyGILState_Release(gstate);
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) :
|
|||
FixPythonMove::~FixPythonMove()
|
||||
{
|
||||
PyGILState_STATE gstate = PyGILState_Ensure();
|
||||
if(py_integrator) Py_DECREF((PyObject*) py_integrator);
|
||||
if(py_move) Py_DECREF((PyObject*) py_move);
|
||||
PyGILState_Release(gstate);
|
||||
}
|
||||
|
||||
|
@ -135,8 +135,8 @@ int FixPythonMove::setmask()
|
|||
void FixPythonMove::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();
|
||||
|
@ -152,8 +152,8 @@ void FixPythonMove::init()
|
|||
void FixPythonMove::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();
|
||||
|
@ -171,8 +171,8 @@ void FixPythonMove::initial_integrate(int vflag)
|
|||
void FixPythonMove::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();
|
||||
|
@ -188,8 +188,8 @@ void FixPythonMove::final_integrate()
|
|||
void FixPythonMove::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();
|
||||
|
@ -207,8 +207,8 @@ void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop)
|
|||
void FixPythonMove::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();
|
||||
|
@ -226,8 +226,8 @@ void FixPythonMove::final_integrate_respa(int ilevel, int iloop)
|
|||
void FixPythonMove::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();
|
||||
|
|
|
@ -48,7 +48,7 @@ class FixPythonMove : public Fix {
|
|||
virtual void reset_dt();
|
||||
|
||||
protected:
|
||||
void * py_integrator;
|
||||
void * py_move;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue