10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-24 21:33:47 +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] [ao_kpt_num]
type: integer type: integer
doc: Number of |AOs| per kpt doc: Number of |AOs| per kpt
default: =(ao_basis.ao_num/nuclei.kpt_num)
interface: ezfio interface: ezfio

View File

@ -589,12 +589,15 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, cas_idx=None, int_threshold = 1E-8,
ovlp_ao = ('S',np.reshape(mf.get_ovlp(cell=cell,kpts=kpts),(Nk,nao,nao)),ovlp_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) 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) kin_ao_blocked=scipy.linalg.block_diag(*kin_ao[1])
qph5.create_dataset('ao_one_e_ints/ao_integrals_kinetic_imag',data=kin_ao[1].imag) ovlp_ao_blocked=scipy.linalg.block_diag(*ovlp_ao[1])
qph5.create_dataset('ao_one_e_ints/ao_integrals_overlap', data=ovlp_ao[1].real) ne_ao_blocked=scipy.linalg.block_diag(*v_kpts_ao)
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_kinetic_real',data=kin_ao_blocked.real)
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_kinetic_imag',data=kin_ao_blocked.imag)
qph5.create_dataset('ao_one_e_ints/ao_integrals_n_e_imag', data=v_kpts_ao.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)) 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 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_integrals_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_imag',data=df_ao_tmp.imag)
if print_mo_ints_df: if print_mo_ints_df:
kpair_list=[] 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): 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)) 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 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_integrals_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_imag',data=df_mo_tmp.imag)

View File

@ -17,6 +17,8 @@ qph5=h5py.File(h5filename,'r')
kpt_num = qph5['nuclei'].attrs['kpt_num'] kpt_num = qph5['nuclei'].attrs['kpt_num']
ezfio.set_nuclei_kpt_num(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? # should this be in ao_basis? ao_two_e_ints?
df_num = qph5['ao_two_e_ints'].attrs['df_num'] 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? #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_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)