diff --git a/python/lammps/pylammps.py b/python/lammps/pylammps.py index cdb6620c27..1a64adb6ed 100644 --- a/python/lammps/pylammps.py +++ b/python/lammps/pylammps.py @@ -457,8 +457,9 @@ class PyLammps(object): :vartype run: list """ - def __init__(self, name="", cmdargs=None, ptr=None, comm=None): + def __init__(self, name="", cmdargs=None, ptr=None, comm=None, verbose=False): self.has_echo = False + self.verbose = verbose if cmdargs: if '-echo' in cmdargs: @@ -869,8 +870,8 @@ class PyLammps(object): if comm: output = self.lmp.comm.bcast(output, root=0) - if 'verbose' in kwargs and kwargs['verbose']: - print(output) + if self.verbose or ('verbose' in kwargs and kwargs['verbose']): + print(output, end = '') lines = output.splitlines() @@ -984,4 +985,4 @@ class IPyLammps(PyLammps): :rtype: :py:class:`IPython.display.HTML` """ from IPython.display import HTML - return HTML("") + return HTML("") \ No newline at end of file