Add and use lammps_flush_buffers() in Python interface
This commit is contained in:
@ -164,6 +164,7 @@ class lammps(object):
|
|||||||
self.lib.lammps_open.restype = c_void_p
|
self.lib.lammps_open.restype = c_void_p
|
||||||
self.lib.lammps_open_no_mpi.restype = c_void_p
|
self.lib.lammps_open_no_mpi.restype = c_void_p
|
||||||
self.lib.lammps_close.argtypes = [c_void_p]
|
self.lib.lammps_close.argtypes = [c_void_p]
|
||||||
|
self.lib.lammps_flush_buffers.argtypes = [c_void_p]
|
||||||
self.lib.lammps_free.argtypes = [c_void_p]
|
self.lib.lammps_free.argtypes = [c_void_p]
|
||||||
|
|
||||||
self.lib.lammps_file.argtypes = [c_void_p, c_char_p]
|
self.lib.lammps_file.argtypes = [c_void_p, c_char_p]
|
||||||
@ -1118,6 +1119,16 @@ class lammps(object):
|
|||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def flush_buffers(self):
|
||||||
|
"""Flush output buffers
|
||||||
|
|
||||||
|
This is a wrapper around the :cpp:func:`lammps_flush_buffers`
|
||||||
|
function of the C-library interface.
|
||||||
|
"""
|
||||||
|
self.lib.lammps_flush_buffers(self.lmp)
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
def set_variable(self,name,value):
|
def set_variable(self,name,value):
|
||||||
"""Set a new value for a LAMMPS string style variable
|
"""Set a new value for a LAMMPS string style variable
|
||||||
|
|
||||||
|
|||||||
@ -857,10 +857,12 @@ class PyLammps(object):
|
|||||||
"""
|
"""
|
||||||
def handler(*args, **kwargs):
|
def handler(*args, **kwargs):
|
||||||
cmd_args = [name] + [str(x) for x in args]
|
cmd_args = [name] + [str(x) for x in args]
|
||||||
|
self.lmp.flush_buffers()
|
||||||
|
|
||||||
with OutputCapture() as capture:
|
with OutputCapture() as capture:
|
||||||
cmd = ' '.join(cmd_args)
|
cmd = ' '.join(cmd_args)
|
||||||
self.command(cmd)
|
self.command(cmd)
|
||||||
|
self.lmp.flush_buffers()
|
||||||
output = capture.output
|
output = capture.output
|
||||||
|
|
||||||
comm = self.lmp.get_mpi_comm()
|
comm = self.lmp.get_mpi_comm()
|
||||||
|
|||||||
Reference in New Issue
Block a user