add check to lammps python module to check consistent versions between module and shared library

This commit is contained in:
Axel Kohlmeyer
2021-02-09 00:38:17 -05:00
parent db26902393
commit 7826b58f73
3 changed files with 35 additions and 1 deletions

View File

@ -381,6 +381,12 @@ class lammps(object):
self._installed_packages = None
self._available_styles = None
# check if liblammps version matches the installed python module version
import lammps
if lammps.__version__ != self.lib.lammps_version(self.lmp):
raise(AttributeError("LAMMPS Python module installed for LAMMPS version %d, but shared library is version %d" \
% (lammps.__version__, self.lib.lammps_version(self.lmp))))
# add way to insert Python callback for fix external
self.callback = {}
self.FIX_EXTERNAL_CALLBACK_FUNC = CFUNCTYPE(None, py_object, self.c_bigint, c_int, POINTER(self.c_tagint), POINTER(POINTER(c_double)), POINTER(POINTER(c_double)))