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

small converter patch

This commit is contained in:
Kevin Gasperich 2020-03-16 13:17:36 -05:00
parent 3ebad92f76
commit 13f685722d
2 changed files with 39 additions and 11 deletions

View File

@ -399,7 +399,7 @@ def get_pot_ao(mf):
return v_kpts_ao return v_kpts_ao
def ao_to_mo_1e(ao_kpts,mo_coef): def ao_to_mo_1e(ao_kpts,mo_coef):
return np.einsum('kim,kij,kjn->kmn',mo_coef.conj(),ao_kpts_ao,mo_coef) return np.einsum('kim,kij,kjn->kmn',mo_coef.conj(),ao_kpts,mo_coef)
def get_j3ao_old(fname,nao,Nk): def get_j3ao_old(fname,nao,Nk):
''' '''
@ -744,12 +744,22 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, cas_idx=None, int_threshold = 1E-8,
ne_mo_blocked=block_diag(*ne_mo) ne_mo_blocked=block_diag(*ne_mo)
with h5py.File(qph5path,'a') as qph5: with h5py.File(qph5path,'a') as qph5:
kin_mo_f = np.array(kin_mo.transpose((0,2,1)),order='c')
ovlp_mo_f = np.array(ovlp_mo.transpose((0,2,1)),order='c')
ne_mo_f = np.array(ne_mo.transpose((0,2,1)),order='c')
kin_mo_blocked_f = block_diag(*kin_mo_f)
ovlp_mo_blocked_f = block_diag(*ovlp_mo_f)
ne_mo_blocked_f = block_diag(*ne_mo_f)
qph5.create_dataset('mo_one_e_ints/mo_integrals_kinetic_real',data=kin_mo_blocked.real) qph5.create_dataset('mo_one_e_ints/mo_integrals_kinetic_real',data=kin_mo_blocked.real)
qph5.create_dataset('mo_one_e_ints/mo_integrals_kinetic_imag',data=kin_mo_blocked.imag) qph5.create_dataset('mo_one_e_ints/mo_integrals_kinetic_imag',data=kin_mo_blocked.imag)
qph5.create_dataset('mo_one_e_ints/mo_integrals_overlap_real',data=ovlp_mo_blocked.real) qph5.create_dataset('mo_one_e_ints/mo_integrals_overlap_real',data=ovlp_mo_blocked.real)
qph5.create_dataset('mo_one_e_ints/mo_integrals_overlap_imag',data=ovlp_mo_blocked.imag) qph5.create_dataset('mo_one_e_ints/mo_integrals_overlap_imag',data=ovlp_mo_blocked.imag)
qph5.create_dataset('mo_one_e_ints/mo_integrals_n_e_real', data=ne_mo_blocked.real) qph5.create_dataset('mo_one_e_ints/mo_integrals_n_e_real', data=ne_mo_blocked.real)
qph5.create_dataset('mo_one_e_ints/mo_integrals_n_e_imag', data=ne_mo_blocked.imag) qph5.create_dataset('mo_one_e_ints/mo_integrals_n_e_imag', data=ne_mo_blocked.imag)
qph5.create_dataset('mo_one_e_ints/mo_integrals_kinetic',data=kin_mo_blocked_f.view(dtype=np.float64).reshape((Nk*nmo,Nk*nmo,2)))
qph5.create_dataset('mo_one_e_ints/mo_integrals_overlap',data=ovlp_mo_blocked_f.view(dtype=np.float64).reshape((Nk*nmo,Nk*nmo,2)))
qph5.create_dataset('mo_one_e_ints/mo_integrals_n_e', data=ne_mo_blocked_f.view(dtype=np.float64).reshape((Nk*nmo,Nk*nmo,2)))
for fname,ints in zip(('S.mo.qp','V.mo.qp','T.mo.qp'), for fname,ints in zip(('S.mo.qp','V.mo.qp','T.mo.qp'),
(ovlp_mo, ne_mo, kin_mo)): (ovlp_mo, ne_mo, kin_mo)):
print_kpts_unblocked_upper(ints,fname,thresh_mono) print_kpts_unblocked_upper(ints,fname,thresh_mono)
@ -785,9 +795,9 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, cas_idx=None, int_threshold = 1E-8,
qph5.create_group('ao_two_e_ints') qph5.create_group('ao_two_e_ints')
qph5['ao_two_e_ints'].attrs['df_num']=naux qph5['ao_two_e_ints'].attrs['df_num']=naux
j3ao_new = get_j3ao_new(mf.with_df._cderi,nao,Nk)
if print_ao_ints_df: if print_ao_ints_df:
print_df(j3arr,'D.qp',bielec_int_threshold) print_df(j3arr,'D.qp',bielec_int_threshold)
j3ao_new = get_j3ao_new(mf.with_df._cderi,nao,Nk)
with h5py.File(qph5path,'a') as qph5: with h5py.File(qph5path,'a') as qph5:
#qph5.create_dataset('ao_two_e_ints/df_ao_integrals_real',data=j3arr.transpose((2,3,1,0)).real) #qph5.create_dataset('ao_two_e_ints/df_ao_integrals_real',data=j3arr.transpose((2,3,1,0)).real)

