wham exit code

This commit is contained in:
Daniel Bauer
2018-06-20 17:23:55 +02:00
parent f330798c84
commit 4ed88297d4
2 changed files with 7 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
from __future__ import absolute_import from __future__ import absolute_import
from .runner import UmbrellaRunner from .runner import UmbrellaRunner
from .wham2d import WHAM2DRunner
__all__ = ['AdaptiveUmbrella'] __all__ = ['AdaptiveUmbrella']
__version__ = "0.3.0" __version__ = "0.3.1"

View File

@@ -33,6 +33,8 @@ class WHAM2DRunner(UmbrellaRunner):
path = os.path.join(self.tmp_folder, "{}_metadata.dat".format(self.num_iterations)) path = os.path.join(self.tmp_folder, "{}_metadata.dat".format(self.num_iterations))
with open(path, 'w') as out: with open(path, 'w') as out:
for file in os.listdir(self.simulation_folder): for file in os.listdir(self.simulation_folder):
if not os.path.exists(os.path.join(path, file, "COLVAR")):
continue
prefix, x, y = file.split("_") prefix, x, y = file.split("_")
colvar_file = os.path.join(file, 'COLVAR') colvar_file = os.path.join(file, 'COLVAR')
out.write("{file}\t{x}\t{y}\t{fc_x}\t{fc_y}\n".format( out.write("{file}\t{x}\t{y}\t{fc_x}\t{fc_y}\n".format(
@@ -63,10 +65,9 @@ class WHAM2DRunner(UmbrellaRunner):
outfile=output_path outfile=output_path
) )
print(cmd) print(cmd)
try: err_code = subprocess.call(cmd, shell=True)
subprocess.call(cmd, shell=True) if err_code != 0:
except OSError: print("wham exited with error code {}".format(err_corde))
print("wham failed.")
exit(1) exit(1)
def load_wham_pmf(self, wham_file): def load_wham_pmf(self, wham_file):