From 8c341dde9ee3cdc9d2ea70d5324c3bda0e54f2df Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Fri, 14 Jul 2017 20:09:13 -0500 Subject: [PATCH] Update qp_convert_qmcpack_to_ezfio.py --- plugins/QMC/qp_convert_qmcpack_to_ezfio.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/QMC/qp_convert_qmcpack_to_ezfio.py b/plugins/QMC/qp_convert_qmcpack_to_ezfio.py index 80a530fa..4e8a50d2 100755 --- a/plugins/QMC/qp_convert_qmcpack_to_ezfio.py +++ b/plugins/QMC/qp_convert_qmcpack_to_ezfio.py @@ -129,7 +129,6 @@ print "END_BASIS_SET" # # Function # -# d_gms_order ={ 0:["s"], 1:[ "x", "y", "z" ], 2:[ "xx", "yy", "zz", "xy", "xz", "yz" ], @@ -144,7 +143,9 @@ def compare_gamess_style(item1, item2): except KeyError: raise (KeyError, "We dont handle L than 4") else: - return l.index(item1) > l.index(item2) + a = l.index(item1) + b = l.index(item2) + return cmp( a, b ) def expend_sym_str(str_): #Expend x2 -> xx @@ -202,6 +203,7 @@ def order_l_l_sym(l_l_sym): #========================== # We will order the symetry #========================== + l_sym_without_header = sym_raw.split("\n")[3:-2] l_l_sym_raw = [i.split() for i in l_sym_without_header] l_l_sym_expend_sym = expend_sym_l(l_l_sym_raw) @@ -343,7 +345,8 @@ pos = det_raw.rfind(token) + len(token) det_without_header = det_raw[pos+2::] -d_rep={"+":"1","-":"0"} +from string import maketrans +trantab = maketrans("+-", "10") det_without_header = det_raw[pos+2::] @@ -354,7 +357,7 @@ for line_raw in det_without_header.split("\n"): try: float(line) except ValueError: - line= "".join(d_rep[x] if x in d_rep else x for x in line_raw) + line = line_raw.translate(trantab) print line.strip()