1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-11-07 14:43:41 +01:00

Fixed Python3

This commit is contained in:
Anthony Scemama 2020-05-13 00:54:02 +02:00
parent 1568f6cd20
commit 164bf79053

View File

@ -93,7 +93,7 @@ process = subprocess.Popen(
stdout=subprocess.PIPE)
out, err = process.communicate()
basis_raw, sym_raw, _ = out.split("\n\n\n")
basis_raw, sym_raw, _ = out.decode().split("\n\n\n")
# _ __
# |_) _. _ o _ (_ _ _|_
@ -131,24 +131,20 @@ print("END_BASIS_SET")
#
# Function
#
d_gms_order ={ 0:["s"],
1:[ "x", "y", "z" ],
2:[ "xx", "yy", "zz", "xy", "xz", "yz" ],
3:[ "xxx", "yyy", "zzz", "xxy", "xxz", "yyx", "yyz", "zzx", "zzy", "xyz"],
4:[ "xxxx", "yyyy", "zzzz", "xxxy", "xxxz", "yyyx", "yyyz", "zzzx", "zzzy", "xxyy", "xxzz", "yyzz", "xxyz", "yyxz", "zzxy"] }
d_gms_order = ["s",
"x", "y", "z" ,
"xx", "yy", "zz", "xy", "xz", "yz" ,
"xxx", "yyy", "zzz", "xxy", "xxz", "yyx", "yyz", "zzx", "zzy", "xyz",
"xxxx", "yyyy", "zzzz", "xxxy", "xxxz", "yyyx", "yyyz", "zzzx", "zzzy", "xxyy", "xxzz", "yyzz", "xxyz", "yyxz", "zzxy"]
def compare_gamess_style(item1, item2):
n1,n2 = list(map(len,(item1,item2)))
assert (n1 == n2)
def key_gamess_style(item1):
try:
l = d_gms_order[n1]
except KeyError:
l = d_gms_order.index(item1)
except ValueError:
return 0
# raise (KeyError, "We dont handle L than 4")
else:
a = l.index(item1)
b = l.index(item2)
return cmp( a, b )
result = d_gms_order.index(item1)
return result
def expend_sym_str(str_):
#Expend x2 -> xx
@ -184,6 +180,7 @@ def get_nb_permutation(str_):
if (str_) == 's': return 1
else: return n_orbital(len(str_))
import functools
def order_l_l_sym(l_l_sym):
n = 1
iter_ = list(range(len(l_l_sym)))
@ -195,9 +192,11 @@ def order_l_l_sym(l_l_sym):
l = l_l_sym[i]
n = get_nb_permutation(l[2])
def local_key(x):
return key_gamess_style(x[2])
l_l_sym[i:i + n] = sorted(l_l_sym[i:i + n],
key=lambda x: x[2],
cmp=compare_gamess_style)
key=local_key)
return l_l_sym