make lammps_config_has_package() accessible in Python module
This commit is contained in:
@ -265,6 +265,7 @@ class lammps(object):
|
|||||||
|
|
||||||
self.lib.lammps_encode_image_flags.restype = self.c_imageint
|
self.lib.lammps_encode_image_flags.restype = self.c_imageint
|
||||||
|
|
||||||
|
self.lib.lammps_config_has_package.argtypes = [c_char_p]
|
||||||
self.lib.lammps_config_package_name.argtypes = [c_int, c_char_p, c_int]
|
self.lib.lammps_config_package_name.argtypes = [c_int, c_char_p, c_int]
|
||||||
self.lib.lammps_config_accelerator.argtypes = [c_char_p, c_char_p, c_char_p]
|
self.lib.lammps_config_accelerator.argtypes = [c_char_p, c_char_p, c_char_p]
|
||||||
|
|
||||||
@ -1627,6 +1628,21 @@ class lammps(object):
|
|||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def has_package(self, name):
|
||||||
|
""" Report if the named package has been enabled in the LAMMPS shared library.
|
||||||
|
|
||||||
|
This is a wrapper around the :cpp:func:`lammps_config_has_package`
|
||||||
|
function of the library interface.
|
||||||
|
|
||||||
|
:param name: name of the package
|
||||||
|
:type name: string
|
||||||
|
|
||||||
|
:return: state of package availability
|
||||||
|
:rtype: bool
|
||||||
|
"""
|
||||||
|
return self.lib.lammps_config_has_package(name.encode()) != 0
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def accelerator_config(self):
|
def accelerator_config(self):
|
||||||
""" Return table with available accelerator configuration settings.
|
""" Return table with available accelerator configuration settings.
|
||||||
|
|||||||
@ -60,6 +60,13 @@ class PythonCapabilities(unittest.TestCase):
|
|||||||
for pkg in selected_packages:
|
for pkg in selected_packages:
|
||||||
self.assertIn(pkg, installed_packages)
|
self.assertIn(pkg, installed_packages)
|
||||||
|
|
||||||
|
def test_has_package(self):
|
||||||
|
selected_packages = [key[4:] for key in self.cmake_cache.keys() if not key.startswith('PKG_CONFIG') and key.startswith('PKG_') and self.cmake_cache[key]]
|
||||||
|
self.assertFalse(self.lmp.has_package('XXXXXX'))
|
||||||
|
|
||||||
|
for pkg in selected_packages:
|
||||||
|
self.assertTrue(self.lmp.has_package(pkg))
|
||||||
|
|
||||||
def test_has_style(self):
|
def test_has_style(self):
|
||||||
self.assertTrue(self.lmp.has_style('pair', 'lj/cut'))
|
self.assertTrue(self.lmp.has_style('pair', 'lj/cut'))
|
||||||
self.assertFalse(self.lmp.has_style('pair', 'lennard_jones'))
|
self.assertFalse(self.lmp.has_style('pair', 'lennard_jones'))
|
||||||
|
|||||||
Reference in New Issue
Block a user