mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-22 20:34:58 +01:00
Merge pull request #121 from kgasperich/dev-real-kpts
This commit is contained in:
commit
263041384e
159
bin/qp_convert_h5_to_ezfio
Executable file
159
bin/qp_convert_h5_to_ezfio
Executable file
@ -0,0 +1,159 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
convert hdf5 output (e.g. from PySCF) to ezfio
|
||||
|
||||
Usage:
|
||||
qp_convert_h5_to_ezfio [-o EZFIO_DIR] FILE
|
||||
|
||||
Options:
|
||||
-o --output=EZFIO_DIR Produced directory
|
||||
by default is FILE.ezfio
|
||||
|
||||
"""
|
||||
from ezfio import ezfio
|
||||
import h5py
|
||||
import sys
|
||||
import numpy as np
|
||||
import os
|
||||
from docopt import docopt
|
||||
#fname = sys.argv[1]
|
||||
#qph5name = sys.argv[2]
|
||||
|
||||
def get_full_path(file_path):
|
||||
file_path = os.path.expanduser(file_path)
|
||||
file_path = os.path.expandvars(file_path)
|
||||
# file_path = os.path.abspath(file_path)
|
||||
return file_path
|
||||
|
||||
def convert_mol(filename,qph5path):
|
||||
ezfio.set_file(filename)
|
||||
ezfio.set_nuclei_is_complex(False)
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
nucl_num = qph5['nuclei'].attrs['nucl_num']
|
||||
ao_num = qph5['ao_basis'].attrs['ao_num']
|
||||
mo_num = qph5['mo_basis'].attrs['mo_num']
|
||||
elec_alpha_num = qph5['electrons'].attrs['elec_alpha_num']
|
||||
elec_beta_num = qph5['electrons'].attrs['elec_beta_num']
|
||||
|
||||
ezfio.set_nuclei_nucl_num(nucl_num)
|
||||
|
||||
ezfio.set_ao_basis_ao_num(ao_num)
|
||||
ezfio.set_mo_basis_mo_num(mo_num)
|
||||
ezfio.electrons_elec_alpha_num = elec_alpha_num
|
||||
ezfio.electrons_elec_beta_num = elec_beta_num
|
||||
|
||||
|
||||
|
||||
##ao_num = mo_num
|
||||
##Important !
|
||||
#import math
|
||||
#nelec_per_kpt = num_elec // n_kpts
|
||||
#nelec_alpha_per_kpt = int(math.ceil(nelec_per_kpt / 2.))
|
||||
#nelec_beta_per_kpt = int(math.floor(nelec_per_kpt / 2.))
|
||||
#
|
||||
#ezfio.electrons_elec_alpha_num = int(nelec_alpha_per_kpt * n_kpts)
|
||||
#ezfio.electrons_elec_beta_num = int(nelec_beta_per_kpt * n_kpts)
|
||||
|
||||
#ezfio.electrons_elec_alpha_num = int(math.ceil(num_elec / 2.))
|
||||
#ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.))
|
||||
|
||||
#ezfio.set_utils_num_kpts(n_kpts)
|
||||
#ezfio.set_integrals_bielec_df_num(n_aux)
|
||||
|
||||
#(old)Important
|
||||
#ezfio.set_nuclei_nucl_num(nucl_num)
|
||||
#ezfio.set_nuclei_nucl_charge([0.]*nucl_num)
|
||||
#ezfio.set_nuclei_nucl_coord( [ [0.], [0.], [0.] ]*nucl_num )
|
||||
#ezfio.set_nuclei_nucl_label( ['He'] * nucl_num )
|
||||
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
nucl_charge=qph5['nuclei/nucl_charge'][()].tolist()
|
||||
nucl_coord=qph5['nuclei/nucl_coord'][()].T.tolist()
|
||||
nucl_label=qph5['nuclei/nucl_label'][()].tolist()
|
||||
nuclear_repulsion = qph5['nuclei'].attrs['nuclear_repulsion']
|
||||
|
||||
ezfio.set_nuclei_nucl_charge(nucl_charge)
|
||||
ezfio.set_nuclei_nucl_coord(nucl_coord)
|
||||
ezfio.set_nuclei_nucl_label(nucl_label)
|
||||
|
||||
ezfio.set_nuclei_io_nuclear_repulsion('Read')
|
||||
ezfio.set_nuclei_nuclear_repulsion(nuclear_repulsion)
|
||||
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# Basis #
|
||||
# #
|
||||
##########################################
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
do_pseudo = qph5['pseudo'].attrs['do_pseudo']
|
||||
ezfio.set_pseudo_do_pseudo(do_pseudo)
|
||||
if (do_pseudo):
|
||||
ezfio.set_pseudo_pseudo_lmax(qph5['pseudo'].attrs['pseudo_lmax'])
|
||||
ezfio.set_pseudo_pseudo_klocmax(qph5['pseudo'].attrs['pseudo_klocmax'])
|
||||
ezfio.set_pseudo_pseudo_kmax(qph5['pseudo'].attrs['pseudo_kmax'])
|
||||
ezfio.set_pseudo_nucl_charge_remove(qph5['pseudo/nucl_charge_remove'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_n_k(qph5['pseudo/pseudo_n_k'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_n_kl(qph5['pseudo/pseudo_n_kl'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_v_k(qph5['pseudo/pseudo_v_k'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_v_kl(qph5['pseudo/pseudo_v_kl'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_dz_k(qph5['pseudo/pseudo_dz_k'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_dz_kl(qph5['pseudo/pseudo_dz_kl'][()].tolist())
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# Basis #
|
||||
# #
|
||||
##########################################
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
#coeftmp = qph5['ao_basis/ao_coef'][()]
|
||||
#expotmp = qph5['ao_basis/ao_expo'][()]
|
||||
ezfio.set_ao_basis_ao_basis(qph5['ao_basis'].attrs['ao_basis'])
|
||||
ezfio.set_ao_basis_ao_nucl(qph5['ao_basis/ao_nucl'][()].tolist())
|
||||
ezfio.set_ao_basis_ao_prim_num(qph5['ao_basis/ao_prim_num'][()].tolist())
|
||||
ezfio.set_ao_basis_ao_power(qph5['ao_basis/ao_power'][()].tolist())
|
||||
ezfio.set_ao_basis_ao_coef(qph5['ao_basis/ao_coef'][()].tolist())
|
||||
ezfio.set_ao_basis_ao_expo(qph5['ao_basis/ao_expo'][()].tolist())
|
||||
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# MO Coef #
|
||||
# #
|
||||
##########################################
|
||||
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
mo_coef = qph5['mo_basis/mo_coef'][()].tolist()
|
||||
ezfio.set_mo_basis_mo_coef(mo_coef)
|
||||
#maybe fix qp so we don't need this?
|
||||
#ezfio.set_mo_basis_mo_coef([[i for i in range(mo_num)] * ao_num])
|
||||
|
||||
return
|
||||
|
||||
if __name__ == '__main__':
|
||||
ARGUMENTS = docopt(__doc__)
|
||||
|
||||
FILE = get_full_path(ARGUMENTS['FILE'])
|
||||
|
||||
if ARGUMENTS["--output"]:
|
||||
EZFIO_FILE = get_full_path(ARGUMENTS["--output"])
|
||||
else:
|
||||
EZFIO_FILE = "{0}.ezfio".format(FILE)
|
||||
|
||||
|
||||
convert_mol(EZFIO_FILE,FILE)
|
||||
|
||||
sys.stdout.flush()
|
||||
if os.system("qp_run save_ortho_mos "+EZFIO_FILE) != 0:
|
||||
print("""Warning: You need to run
|
||||
|
||||
qp run save_ortho_mos
|
||||
|
||||
to be sure your MOs will be orthogonal, which is not the case when
|
||||
the MOs are read from output files (not enough precision in output).""")
|
||||
|
66
src/utils_complex/Gen_Ezfio_from_pyscf_mol.sh
Executable file
66
src/utils_complex/Gen_Ezfio_from_pyscf_mol.sh
Executable file
@ -0,0 +1,66 @@
|
||||
#!/bin/bash
|
||||
|
||||
ezfio=$1
|
||||
h5file=$2
|
||||
# Create the integral
|
||||
echo 'Create Integral'
|
||||
|
||||
echo 'Create EZFIO'
|
||||
#read nel nmo natom <<< $(cat param)
|
||||
#read e_nucl <<< $(cat e_nuc)
|
||||
#read nao <<< $(cat num_ao)
|
||||
#read nkpts <<< $(cat kpt_num)
|
||||
#read ndf <<< $(cat num_df)
|
||||
##./create_ezfio_complex_4idx.py $ezfio $nel $natom $nmo $e_nucl $nao $nkpts
|
||||
./create_ezfio_pyscf_mol.py $ezfio $h5file #$nel $natom $nmo $e_nucl $nao $nkpts $ndf
|
||||
#Handle the orbital consitensy check
|
||||
#qp_edit -c $ezfio &> /dev/null
|
||||
#cp $ezfio/{ao,mo}_basis/ao_md5
|
||||
|
||||
#qp_run import_ao_2e_complex $ezfio
|
||||
#qp_run dump_ao_2e_from_df $ezfio
|
||||
#Read the integral
|
||||
#echo 'Read Integral'
|
||||
|
||||
|
||||
################################################
|
||||
## using AO mono, 4-idx from pyscf ##
|
||||
################################################
|
||||
#qp_run import_integrals_ao_periodic $ezfio
|
||||
|
||||
|
||||
################################################
|
||||
## using AO mono, 3-idx, mo coef from pyscf ##
|
||||
################################################
|
||||
|
||||
#qp_run read_ao_mono_complex $ezfio
|
||||
#qp_run read_kconserv $ezfio
|
||||
#qp_run read_ao_df_complex $ezfio
|
||||
#qp_run read_mo_coef_complex $ezfio #start from converged pyscf MOs
|
||||
#
|
||||
#qp_run save_mo_df_to_disk $ezfio
|
||||
#qp_run save_mo_bielec_to_disk $ezfio
|
||||
|
||||
#qp_run mo_from_ao_orth $ezfio #use canonical orthonormalized AOs as initial MO guess
|
||||
#qp_run print_H_matrix_restart $ezfio > hmat.out
|
||||
|
||||
|
||||
###############################################################
|
||||
## using AO mono, full 4-idx AO bielec, mo coef from pyscf ##
|
||||
###############################################################
|
||||
|
||||
#qp_run read_ao_mono_complex $ezfio
|
||||
#qp_run read_kconserv $ezfio
|
||||
#qp_run read_ao_eri_chunk_complex $ezfio
|
||||
#qp_run read_mo_coef_complex $ezfio #start from converged pyscf MOs
|
||||
##qp_run mo_from_ao_orth $ezfio #use canonical orthonormalized AOs as initial MO guess
|
||||
|
||||
|
||||
######################################################
|
||||
## using MO mono, full 4-idx MO bielec from pyscf ##
|
||||
######################################################
|
||||
|
||||
#qp_run read_mo_mono_complex $ezfio
|
||||
#qp_run read_kconserv $ezfio
|
||||
#qp_run read_mo_eri_chunk_complex $ezfio
|
||||
|
@ -807,7 +807,6 @@ def xyzcount(s):
|
||||
|
||||
def pyscf2QP2_mol(mf, cas_idx=None, int_threshold = 1E-8,
|
||||
qph5path = 'qpdat.h5',
|
||||
norm='sp',
|
||||
print_debug=False):
|
||||
'''
|
||||
cas_idx = List of active MOs. If not specified all MOs are actives
|
||||
@ -817,6 +816,7 @@ def pyscf2QP2_mol(mf, cas_idx=None, int_threshold = 1E-8,
|
||||
|
||||
import h5py
|
||||
|
||||
norm='sp'
|
||||
mol = mf.mol
|
||||
nao_c = mol.nao_cart()
|
||||
|
||||
@ -835,15 +835,90 @@ def pyscf2QP2_mol(mf, cas_idx=None, int_threshold = 1E-8,
|
||||
qph5.create_group('electrons')
|
||||
qph5.create_group('ao_basis')
|
||||
qph5.create_group('mo_basis')
|
||||
qph5.create_group('pseudo')
|
||||
qph5['pseudo'].attrs['do_pseudo']=False
|
||||
|
||||
if mf.mol.cart:
|
||||
mo_coeff = mf.mo_coeff
|
||||
mo_coeff = mf.mo_coeff.copy()
|
||||
else:
|
||||
c2s = mol.cart2sph_coeff(normalized=norm)
|
||||
#c2s = mol.cart2sph_coeff(normalized='sp')
|
||||
#c2s = mol.cart2sph_coeff(normalized=norm)
|
||||
c2s = mol.cart2sph_coeff(normalized='sp')
|
||||
#c2s = mol.cart2sph_coeff(normalized='all')
|
||||
#c2s = mol.cart2sph_coeff(normalized=None)
|
||||
mo_coeff = np.dot(c2s,mf.mo_coeff)
|
||||
#TODO: clean this up; use mol.cart_labels(fmt=False)
|
||||
dnormlbl1=["dxx","dyy","dzz"]
|
||||
dnormfac1 = 2.0*np.sqrt(np.pi/5)
|
||||
|
||||
dnormlbl2=["dxy","dxz","dyz"]
|
||||
dnormfac2 = 2.0*np.sqrt(np.pi/15)
|
||||
|
||||
fnormlbl1=["fxxx","fyyy","fzzz"]
|
||||
fnormfac1 = 2.0*np.sqrt(np.pi/7)
|
||||
|
||||
fnormlbl2=["fxxy","fxxz","fxyy","fxzz","fyyz","fyzz"]
|
||||
fnormfac2 = 2.0*np.sqrt(np.pi/35)
|
||||
|
||||
fnormlbl3=["fxyz"]
|
||||
fnormfac3 = 2.0*np.sqrt(np.pi/105)
|
||||
|
||||
gnormlbl1=["gxxxx","gyyyy","gzzzz"]
|
||||
gnormfac1 = 2.0*np.sqrt(np.pi/9)
|
||||
|
||||
gnormlbl2=["gxxxy","gxxxz","gxyyy","gxzzz","gyyyz","gyzzz"]
|
||||
gnormfac2 = 2.0*np.sqrt(np.pi/63)
|
||||
|
||||
gnormlbl3=["gxxyy","gxxzz","gyyzz"]
|
||||
gnormfac3 = 2.0*np.sqrt(np.pi/105)
|
||||
|
||||
gnormlbl4=["gxxyz","gxyyz","gxyzz"]
|
||||
gnormfac4 = 2.0*np.sqrt(np.pi/315)
|
||||
|
||||
hnormlbl1=["hxxxxx","hyyyyy","hzzzzz"]
|
||||
hnormfac1 = 2.0*np.sqrt(np.pi/11)
|
||||
|
||||
hnormlbl2=["hxxxxy","hxxxxz","hxyyyy","hxzzzz","hyyyyz","hyzzzz"]
|
||||
hnormfac2 = 2.0*np.sqrt(np.pi/99)
|
||||
|
||||
hnormlbl3=["hxxxyy","hxxxzz","hxxyyy","hxxzzz","hyyyzz","hyyzzz"]
|
||||
hnormfac3 = 2.0*np.sqrt(np.pi/231)
|
||||
|
||||
hnormlbl4=["hxxxyz","hxyyyz","hxyzzz"]
|
||||
hnormfac4 = 2.0*np.sqrt(np.pi/693)
|
||||
|
||||
hnormlbl5=["hxxyyz","hxxyzz","hxyyzz"]
|
||||
hnormfac5 = 2.0*np.sqrt(np.pi/1155)
|
||||
|
||||
for i_lbl,mo_lbl in enumerate(mol.cart_labels()):
|
||||
if any(i in mo_lbl for i in dnormlbl1):
|
||||
mo_coeff[i_lbl,:] *= dnormfac1
|
||||
elif any(i in mo_lbl for i in dnormlbl2):
|
||||
mo_coeff[i_lbl,:] *= dnormfac2
|
||||
elif any(i in mo_lbl for i in fnormlbl1):
|
||||
mo_coeff[i_lbl,:] *= fnormfac1
|
||||
elif any(i in mo_lbl for i in fnormlbl2):
|
||||
mo_coeff[i_lbl,:] *= fnormfac2
|
||||
elif any(i in mo_lbl for i in fnormlbl3):
|
||||
mo_coeff[i_lbl,:] *= fnormfac3
|
||||
elif any(i in mo_lbl for i in gnormlbl1):
|
||||
mo_coeff[i_lbl,:] *= gnormfac1
|
||||
elif any(i in mo_lbl for i in gnormlbl2):
|
||||
mo_coeff[i_lbl,:] *= gnormfac2
|
||||
elif any(i in mo_lbl for i in gnormlbl3):
|
||||
mo_coeff[i_lbl,:] *= gnormfac3
|
||||
elif any(i in mo_lbl for i in gnormlbl4):
|
||||
mo_coeff[i_lbl,:] *= gnormfac4
|
||||
elif any(i in mo_lbl for i in hnormlbl1):
|
||||
mo_coeff[i_lbl,:] *= hnormfac1
|
||||
elif any(i in mo_lbl for i in hnormlbl2):
|
||||
mo_coeff[i_lbl,:] *= hnormfac2
|
||||
elif any(i in mo_lbl for i in hnormlbl3):
|
||||
mo_coeff[i_lbl,:] *= hnormfac3
|
||||
elif any(i in mo_lbl for i in hnormlbl4):
|
||||
mo_coeff[i_lbl,:] *= hnormfac4
|
||||
elif any(i in mo_lbl for i in hnormlbl5):
|
||||
mo_coeff[i_lbl,:] *= hnormfac5
|
||||
|
||||
# Mo_coeff actif
|
||||
mo_c = np.array([c[:,cas_idx] for c in mo_coeff] if cas_idx is not None else mo_coeff)
|
||||
e_c = np.array([e[cas_idx] for e in mf.mo_energy] if cas_idx is not None else mf.mo_energy)
|
||||
@ -878,6 +953,83 @@ def pyscf2QP2_mol(mf, cas_idx=None, int_threshold = 1E-8,
|
||||
for i in range(natom):
|
||||
atom_dset[i] = mol.atom_pure_symbol(i)
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# ECP #
|
||||
# #
|
||||
##########################################
|
||||
|
||||
if (mol.has_ecp()):
|
||||
#atsymb = [mol.atom_pure_symbol(i) for i in range(natom)]
|
||||
#pyecp = mol._ecp
|
||||
## nelec to remove for each atom
|
||||
#nuc_z_remov = [pyecp[i][0] for i in atsymb]
|
||||
#nl_per_atom = [len(pyecp[i][1]) for i in atsymb]
|
||||
## list of l-values for channels of each atom
|
||||
#ecp_l = [[pyecp[i][1][j][0] for j in range(len(pyecp[i][1]))] for i in atsymb]
|
||||
## list of [exp,coef] for each channel (r**0,1,2,3,4,5,)
|
||||
#ecp_ac = [[pyecp[i][1][j][1] for j in range(len(pyecp[i][1]))] for i in atsymb]
|
||||
pyecp = [mol._ecp[mol.atom_pure_symbol(i)] for i in range(natom)]
|
||||
nzrmv=[0]*natom
|
||||
lmax=0
|
||||
klocmax=0
|
||||
knlmax=0
|
||||
for i,(nz,dat) in enumerate(pyecp):
|
||||
nzrmv[i]=nz
|
||||
for lval,ac in dat:
|
||||
if (lval==-1):
|
||||
klocmax=max(sum(len(j) for j in ac),klocmax)
|
||||
else:
|
||||
lmax=max(lval,lmax)
|
||||
knlmax=max(sum(len(j) for j in ac),knlmax)
|
||||
#psd_nk = np.zeros((natom,klocmax),dtype=int)
|
||||
#psd_vk = np.zeros((natom,klocmax),dtype=float)
|
||||
#psd_dzk = np.zeros((natom,klocmax),dtype=float)
|
||||
#psd_nkl = np.zeros((natom,knlmax,lmax+1),dtype=int)
|
||||
#psd_vkl = np.zeros((natom,knlmax,lmax+1),dtype=float)
|
||||
#psd_dzkl = np.zeros((natom,knlmax,lmax+1),dtype=float)
|
||||
klnlmax=max(klocmax,knlmax)
|
||||
psd_n = np.zeros((lmax+2,klnlmax,natom),dtype=int)
|
||||
psd_v = np.zeros((lmax+2,klnlmax,natom),dtype=float)
|
||||
psd_dz = np.zeros((lmax+2,klnlmax,natom),dtype=float)
|
||||
for i,(_,dat) in enumerate(pyecp):
|
||||
for lval,ac in dat:
|
||||
count=0
|
||||
for ri,aici in enumerate(ac):
|
||||
for ai,ci in aici:
|
||||
psd_n[lval+1,count,i] = ri-2
|
||||
psd_v[lval+1,count,i] = ci
|
||||
psd_dz[lval+1,count,i] = ai
|
||||
count += 1
|
||||
psd_nk = psd_n[0,:klocmax]
|
||||
psd_vk = psd_v[0,:klocmax]
|
||||
psd_dzk = psd_dz[0,:klocmax]
|
||||
psd_nkl = psd_n[1:,:knlmax]
|
||||
psd_vkl = psd_v[1:,:knlmax]
|
||||
psd_dzkl = psd_dz[1:,:knlmax]
|
||||
with h5py.File(qph5path,'a') as qph5:
|
||||
qph5['pseudo'].attrs['do_pseudo']=True
|
||||
qph5['pseudo'].attrs['pseudo_lmax']=lmax
|
||||
qph5['pseudo'].attrs['pseudo_klocmax']=klocmax
|
||||
qph5['pseudo'].attrs['pseudo_kmax']=knlmax
|
||||
qph5.create_dataset('pseudo/nucl_charge_remove',data=nzrmv)
|
||||
qph5.create_dataset('pseudo/pseudo_n_k',data=psd_nk)
|
||||
qph5.create_dataset('pseudo/pseudo_n_kl',data=psd_nkl)
|
||||
qph5.create_dataset('pseudo/pseudo_v_k',data=psd_vk)
|
||||
qph5.create_dataset('pseudo/pseudo_v_kl',data=psd_vkl)
|
||||
qph5.create_dataset('pseudo/pseudo_dz_k',data=psd_dzk)
|
||||
qph5.create_dataset('pseudo/pseudo_dz_kl',data=psd_dzkl)
|
||||
|
||||
## nelec to remove for each atom
|
||||
#nuc_z_remov = [i[0] for i in pyecp]
|
||||
#nl_per_atom = [len(i[1]) for i in pyecp]
|
||||
## list of l-values for channels of each atom
|
||||
#ecp_l = [[ j[0] for j in i[1] ] for i in pyecp]
|
||||
#lmax = max(map(max,ecp_l))
|
||||
## list of [exp,coef] for each channel (r**0,1,2,3,4,5,)
|
||||
#ecp_ac = [[ j[1] for j in i[1] ] for i in pyecp]
|
||||
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# Basis #
|
||||
|
124
src/utils_complex/create_ezfio_pyscf_mol.py
Executable file
124
src/utils_complex/create_ezfio_pyscf_mol.py
Executable file
@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env python
|
||||
from ezfio import ezfio
|
||||
import h5py
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
fname = sys.argv[1]
|
||||
qph5name = sys.argv[2]
|
||||
|
||||
#qph5=h5py.File(qph5path,'r')
|
||||
|
||||
def convert_mol(filename,qph5path):
|
||||
ezfio.set_file(filename)
|
||||
ezfio.set_nuclei_is_complex(False)
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
nucl_num = qph5['nuclei'].attrs['nucl_num']
|
||||
ao_num = qph5['ao_basis'].attrs['ao_num']
|
||||
mo_num = qph5['mo_basis'].attrs['mo_num']
|
||||
elec_alpha_num = qph5['electrons'].attrs['elec_alpha_num']
|
||||
elec_beta_num = qph5['electrons'].attrs['elec_beta_num']
|
||||
|
||||
ezfio.set_nuclei_nucl_num(nucl_num)
|
||||
|
||||
ezfio.set_ao_basis_ao_num(ao_num)
|
||||
ezfio.set_mo_basis_mo_num(mo_num)
|
||||
ezfio.electrons_elec_alpha_num = elec_alpha_num
|
||||
ezfio.electrons_elec_beta_num = elec_beta_num
|
||||
|
||||
|
||||
|
||||
##ao_num = mo_num
|
||||
##Important !
|
||||
#import math
|
||||
#nelec_per_kpt = num_elec // n_kpts
|
||||
#nelec_alpha_per_kpt = int(math.ceil(nelec_per_kpt / 2.))
|
||||
#nelec_beta_per_kpt = int(math.floor(nelec_per_kpt / 2.))
|
||||
#
|
||||
#ezfio.electrons_elec_alpha_num = int(nelec_alpha_per_kpt * n_kpts)
|
||||
#ezfio.electrons_elec_beta_num = int(nelec_beta_per_kpt * n_kpts)
|
||||
|
||||
#ezfio.electrons_elec_alpha_num = int(math.ceil(num_elec / 2.))
|
||||
#ezfio.electrons_elec_beta_num = int(math.floor(num_elec / 2.))
|
||||
|
||||
#ezfio.set_utils_num_kpts(n_kpts)
|
||||
#ezfio.set_integrals_bielec_df_num(n_aux)
|
||||
|
||||
#(old)Important
|
||||
#ezfio.set_nuclei_nucl_num(nucl_num)
|
||||
#ezfio.set_nuclei_nucl_charge([0.]*nucl_num)
|
||||
#ezfio.set_nuclei_nucl_coord( [ [0.], [0.], [0.] ]*nucl_num )
|
||||
#ezfio.set_nuclei_nucl_label( ['He'] * nucl_num )
|
||||
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
nucl_charge=qph5['nuclei/nucl_charge'][()].tolist()
|
||||
nucl_coord=qph5['nuclei/nucl_coord'][()].T.tolist()
|
||||
nucl_label=qph5['nuclei/nucl_label'][()].tolist()
|
||||
nuclear_repulsion = qph5['nuclei'].attrs['nuclear_repulsion']
|
||||
|
||||
ezfio.set_nuclei_nucl_charge(nucl_charge)
|
||||
ezfio.set_nuclei_nucl_coord(nucl_coord)
|
||||
ezfio.set_nuclei_nucl_label(nucl_label)
|
||||
|
||||
ezfio.set_nuclei_io_nuclear_repulsion('Read')
|
||||
ezfio.set_nuclei_nuclear_repulsion(nuclear_repulsion)
|
||||
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# Basis #
|
||||
# #
|
||||
##########################################
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
do_pseudo = qph5['pseudo'].attrs['do_pseudo']
|
||||
ezfio.set_pseudo_do_pseudo(do_pseudo)
|
||||
if (do_pseudo):
|
||||
ezfio.set_pseudo_pseudo_lmax(qph5['pseudo'].attrs['pseudo_lmax'])
|
||||
ezfio.set_pseudo_pseudo_klocmax(qph5['pseudo'].attrs['pseudo_klocmax'])
|
||||
ezfio.set_pseudo_pseudo_kmax(qph5['pseudo'].attrs['pseudo_kmax'])
|
||||
ezfio.set_pseudo_nucl_charge_remove(qph5['pseudo/nucl_charge_remove'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_n_k(qph5['pseudo/pseudo_n_k'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_n_kl(qph5['pseudo/pseudo_n_kl'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_v_k(qph5['pseudo/pseudo_v_k'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_v_kl(qph5['pseudo/pseudo_v_kl'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_dz_k(qph5['pseudo/pseudo_dz_k'][()].tolist())
|
||||
ezfio.set_pseudo_pseudo_dz_kl(qph5['pseudo/pseudo_dz_kl'][()].tolist())
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# Basis #
|
||||
# #
|
||||
##########################################
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
coeftmp = qph5['ao_basis/ao_coef'][()]
|
||||
expotmp = qph5['ao_basis/ao_expo'][()]
|
||||
ezfio.set_ao_basis_ao_basis(qph5['ao_basis'].attrs['ao_basis'])
|
||||
ezfio.set_ao_basis_ao_nucl(qph5['ao_basis/ao_nucl'][()].tolist())
|
||||
ezfio.set_ao_basis_ao_prim_num(qph5['ao_basis/ao_prim_num'][()].tolist())
|
||||
ezfio.set_ao_basis_ao_power(qph5['ao_basis/ao_power'][()].tolist())
|
||||
ezfio.set_ao_basis_ao_coef(qph5['ao_basis/ao_coef'][()].tolist())
|
||||
ezfio.set_ao_basis_ao_expo(qph5['ao_basis/ao_expo'][()].tolist())
|
||||
|
||||
print(coeftmp)
|
||||
print(expotmp)
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# MO Coef #
|
||||
# #
|
||||
##########################################
|
||||
|
||||
|
||||
with h5py.File(qph5path,'r') as qph5:
|
||||
mo_coef = qph5['mo_basis/mo_coef'][()].tolist()
|
||||
ezfio.set_mo_basis_mo_coef(mo_coef)
|
||||
#maybe fix qp so we don't need this?
|
||||
#ezfio.set_mo_basis_mo_coef([[i for i in range(mo_num)] * ao_num])
|
||||
|
||||
return
|
||||
|
||||
convert_mol(fname,qph5name)
|
Loading…
Reference in New Issue
Block a user