def generate_h5(self, path): # open an HDF5 for compressed storage. # Note that if the path exists, it will open whatever is there. dpack = pyt.datapacker(path) d = self.ldtdir + self.datdir + '/data/' files = [f for f in os.listdir(d) if ".dat" in f] files.sort() Nf = len(files) Nd = 0 for n, f in enumerate(files): #print(d + f) L = file_len(d + f) if L >= 4: #print(d + f) data = hdt.readncdatall(d + f) if 'energies' in data: Ne = data['energies'].size Nd += Ne f = f.rsplit("-", 1) fn = f[0] + "/mol" + f[1].split(".")[0] dpack.store_data(fn, **data) dpack.cleanup()
Nd = 0 Nf = 0 for i, d in enumerate(dtdirs): files = [f for f in os.listdir(d) if ".dat" in f] files.sort() Nf += len(files) for n, f in enumerate(files): L = file_len(d + f) if L >= 4: print(d + f) data = hdn.readncdatall(d + f) #ridx = np.random.rand(data['energies'].size) #ridx = np.where(ridx < 0.2) #data['energies'] = data['energies'][ridx] #data['forces'] = data['forces'][ridx]# / (0.52917724900001*0.52917724900001) #data['coordinates'] = data['coordinates'][ridx] Ne = data['energies'].size Nd += Ne f = f.rsplit("-", 1) #print(f) fn = f[0] + '-' + str(i).zfill(3) + "/mol" + f[1].split(".")[0]
molfile = '/home/jujuman/Research/MD_TEST/trim.dat' wkdir = '/home/jujuman/Scratch/Research/DataReductionMethods/model6r/model-gdb01-06_red03-08/cv1/train4/' cnstfile = wkdir + '../rHCNO-4.6A_16-3.1A_a4-8.params' saefile = wkdir + '../sae_6-31gd.dat' nnfdir = wkdir + 'networks/' wkdir = '/home/jujuman/Gits/ANI-Networks/networks/ANI-c08f-ntwk-cv/' cnstfile = wkdir + 'rHCNO-4.6A_16-3.1A_a4-8.params' saefile = wkdir + 'sae_6-31gd.dat' nnfdir = wkdir + 'cv_train_4/networks/' nc = pync.conformers(cnstfile, saefile, nnfdir, 0, False) data = hdt.readncdatall(molfile) Edft = data["energies"] nc.setConformers(confs=data["coordinates"], types=data["species"]) Eani = nc.energy() print(Eani) import matplotlib.pyplot as plt plt.plot(hdt.hatokcal * (Edft), label='DFT') plt.plot(hdt.hatokcal * (Eani), label='ANI') plt.ylabel('$E_t$ (kcal/mol)') plt.xlabel('Frame') plt.legend(bbox_to_anchor=(0.01, 0.99), loc=2, borderaxespad=0., fontsize=14)