add python module support for plugins
This commit is contained in:
@ -264,6 +264,9 @@ class lammps(object):
|
||||
|
||||
self.lib.lammps_id_name.argtypes = [c_void_p, c_char_p, c_int, c_char_p, c_int]
|
||||
|
||||
self.lib.lammps_plugin_count.argtypes = [ ]
|
||||
self.lib.lammps_plugin_name.argtypes = [c_int, c_char_p, c_char_p, c_int]
|
||||
|
||||
self.lib.lammps_version.argtypes = [c_void_p]
|
||||
|
||||
self.lib.lammps_get_os_info.argtypes = [c_char_p, c_int]
|
||||
@ -1594,6 +1597,29 @@ class lammps(object):
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
def available_plugins(self, category):
|
||||
"""Returns a list of plugins available for a given category
|
||||
|
||||
This is a wrapper around the functions :cpp:func:`lammps_plugin_count()`
|
||||
and :cpp:func:`lammps_plugin_name()` of the library interface.
|
||||
|
||||
.. versionadded:: 10Mar2021
|
||||
|
||||
:return: list of style/name pairs of loaded plugins
|
||||
:rtype: list
|
||||
"""
|
||||
|
||||
available_plugins = []
|
||||
num = self.lib.lammps_plugin_count(self.lmp)
|
||||
sty = create_string_buffer(100)
|
||||
nam = create_string_buffer(100)
|
||||
for idx in range(num):
|
||||
self.lib.lammps_plugin_name(idx, sty, nam, 100)
|
||||
available_plugins.append([sty.value.decode(), nam.value.decode()])
|
||||
return available_plugins
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
def set_fix_external_callback(self, fix_name, callback, caller=None):
|
||||
import numpy as np
|
||||
|
||||
|
||||
Reference in New Issue
Block a user