From 0d9879dcb17bfb8001676959303b7cd8ed7d71d7 Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Fri, 30 Oct 2020 10:36:02 -0500 Subject: [PATCH] fixed problem with nested data in pyscf hdf5 3idx ints (needs testing for nk>1) --- src/utils_complex/MolPyscfToQPkpts.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/utils_complex/MolPyscfToQPkpts.py b/src/utils_complex/MolPyscfToQPkpts.py index 79b96565..e94dcc90 100644 --- a/src/utils_complex/MolPyscfToQPkpts.py +++ b/src/utils_complex/MolPyscfToQPkpts.py @@ -440,9 +440,10 @@ def get_j3ao_new(fname,nao,Nk): # in new(?) version of PySCF, there is an extra layer of groups before the datasets # datasets used to be [/j3c/0, /j3c/1, /j3c/2, ...] # datasets now are [/j3c/0/0, /j3c/1/0, /j3c/2/0, ...] - keysub = '/0' if bool(j3c.get('0/0',getclass=True)) else '' + #keysub = '/0' if bool(j3c.get('0/0',getclass=True)) else '' - naux = max(map(lambda k: j3c[k+keysub].shape[0],j3c.keys())) + #naux = max(map(lambda k: j3c[k+keysub].shape[0],j3c.keys())) + naux = max(map(lambda k: j3c[k]['0'].shape[0],j3c.keys())) naosq = nao*nao naotri = (nao*(nao+1))//2 @@ -451,11 +452,12 @@ def get_j3ao_new(fname,nao,Nk): j3arr = np.zeros((nkpairs,naux,nao,nao),dtype=np.complex128) for i,kpair in enumerate(j3ckeys): - iaux,dim2 = j3c[kpair+keysub].shape + tmpdat = np.concatenate([j3c[kpair][ii][()] for ii in j3c[kpair]],axis=1) + iaux,dim2 = tmpdat.shape if (dim2==naosq): - j3arr[i,:iaux,:,:] = j3c[kpair+keysub][()].reshape([iaux,nao,nao]).transpose((0,2,1)) * nkinvsq + j3arr[i,:iaux,:,:] = tmpdat.reshape([iaux,nao,nao]).transpose((0,2,1)) * nkinvsq else: - j3arr[i,:iaux,:,:] = makesq3(j3c[kpair+keysub][()].conj(),nao) * nkinvsq + j3arr[i,:iaux,:,:] = makesq3(tmpdat.conj(),nao) * nkinvsq return j3arr