10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-25 14:42:15 +02:00

Pseudo is read from resultsFile

This commit is contained in:
Anthony Scemama 2017-04-11 16:10:41 +02:00
parent a9f225ef89
commit 4715857b07

View File

@ -3,7 +3,7 @@
convert output of gamess/GAU$$IAN to ezfio
Usage:
qp_convert_output_to_ezfio.py <file.out> [--ezfio=<folder.ezfio>]
qp_convert_output_to_ezfio.py <file.out> [--ezfio=<ezfio_directory>]
Option:
file.out is the file to check (like gamess.out)
@ -271,7 +271,7 @@ def write_ezfio(res, filename):
#
# INPUT
# {% for lanel,zcore, l_block in l_atom $}
# {% for label,zcore, l_block in l_atom $}
# #local l_block l=0}
# {label} GEN {zcore} {len(l_block)-1 #lmax_block}
# {% for l_param in l_block%}
@ -279,6 +279,7 @@ def write_ezfio(res, filename):
# {% for coef,n,zeta for l_param}
# {coef,n, zeta}
# OUTPUT
# Local are 1 array padded by max(n_max_block) when l == 0 (output:k_loc_max)
@ -308,8 +309,16 @@ def write_ezfio(res, filename):
array_l_max_block.append(l_max_block)
array_z_remove.append(z_remove)
matrix.append([[coef_n_zeta.split()[1:] for coef_n_zeta in l.split('\n')] for l in array_party[1:]])
x = [[coef_n_zeta.split() for coef_n_zeta in l.split('\n')] \
for l in array_party[1:] ]
x = []
for l in array_party[1:]:
y = []
for coef_n_zeta in l.split('\n'):
z = coef_n_zeta.split()
if z : y.append(z)
x.append(y)
matrix.append(x)
return (matrix, array_l_max_block, array_z_remove)
def get_local_stuff(matrix):
@ -318,7 +327,6 @@ def write_ezfio(res, filename):
k_loc_max = max(len(i) for i in matrix_local_unpad)
matrix_local = [ pad(ll, k_loc_max, [0., 2, 0.]) for ll in matrix_local_unpad]
m_coef = [[float(i[0]) for i in atom] for atom in matrix_local]
m_n = [[int(i[1]) - 2 for i in atom] for atom in matrix_local]
m_zeta = [[float(i[2]) for i in atom] for atom in matrix_local]
@ -342,8 +350,21 @@ def write_ezfio(res, filename):
return (l_max_block, k_max, m_coef_noloc, m_n_noloc, m_zeta_noloc)
try:
pseudo_str = res_file.get_pseudo()
pseudo_str = []
label = ezfio.get_nuclei_nucl_label()
for ecp in res.pseudo:
pseudo_str += [ "%(label)s GEN %(zcore)d %(lmax)d" % { "label": label[ ecp["atom"]-1 ],
"zcore": ecp["zcore"], "lmax": ecp["lmax"] } ]
lmax = ecp["lmax"]
for l in [lmax] + list(range(0,lmax)):
pseudo_str += [ "%d"%len(ecp[str(l)]) ]
for t in ecp[str(l)]:
pseudo_str += [ "%f %d %f"%t ]
pseudo_str += [""]
pseudo_str = "\n".join(pseudo_str)
matrix, array_l_max_block, array_z_remove = parse_str(pseudo_str)
array_z_remove = map(float,array_z_remove)
except:
ezfio.set_pseudo_do_pseudo(False)
else:
@ -353,16 +374,18 @@ def write_ezfio(res, filename):
# Z _ e f f , a l p h a / b e t a _ e l e c #
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
ezfio.pseudo_charge_remove = array_z_remove
ezfio.nuclei_nucl_charge = [
i - j for i, j in zip(ezfio.nuclei_nucl_charge, array_z_remove)
]
ezfio.set_pseudo_nucl_charge_remove(array_z_remove)
charge = ezfio.get_nuclei_nucl_charge()
charge = [ i - j for i, j in zip(charge, array_z_remove) ]
ezfio.set_nuclei_nucl_charge (charge)
import math
num_elec = sum(ezfio.nuclei_nucl_charge)
num_elec_diff = sum(array_z_remove)/2
nalpha = ezfio.get_electrons_elec_alpha_num() - num_elec_diff
nbeta = ezfio.get_electrons_elec_beta_num() - num_elec_diff
ezfio.electrons_elec_alpha_num = int(math.ceil(num_elec / 2.))
ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.))
ezfio.set_electrons_elec_alpha_num(nalpha)
ezfio.set_electrons_elec_beta_num( nbeta )
# Change all the array 'cause EZFIO
# v_kl (v, l) => v_kl(l,v)
@ -421,3 +444,4 @@ if __name__ == '__main__':
print file_, 'recognized as', str(res_file).split('.')[-1].split()[0]
write_ezfio(res_file, ezfio_file)
os.system("qp_run save_ortho_mos "+ezfio_file)