From 1a570c19f5c578c2b9525c606477f71b2230407a Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Fri, 15 Apr 2022 17:06:09 -0500 Subject: [PATCH] cleanup --- bin/qp_convert_h5_to_ezfio | 55 +------------------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/bin/qp_convert_h5_to_ezfio b/bin/qp_convert_h5_to_ezfio index 49e034b4..f980317b 100755 --- a/bin/qp_convert_h5_to_ezfio +++ b/bin/qp_convert_h5_to_ezfio @@ -37,57 +37,6 @@ def flatten(l): res.append(i) return res -#def write_array_do(self,dir,fil,rank,dims,dim_max,dat): -# if self.read_only: -# self.error('Read-only file.') -# l_filename = [ tempfile.mktemp(dir=dir.strip()), dir.strip()+'/'+fil+'.gz' ] -# try: -# file = StringIO.StringIO() -# file.write("%3d\n"%(rank,)) -# for d in dims: -# file.write("%20d "%(d,)) -# file.write("\n") -# -# dat = flatten(dat) -# for i in range(dim_max): -# file.write("%24.15E\n"%(dat[i],)) -# file.flush() -# buffer = file.getvalue() -# file.close() -# file = GzipFile(filename=l_filename[0],mode='wb') -# file.write(buffer.encode()) -# file.close() -# os.rename(l_filename[0],l_filename[1]) -# except: -# self.error("write_array_do", -# "Unable to write "+l_filename[1]) - -#def set_ao_two_e_ints_df_ao_integrals_complex(self,df_ao_integrals_complex): -# rank = 5 -# dims = list(range(rank)) -# dims[0] = 2 -# dims[1] = self.ao_basis_ao_num_per_kpt -# dims[2] = self.ao_basis_ao_num_per_kpt -# dims[3] = self.ao_two_e_ints_df_num -# dims[4] = self.nuclei_kpt_pair_num -# -# dim_max = 1 -# for d in dims: -# dim_max *= d -# self.acquire_lock('ao_two_e_ints_df_ao_integrals_complex') -# try: -# self.write_array_do(self.path_ao_two_e_ints,'df_ao_integrals_complex', rank,dims,dim_max,df_ao_integrals_complex) -# -def test_write_df_ao(rank,dims,dim_max,flatdata): - with gzip.open('test_ao_df_ints.gz','w') as f: - f.write(f'{rank:3d}\n'.encode()) - for d in dims: - f.write(f'{d:20d} '.encode()) - f.write("\n".encode()) - for i in range(dim_max): - f.write(f'{flatdata[i]:25.15E}\n'.encode()) - return - def save_array_do(ezfioname,subdir,data,chunksize=16384): dims = list(reversed(data.shape)) rank = len(dims) @@ -105,15 +54,13 @@ def save_array_do(ezfioname,subdir,data,chunksize=16384): #f.write((chunksize*'{:24.15E}\n').format(*flatdata[i*chunksize:(i+1)*chunksize]).encode()) #f.write(fmtstring.format(*flatdata[i*chunksize:(i+1)*chunksize]).encode()) f.write((''.join("%24.15E\n" % xi for xi in flatdata[i*chunksize:(i+1)*chunksize])).encode()) - print(f'{i/(dim_max//chunksize):7.3f}% complete') + print(f'{100.*i/(dim_max//chunksize):7.3f}% complete') rem = dim_max%chunksize if rem: f.write((rem*'{:24.15E}\n').format(*flatdata[-rem:]).encode()) return - - def convert_mol(filename,qph5path): ezfio.set_file(filename) ezfio.set_nuclei_is_complex(False)