10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-14 10:03:47 +01:00

d/f/g/h mo coef correct in pyscf converter for molecules

This commit is contained in:
Kevin Gasperich 2020-07-27 15:21:30 -05:00
parent 50bc4b94fc
commit 3806554438

View File

@ -807,7 +807,6 @@ def xyzcount(s):
def pyscf2QP2_mol(mf, cas_idx=None, int_threshold = 1E-8, def pyscf2QP2_mol(mf, cas_idx=None, int_threshold = 1E-8,
qph5path = 'qpdat.h5', qph5path = 'qpdat.h5',
norm='sp',
print_debug=False): print_debug=False):
''' '''
cas_idx = List of active MOs. If not specified all MOs are actives 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 import h5py
norm='sp'
mol = mf.mol mol = mf.mol
nao_c = mol.nao_cart() nao_c = mol.nao_cart()
@ -837,13 +837,86 @@ def pyscf2QP2_mol(mf, cas_idx=None, int_threshold = 1E-8,
qph5.create_group('mo_basis') qph5.create_group('mo_basis')
if mf.mol.cart: if mf.mol.cart:
mo_coeff = mf.mo_coeff mo_coeff = mf.mo_coeff.copy()
else: else:
c2s = mol.cart2sph_coeff(normalized=norm) #c2s = mol.cart2sph_coeff(normalized=norm)
#c2s = mol.cart2sph_coeff(normalized='sp') c2s = mol.cart2sph_coeff(normalized='sp')
#c2s = mol.cart2sph_coeff(normalized='all') #c2s = mol.cart2sph_coeff(normalized='all')
#c2s = mol.cart2sph_coeff(normalized=None) #c2s = mol.cart2sph_coeff(normalized=None)
mo_coeff = np.dot(c2s,mf.mo_coeff) 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_coeff actif
mo_c = np.array([c[:,cas_idx] for c in mo_coeff] if cas_idx is not None else mo_coeff) 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) e_c = np.array([e[cas_idx] for e in mf.mo_energy] if cas_idx is not None else mf.mo_energy)