10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-22 21:22:17 +02:00

Working MO git add plugins/qmcpack/qp_convert_qmcpack_to_ezfio.py!

This commit is contained in:
TApplencourt 2016-02-08 11:10:24 +01:00
parent ad21a3b8ce
commit 8c5338a081

View File

@ -175,29 +175,31 @@ def get_nb_permutation(str_):
def order_l_l_sym(l_l_sym): def order_l_l_sym(l_l_sym):
l_l_sym_iter = iter(l_l_sym) n = 1
for i, l in enumerate(l_l_sym_iter): for i in range(len(l_l_sym)):
n = get_nb_permutation(l[2])
if n != 1: if n != 1:
l_l_sym[i:i + n] = sorted(l_l_sym[i:i + n], n += -1
key=lambda x: x[2], continue
cmp=compare_gamess_style)
for next_ in range(n - 1): l = l_l_sym[i]
next(l_l_sym_iter) n = get_nb_permutation(l[2])
l_l_sym[i:i + n] = sorted(l_l_sym[i:i + n],
key=lambda x: x[2],
cmp=compare_gamess_style)
return l_l_sym return l_l_sym
#========================== #==========================
# We will order the symetry # We will order the symetry
#========================== #==========================
l_sym_without_header = sym_raw.split("\n")[3:-2] 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_raw = [i.split() for i in l_sym_without_header]
l_l_sym_expend_sym = expend_sym_l(l_l_sym_raw) l_l_sym_expend_sym = expend_sym_l(l_l_sym_raw)
l_l_sym_ordered = order_l_l_sym(l_l_sym_expend_sym) l_l_sym_ordered = order_l_l_sym(l_l_sym_expend_sym)
#======== #========
#MO COEF #MO COEF
#======== #========
@ -220,14 +222,6 @@ def order_phase(mo_coef):
mo_coef_phase.append(ii) mo_coef_phase.append(ii)
return mo_coef_phase return mo_coef_phase
def order_by_sim(mo_coef, l_l_sym):
l_sym_oder = [int(l[0]) - 1 for l in l_l_sym]
mo_coef_order = [[x for (y, x) in sorted(zip(l_sym_oder, i))]
for i in mo_coef]
return mo_coef_order
def chunked(l, chunks_size): def chunked(l, chunks_size):
l_block = [] l_block = []
for i in l: for i in l:
@ -264,9 +258,8 @@ def print_mo_coef(mo_coef_block, l_l_sym):
mo_coef = ezfio.get_mo_basis_mo_coef() mo_coef = ezfio.get_mo_basis_mo_coef()
#mo_coef_phase = order_phase(mo_coef)
mo_coef_phase = mo_coef mo_coef_phase = mo_coef
mo_coef_phase_order = order_by_sim(mo_coef_phase, l_l_sym_ordered) mo_coef_phase_order = mo_coef_phase
mo_coef_transp = zip(*mo_coef_phase_order) mo_coef_transp = zip(*mo_coef_phase_order)
mo_coef_block = chunked(mo_coef_transp, 4) mo_coef_block = chunked(mo_coef_transp, 4)
print_mo_coef(mo_coef_block, l_l_sym_ordered) print_mo_coef(mo_coef_block, l_l_sym_ordered)