From 53c148e71b494dab051fce41bfdcd4fe148e8a41 Mon Sep 17 00:00:00 2001 From: Alfio Lazzaro Date: Mon, 24 Apr 2017 17:30:48 +0000 Subject: [PATCH] Exclude cases when the job logs don't have final energy svn-origin-rev: 17867 --- tools/diff_cp2k.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/diff_cp2k.py b/tools/diff_cp2k.py index e7f6428e75..c8ae14f5fd 100755 --- a/tools/diff_cp2k.py +++ b/tools/diff_cp2k.py @@ -221,10 +221,15 @@ def main(): color='\033[0m' endc='\033[0m' for filename in args.file_lists: - comp=(float(files[filename][1])-ref)/ref - if abs(comp)>1e-14: color='\033[91m' - else: color='\033[0m' - print(('{0} ==> {1} : {2} : '+color+'{3}'+endc).format(files[filename][0],filename,files[filename][1],(float(files[filename][1])-ref)/ref)) + if len(files[filename][1])>0: + comp=(float(files[filename][1])-ref)/ref + if abs(comp)>1e-14: color='\033[91m' + else: color='\033[0m' + print(('{0} ==> {1} : {2} : '+color+'{3}'+endc).format(files[filename][0],filename,files[filename][1],(float(files[filename][1])-ref)/ref)) + else: + print(('{0} ==> {1} : ').format(files[filename][0],filename)), + sys.stdout.write(('-'*20).rjust(20)) + print("") print("") @@ -254,7 +259,7 @@ def main(): sys.stdout.write(index_key.ljust(35)) for filename in args.file_lists: if index_key not in dict_stats[filename]: - sys.stdout.write(('-'*20).rjust(20)) + sys.stdout.write(('-'*18).ljust(20)) continue sys.stdout.write(dict_stats[filename][index_key].ljust(20)) print("")