10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-07 20:05:56 +02:00

Fixed pseudos

This commit is contained in:
Anthony Scemama 2017-05-24 15:24:51 +02:00
parent 70d52c126a
commit 20e7a23ef7
2 changed files with 40 additions and 16 deletions

View File

@ -38,7 +38,7 @@ subroutine run_wf
do do
call wait_for_states(states,zmq_state,3) call wait_for_states(states,zmq_state,4)
if(trim(zmq_state) == 'Stopped') then if(trim(zmq_state) == 'Stopped') then

View File

@ -3,7 +3,7 @@
convert output of gamess/GAU$$IAN to ezfio convert output of gamess/GAU$$IAN to ezfio
Usage: Usage:
qp_convert_output_to_ezfio.py <file.out> [--ezfio=<folder.ezfio>] qp_convert_output_to_ezfio.py <file.out> [--ezfio=<ezfio_directory>]
Option: Option:
file.out is the file to check (like gamess.out) file.out is the file to check (like gamess.out)
@ -20,18 +20,17 @@ from functools import reduce
# Add to the path # # Add to the path #
# ~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~ #
try: try:
QP_ROOT = os.environ["QP_ROOT"] QP_ROOT = os.environ["QP_ROOT"]
except: except:
print "Error: QP_ROOT environment variable not found." print "Error: QP_ROOT environment variable not found."
sys.exit(1) sys.exit(1)
else: else:
sys.path = [ QP_ROOT + "/install/EZFIO/Python", sys.path = [ QP_ROOT + "/install/EZFIO/Python",
QP_ROOT + "/resultsFile", QP_ROOT + "/resultsFile",
QP_ROOT + "/scripts"] + sys.path QP_ROOT + "/scripts"] + sys.path
# ~#~#~#~#~#~ # # ~#~#~#~#~#~ #
# I m p o r t # # I m p o r t #
# ~#~#~#~#~#~ # # ~#~#~#~#~#~ #
@ -280,12 +279,13 @@ def write_ezfio(res, filename):
# {% for coef,n,zeta for l_param} # {% for coef,n,zeta for l_param}
# {coef,n, zeta} # {coef,n, zeta}
# OUTPUT # OUTPUT
# Local are 1 array padded by max(n_max_block) when l == 0 (output:k_loc_max) # Local are 1 array padded by max(n_max_block) when l == 0 (output:k_loc_max)
# v_k[n-2][atom] = value # v_k[n-2][atom] = value
#No Local are 2 array padded with max of lmax_block when l!=0 (output:lmax+1) and max(n_max_block)whem l !=0 (kmax) #Non Local are 2 array padded with max of lmax_block when l!=0 (output:lmax+1) and max(n_max_block)whem l !=0 (kmax)
# v_kl[l][n-2][atom] = value # v_kl[l][n-2][atom] = value
def pad(array, size, value=0): def pad(array, size, value=0):
@ -309,8 +309,16 @@ def write_ezfio(res, filename):
array_l_max_block.append(l_max_block) array_l_max_block.append(l_max_block)
array_z_remove.append(z_remove) 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) return (matrix, array_l_max_block, array_z_remove)
def get_local_stuff(matrix): def get_local_stuff(matrix):
@ -319,7 +327,6 @@ def write_ezfio(res, filename):
k_loc_max = max(len(i) for i in matrix_local_unpad) 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] 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_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_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] m_zeta = [[float(i[2]) for i in atom] for atom in matrix_local]
@ -343,26 +350,42 @@ def write_ezfio(res, filename):
return (l_max_block, k_max, m_coef_noloc, m_n_noloc, m_zeta_noloc) return (l_max_block, k_max, m_coef_noloc, m_n_noloc, m_zeta_noloc)
try: 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) matrix, array_l_max_block, array_z_remove = parse_str(pseudo_str)
array_z_remove = map(float,array_z_remove)
except: except:
ezfio.set_pseudo_do_pseudo(False) ezfio.set_pseudo_do_pseudo(False)
else: else:
ezfio.set_pseudo_do_pseudo(True) ezfio.set_pseudo_do_pseudo(True)
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ #
# Z _ e f f , a l p h a / b e t a _ e l e c # # 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.set_pseudo_nucl_charge_remove(array_z_remove)
ezfio.nuclei_nucl_charge = [i - j for i, j in zip(ezfio.nuclei_nucl_charge, 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 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.set_electrons_elec_alpha_num(nalpha)
ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.)) ezfio.set_electrons_elec_beta_num( nbeta )
# Change all the array 'cause EZFIO # Change all the array 'cause EZFIO
# v_kl (v, l) => v_kl(l,v) # 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] print file_, 'recognized as', str(res_file).split('.')[-1].split()[0]
write_ezfio(res_file, ezfio_file) write_ezfio(res_file, ezfio_file)
os.system("qp_run save_ortho_mos "+ezfio_file)