10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-23 12:55:37 +01:00

working on converter

find cleaner way to provide kpt_pair_num
This commit is contained in:
Kevin Gasperich 2020-02-12 08:28:41 -06:00
parent 0b22e78da1
commit 059efc649d
3 changed files with 44 additions and 12 deletions

View File

@ -58,5 +58,6 @@ default: false
[ao_kpt_num]
type: integer
doc: Number of |AOs| per kpt
default: =(ao_basis.ao_num/nuclei.kpt_num)
interface: ezfio

View File

@ -588,13 +588,16 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, cas_idx=None, int_threshold = 1E-8,
ne_ao = ('V',v_kpts_ao,ne_threshold)
ovlp_ao = ('S',np.reshape(mf.get_ovlp(cell=cell,kpts=kpts),(Nk,nao,nao)),ovlp_threshold)
kin_ao = ('T',np.reshape(cell.pbc_intor('int1e_kin',1,1,kpts=kpts),(Nk,nao,nao)),kin_threshold)
qph5.create_dataset('ao_one_e_ints/ao_integrals_kinetic', data=kin_ao[1].real)
qph5.create_dataset('ao_one_e_ints/ao_integrals_kinetic_imag',data=kin_ao[1].imag)
qph5.create_dataset('ao_one_e_ints/ao_integrals_overlap', data=ovlp_ao[1].real)
qph5.create_dataset('ao_one_e_ints/ao_integrals_overlap_imag',data=ovlp_ao[1].imag)
qph5.create_dataset('ao_one_e_ints/ao_integrals_n_e', data=v_kpts_ao.real)
qph5.create_dataset('ao_one_e_ints/ao_integrals_n_e_imag', data=v_kpts_ao.imag)
kin_ao_blocked=scipy.linalg.block_diag(*kin_ao[1])
ovlp_ao_blocked=scipy.linalg.block_diag(*ovlp_ao[1])
ne_ao_blocked=scipy.linalg.block_diag(*v_kpts_ao)
qph5.create_dataset('ao_one_e_ints/ao_integrals_kinetic_real',data=kin_ao_blocked.real)
qph5.create_dataset('ao_one_e_ints/ao_integrals_kinetic_imag',data=kin_ao_blocked.imag)
qph5.create_dataset('ao_one_e_ints/ao_integrals_overlap_real',data=ovlp_ao_blocked.real)
qph5.create_dataset('ao_one_e_ints/ao_integrals_overlap_imag',data=ovlp_ao_blocked.imag)
qph5.create_dataset('ao_one_e_ints/ao_integrals_n_e_real', data=ne_ao_blocked.real)
qph5.create_dataset('ao_one_e_ints/ao_integrals_n_e_imag', data=ne_ao_blocked.imag)
@ -680,8 +683,8 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, cas_idx=None, int_threshold = 1E-8,
outfile.write('%s %s %s %s %s %s\n' % (i+1,j+1,iaux+1,k+1,v.real,v.imag))
df_ao_tmp[i,j,iaux,k]=v
qph5.create_dataset('ao_two_e_ints/df_ao_array_real',data=df_ao_tmp.real)
qph5.create_dataset('ao_two_e_ints/df_ao_array_imag',data=df_ao_tmp.imag)
qph5.create_dataset('ao_two_e_ints/df_ao_integrals_real',data=df_ao_tmp.real)
qph5.create_dataset('ao_two_e_ints/df_ao_integrals_imag',data=df_ao_tmp.imag)
if print_mo_ints_df:
kpair_list=[]
@ -701,8 +704,8 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, cas_idx=None, int_threshold = 1E-8,
if (abs(v) > bielec_int_threshold):
outfile.write('%s %s %s %s %s %s\n' % (i+1,j+1,iaux+1,k+1,v.real,v.imag))
df_mo_tmp[i,j,iaux,k]=v
qph5.create_dataset('mo_two_e_ints/df_mo_array_real',data=df_mo_tmp.real)
qph5.create_dataset('mo_two_e_ints/df_mo_array_imag',data=df_mo_tmp.imag)
qph5.create_dataset('mo_two_e_ints/df_mo_integrals_real',data=df_mo_tmp.real)
qph5.create_dataset('mo_two_e_ints/df_mo_integrals_imag',data=df_mo_tmp.imag)

View File

@ -17,6 +17,8 @@ qph5=h5py.File(h5filename,'r')
kpt_num = qph5['nuclei'].attrs['kpt_num']
ezfio.set_nuclei_kpt_num(kpt_num)
kpt_pair_num = (kpt_num*kpt_num + kpt_num)//2
ezfio.set_nuclei_kpt_pair_num(kpt_pair_num)
# should this be in ao_basis? ao_two_e_ints?
df_num = qph5['ao_two_e_ints'].attrs['df_num']
@ -110,4 +112,30 @@ ezfio.set_mo_basis_mo_coef_imag(qph5['mo_basis/mo_coef_imag'][()].tolist())
#maybe fix qp so we don't need this?
ezfio.set_mo_basis_mo_coef([[i for i in range(mo_num)] * ao_num])
ezfio.set_nuclei_is_periodic(True)
ezfio.set_nuclei_is_complex(True)
kin_ao_re=qph5['ao_one_e_ints/ao_integrals_kinetic_real'][()].T.tolist()
kin_ao_im=qph5['ao_one_e_ints/ao_integrals_kinetic_imag'][()].T.tolist()
ovlp_ao_re=qph5['ao_one_e_ints/ao_integrals_overlap_real'][()].T.tolist()
ovlp_ao_im=qph5['ao_one_e_ints/ao_integrals_overlap_imag'][()].T.tolist()
ne_ao_re=qph5['ao_one_e_ints/ao_integrals_n_e_real'][()].T.tolist()
ne_ao_im=qph5['ao_one_e_ints/ao_integrals_n_e_imag'][()].T.tolist()
ezfio.set_ao_one_e_ints_ao_integrals_kinetic(kin_ao_re)
ezfio.set_ao_one_e_ints_ao_integrals_kinetic_imag(kin_ao_im)
ezfio.set_ao_one_e_ints_ao_integrals_overlap(ovlp_ao_re)
ezfio.set_ao_one_e_ints_ao_integrals_overlap_imag(ovlp_ao_im)
ezfio.set_ao_one_e_ints_ao_integrals_n_e(ne_ao_re)
ezfio.set_ao_one_e_ints_ao_integrals_n_e_imag(ne_ao_im)
dfao_re=qph5['ao_two_e_ints/df_ao_integrals_real'][()].transpose((3,2,1,0)).tolist()
dfao_im=qph5['ao_two_e_ints/df_ao_integrals_imag'][()].transpose((3,2,1,0)).tolist()
ezfio.set_ao_two_e_ints_df_ao_integrals_real(dfao_re)
ezfio.set_ao_two_e_ints_df_ao_integrals_imag(dfao_im)
#TODO: add check and only do this if ints exist
#dfmo_re=qph5['mo_two_e_ints/df_mo_integrals_real'][()].transpose((3,2,1,0)).tolist()
#dfmo_im=qph5['mo_two_e_ints/df_mo_integrals_imag'][()].transpose((3,2,1,0)).tolist()
#ezfio.set_mo_two_e_ints_df_mo_integrals_real(dfmo_re)
#ezfio.set_mo_two_e_ints_df_mo_integrals_imag(dfmo_im)