Merge remote-tracking branch 'github/develop' into python_computes
This commit is contained in:
@ -103,7 +103,7 @@ class command_wrapper(object):
|
||||
This method is where the Python 'magic' happens. If a method is not
|
||||
defined by the class command_wrapper, it assumes it is a LAMMPS command. It takes
|
||||
all the arguments, concatinates them to a single string, and executes it using
|
||||
:py:meth:`lammps.command()`.
|
||||
:py:meth:`lammps.command`.
|
||||
|
||||
Starting with Python 3.6 it also supports keyword arguments. key=value is
|
||||
transformed into 'key value'. Note, since these have come last in the
|
||||
@ -426,6 +426,9 @@ class lammps(object):
|
||||
self.lib.lammps_compute_addstep.argtype = [c_void_p, self.c_bigint]
|
||||
self.lib.lammps_compute_addstep_all.argtype = [c_void_p, self.c_bigint]
|
||||
|
||||
self.lib.lammps_eval.argtypes = [c_void_p, c_char_p]
|
||||
self.lib.lammps_eval.restype = c_double
|
||||
|
||||
self.lib.lammps_fix_external_get_force.argtypes = [c_void_p, c_char_p]
|
||||
self.lib.lammps_fix_external_get_force.restype = POINTER(POINTER(c_double))
|
||||
|
||||
@ -1693,6 +1696,30 @@ class lammps(object):
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
def eval(self, expr):
|
||||
""" Evaluate a LAMMPS immediate variable expression
|
||||
|
||||
.. versionadded:: TBD
|
||||
|
||||
This function is a wrapper around the function :cpp:func:`lammps_eval`
|
||||
of the C library interface. It evaluates and expression like in
|
||||
immediate variables and returns the value.
|
||||
|
||||
:param expr: immediate variable expression
|
||||
:type name: string
|
||||
:return: the result of the evaluation
|
||||
:rtype: c_double
|
||||
"""
|
||||
|
||||
if expr: newexpr = expr.encode()
|
||||
else: return None
|
||||
|
||||
with ExceptionCheck(self):
|
||||
return self.lib.lammps_eval(self.lmp, newexpr)
|
||||
return None
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
# return vector of atom properties gathered across procs
|
||||
# 3 variants to match src/library.cpp
|
||||
# name = atom property recognized by LAMMPS in atom->extract()
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
################################################################################
|
||||
|
||||
class wrapper(object):
|
||||
"""lammps API IPython Wrapper
|
||||
""" lammps API IPython Wrapper
|
||||
|
||||
This is a wrapper class that provides additional methods on top of an
|
||||
existing :py:class:`lammps` instance. It provides additional methods
|
||||
|
||||
Reference in New Issue
Block a user