View File

@ -120,17 +120,35 @@ ezfio.set_mo_basis_mo_coef_complex(mo_coef_reim)
########################################## ##########################################
with h5py.File(qph5path,'r') as qph5: with h5py.File(qph5path,'r') as qph5:
kin_ao_reim=qph5['ao_one_e_ints/ao_integrals_kinetic'][()].tolist() if 'ao_one_e_ints' in qph5.keys():
ovlp_ao_reim=qph5['ao_one_e_ints/ao_integrals_overlap'][()].tolist() kin_ao_reim=qph5['ao_one_e_ints/ao_integrals_kinetic'][()].tolist()
ne_ao_reim=qph5['ao_one_e_ints/ao_integrals_n_e'][()].tolist() ovlp_ao_reim=qph5['ao_one_e_ints/ao_integrals_overlap'][()].tolist()
ne_ao_reim=qph5['ao_one_e_ints/ao_integrals_n_e'][()].tolist()
ezfio.set_ao_one_e_ints_ao_integrals_kinetic_complex(kin_ao_reim) ezfio.set_ao_one_e_ints_ao_integrals_kinetic_complex(kin_ao_reim)
ezfio.set_ao_one_e_ints_ao_integrals_overlap_complex(ovlp_ao_reim) ezfio.set_ao_one_e_ints_ao_integrals_overlap_complex(ovlp_ao_reim)
ezfio.set_ao_one_e_ints_ao_integrals_n_e_complex(ne_ao_reim) ezfio.set_ao_one_e_ints_ao_integrals_n_e_complex(ne_ao_reim)
ezfio.set_ao_one_e_ints_io_ao_integrals_kinetic('Read') ezfio.set_ao_one_e_ints_io_ao_integrals_kinetic('Read')
ezfio.set_ao_one_e_ints_io_ao_integrals_overlap('Read') ezfio.set_ao_one_e_ints_io_ao_integrals_overlap('Read')
ezfio.set_ao_one_e_ints_io_ao_integrals_n_e('Read') ezfio.set_ao_one_e_ints_io_ao_integrals_n_e('Read')
with h5py.File(qph5path,'r') as qph5:
if 'mo_one_e_ints' in qph5.keys():
kin_mo_reim=qph5['mo_one_e_ints/mo_integrals_kinetic'][()].tolist()
#ovlp_mo_reim=qph5['mo_one_e_ints/mo_integrals_overlap'][()].tolist()
ne_mo_reim=qph5['mo_one_e_ints/mo_integrals_n_e'][()].tolist()
ezfio.set_mo_one_e_ints_mo_integrals_kinetic_complex(kin_mo_reim)
#ezfio.set_mo_one_e_ints_mo_integrals_overlap_complex(ovlp_mo_reim)
#ezfio.set_mo_one_e_ints_mo_integrals_n_e_complex(ne_mo_reim)
ezfio.set_mo_one_e_ints_mo_integrals_e_n_complex(ne_mo_reim)
ezfio.set_mo_one_e_ints_io_mo_integrals_kinetic('Read')
#ezfio.set_mo_one_e_ints_io_mo_integrals_overlap('Read')
#ezfio.set_mo_one_e_ints_io_mo_integrals_n_e('Read')
ezfio.set_mo_one_e_ints_io_mo_integrals_e_n('Read')
########################################## ##########################################
# # # #