Refactor PYTHON package and wrapper classes

This commit is contained in:
Richard Berger
2017-04-11 21:22:30 -04:00
parent 9a027a01da
commit 2d8bce78a6
11 changed files with 280 additions and 58 deletions

View File

@ -34,7 +34,7 @@
#include "random_mars.h"
#include "math_const.h"
#include "atom_masks.h"
#include "python_wrapper.h"
#include "python.h"
#include "memory.h"
#include "info.h"
#include "error.h"
@ -111,10 +111,6 @@ Variable::Variable(LAMMPS *lmp) : Pointers(lmp)
precedence[MULTIPLY] = precedence[DIVIDE] = precedence[MODULO] = 6;
precedence[CARAT] = 7;
precedence[UNARY] = precedence[NOT] = 8;
// Python wrapper, real or dummy
python = new Python(lmp);
}
/* ---------------------------------------------------------------------- */
@ -144,7 +140,6 @@ Variable::~Variable()
delete randomequal;
delete randomatom;
delete python;
}
/* ----------------------------------------------------------------------
@ -464,7 +459,7 @@ void Variable::set(int narg, char **arg)
} else if (strcmp(arg[1],"python") == 0) {
if (narg != 3) error->all(FLERR,"Illegal variable command");
if (!python->python_exists)
if (!python->is_enabled())
error->all(FLERR,"LAMMPS is not built with Python embedded");
int ivar = find(arg[0]);
if (ivar >= 0) {
@ -735,7 +730,7 @@ void Variable::set_arrays(int i)
void Variable::python_command(int narg, char **arg)
{
if (!python->python_exists)
if (!python->is_enabled())
error->all(FLERR,"LAMMPS is not built with Python embedded");
python->command(narg,arg);
}