From a99873a8fe83bef0169341bd0471e33946f4396f Mon Sep 17 00:00:00 2001 From: Felix Pultar Date: Tue, 17 Oct 2023 17:02:44 +0200 Subject: [PATCH] fix in gromosPP Signed-off-by: Felix Pultar --- pygromos/gromos/gromosPP.py | 19 ++++++++++--------- pygromos/utils/bash.py | 1 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pygromos/gromos/gromosPP.py b/pygromos/gromos/gromosPP.py index 3359747e..982a9e7b 100644 --- a/pygromos/gromos/gromosPP.py +++ b/pygromos/gromos/gromosPP.py @@ -931,7 +931,7 @@ def ran_box( in_cnf_path: str, out_cnf_path: str = "", periodic_boundary_condition: str = "r", - nmolecule: int = 1, + nmolecule: str = "1", dens: float = 1.0, threshold: float = None, layer: bool = False, @@ -972,21 +972,21 @@ def ran_box( + " @pos " + in_cnf_path + " @nsm " - + str(nmolecule) + + nmolecule + " @dens " + str(dens) + " " + command_suffix + " > " + out_cnf_path - + " \n" ) - if not return_command_only: - print(command) - bash.execute(command, verbose=verbose) - return out_cnf_path - else: - return command + + + p = bash.execute(command, verbose=verbose) + if verbose: + print(p.stdout) + print(p.stderr) + return out_cnf_path @_gromosClass._gromosTypeConverter def build_box( @@ -1131,6 +1131,7 @@ def red_top(self, in_top_path: str, atom_selection: str, out_top_path: str, _bin "> " + out_top_path + " \n", ] bash.execute(command) + return out_top_path @_gromosClass._gromosTypeConverter diff --git a/pygromos/utils/bash.py b/pygromos/utils/bash.py index 0e25a257..d831d551 100644 --- a/pygromos/utils/bash.py +++ b/pygromos/utils/bash.py @@ -810,6 +810,7 @@ def execute_subprocess( env = os.environ.copy() p = sub.Popen(args=command, shell=True, stderr=sub.PIPE, env=env, **kwargs) + out, err = p.communicate() # print(p, vars(p)) try: