mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-25 04:53:32 +01:00
AB update
This commit is contained in:
parent
1daa85ffb9
commit
e9842cae9b
@ -214,22 +214,59 @@ def convert_kpts(filename,qph5path):
|
||||
# #
|
||||
##########################################
|
||||
|
||||
#with h5py.File(qph5path,'r') as qph5:
|
||||
# ezfio.set_ao_basis_ao_basis(qph5['ao_basis'].attrs['ao_basis'])
|
||||
# ezfio.set_ao_basis_ao_nucl(qph5['ao_basis/ao_nucl'][()].tolist())
|
||||
#
|
||||
#
|
||||
#Just need one (can clean this up later)
|
||||
# ao_prim_num_max = 5
|
||||
#
|
||||
# d = [ [0] *ao_prim_num_max]*ao_num
|
||||
# ezfio.set_ao_basis_ao_prim_num([ao_prim_num_max]*ao_num)
|
||||
# ezfio.set_ao_basis_ao_power(d)
|
||||
# ezfio.set_ao_basis_ao_coef(d)
|
||||
# ezfio.set_ao_basis_ao_expo(d)
|
||||
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# 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())
|
||||
|
||||
|
||||
#Just need one (can clean this up later)
|
||||
ao_prim_num_max = 5
|
||||
|
||||
d = [ [0] *ao_prim_num_max]*ao_num
|
||||
ezfio.set_ao_basis_ao_prim_num([ao_prim_num_max]*ao_num)
|
||||
ezfio.set_ao_basis_ao_power(d)
|
||||
ezfio.set_ao_basis_ao_coef(d)
|
||||
ezfio.set_ao_basis_ao_expo(d)
|
||||
|
||||
|
||||
|
||||
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())
|
||||
|
||||
|
||||
|
||||
##########################################
|
||||
# #
|
||||
@ -404,20 +441,57 @@ def convert_cplx(filename,qph5path):
|
||||
# #
|
||||
##########################################
|
||||
|
||||
# with h5py.File(qph5path,'r') as qph5:
|
||||
# ezfio.set_ao_basis_ao_basis(qph5['ao_basis'].attrs['ao_basis'])
|
||||
# ezfio.set_ao_basis_ao_nucl(qph5['ao_basis/ao_nucl'][()].tolist())
|
||||
#
|
||||
#
|
||||
# #Just need one (can clean this up later)
|
||||
# ao_prim_num_max = 5
|
||||
#
|
||||
# d = [ [0] *ao_prim_num_max]*ao_num
|
||||
# ezfio.set_ao_basis_ao_prim_num([ao_prim_num_max]*ao_num)
|
||||
# ezfio.set_ao_basis_ao_power(d)
|
||||
# ezfio.set_ao_basis_ao_coef(d)
|
||||
# ezfio.set_ao_basis_ao_expo(d)
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# 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())
|
||||
|
||||
|
||||
#Just need one (can clean this up later)
|
||||
ao_prim_num_max = 5
|
||||
|
||||
d = [ [0] *ao_prim_num_max]*ao_num
|
||||
ezfio.set_ao_basis_ao_prim_num([ao_prim_num_max]*ao_num)
|
||||
ezfio.set_ao_basis_ao_power(d)
|
||||
ezfio.set_ao_basis_ao_coef(d)
|
||||
ezfio.set_ao_basis_ao_expo(d)
|
||||
|
||||
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())
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -603,6 +603,8 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, 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
|
||||
qph5.create_group('PBC_DATA')
|
||||
|
||||
mo_coeff = mf.mo_coeff
|
||||
@ -671,19 +673,13 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, cas_idx=None, int_threshold = 1E-8,
|
||||
# shell start,end; AO start,end (sph or cart) for each atom
|
||||
for ib in range(sh0,sh1): # sets of contracted exponents
|
||||
l = cell.bas_angular(ib) # angular momentum
|
||||
if ( cell.cart==True):
|
||||
representation=((l+1)*(l+2))//2
|
||||
else:
|
||||
representation=2*l-1
|
||||
nprim = cell.bas_nprim(ib) # numer of primitives
|
||||
es = cell.bas_exp(ib) # exponents
|
||||
cs = cell.bas_ctr_coeff(ib) # coeffs
|
||||
nctr = cell.bas_nctr(ib) # number of contractions
|
||||
print(iatom,ib,l,nprim,nctr,tmp_idx)
|
||||
for ic in range(nctr): # sets of contraction coeffs
|
||||
# for nfunc in range(((l+1)*(l+2))//2): # always use cart for qp ao basis?
|
||||
# for nfunc in range(2*l-1):
|
||||
for nfunc in range(representation):
|
||||
for nfunc in range(((l+1)*(l+2))//2): # always use cart for qp ao basis?
|
||||
qp_expo[tmp_idx,:nprim] = es[:]
|
||||
qp_coef[tmp_idx,:nprim] = cs[:,ic]
|
||||
qp_nucl[tmp_idx] = iatom + 1
|
||||
@ -876,8 +872,83 @@ def pyscf2QP2(cell,mf, kpts, kmesh=None, cas_idx=None, int_threshold = 1E-8,
|
||||
qph5.create_dataset('PBC_DATA/Super_Twist',(1,3),dtype="f8",data=sp_twist)
|
||||
qph5.create_dataset('PBC_DATA/LatticeVectors',(3,3),dtype="f8",data=cell.lattice_vectors())
|
||||
qph5.create_dataset('PBC_DATA/eigenval',(1,nmo),dtype="f8",data=mf.mo_energy)
|
||||
|
||||
|
||||
##########################################
|
||||
# #
|
||||
# ECP #
|
||||
# #
|
||||
##########################################
|
||||
|
||||
if (cell.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 = [cell._ecp[cell.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]
|
||||
|
||||
return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user