Several improvements to capabilities and build.

- cmake fixed, no longer needs numpy headers.
- models can be loaded from an external interepreter.
This commit is contained in:
Nicholas Lubbers
2020-11-26 12:40:28 -07:00
parent 7c1634e57f
commit 35f2c9bdf2
18 changed files with 369 additions and 89 deletions

View File

@ -28,6 +28,9 @@
#ifdef LMP_MLIAPPY
#include "mliap_model_python.h"
// The above should somehow really be included in the next file.
// We could get around this with cython --capi-reexport-cincludes
// However, that exposes -too many- headers.
#include "mliap_model_python_couple.h"
#endif
@ -52,7 +55,6 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp)
nfunc = 0;
pfuncs = nullptr;
// one-time initialization of Python interpreter
// pyMain stores pointer to main module
external_interpreter = Py_IsInitialized();
@ -61,7 +63,7 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp)
// Inform python intialization scheme of the mliappy module.
// This -must- happen before python is initialized.
int err = PyImport_AppendInittab("mliap_model_python_couple", PyInit_mliap_model_python_couple);
// todo: catch if error and report problem.
if (err) error->all(FLERR,"Could not register MLIAPPY embedded python module.");
#endif
Py_Initialize();