def mol_dyn_sampling(self,md_work, i, N, T1, T2, dt, Nc, Ns, sig, gpuid): activ = aat.moldynactivelearning(self.netdict['cnstfile'], self.netdict['saefile'], self.netdict['nnfprefix'], self.netdict['num_nets'], gpuid) difo = open(self.ldtdir + self.datdir + '/info_data_mdso-'+str(i)+'.nfo', 'w') Nmol = 0 dnfo = 'MD Sampler running: ' + str(md_work.size) difo.write(dnfo + '\n') Nmol = md_work.size ftme_t = 0.0 for di, id in enumerate(md_work): data = hdt.read_rcdb_coordsandnm(id) #print(di, ') Working on', id, '...') S = data["species"] if "charge" in data and "multip" in data: chg = data["charge"] mlt = data["multip"] else: chg = "0" mlt = "1" # Set mols activ.setmol(data["coordinates"], S) # Generate conformations X = activ.generate_conformations(N, T1, T2, dt, Nc, Ns, dS=sig) ftme_t += activ.failtime nfo = activ._infostr_ m = id.rsplit('/',1)[1].rsplit('.',1)[0] difo.write(' -' + m + ': ' + nfo + '\n') difo.flush() #print(nfo) if X.size > 0: hdt.writexyzfilewc(self.cdir + 'mds_' + m.split('.')[0] + '_' + str(i).zfill(2) + str(di).zfill(4) + '.xyz', X, S, ' '+chg+' '+mlt) difo.write('Complete mean fail time: ' + "{:.2f}".format(ftme_t / float(Nmol)) + '\n') print(Nmol) del activ difo.close()
#(1.00,'/home/jujuman/Research/GDB-11-AL-wB97x631gd/dnnts_red/dnntsgdb11_03_red/inputs/'), #(1.00,'/home/jujuman/Research/GDB-11-AL-wB97x631gd/dnnts_red/dnntsgdb11_04_red/inputs/'), #(0.50,'/home/jujuman/Research/GDB-11-AL-wB97x631gd/dnnts_red/dnntsgdb11_05_red/inputs/'), #(0.35,'/home/jujuman/Research/GDB-11-AL-wB97x631gd/dnnts_red/dnntsgdb11_06_red/inputs/'), #(1.0, '/home/jujuman/Research/GDB-11-AL-wB97x631gd/elements_SFCl/gdb11_size1/inputs/'), #(1.0, '/home/jujuman/Research/GDB-11-AL-wB97x631gd/elements_SFCl/gdb11_size2/inputs/'), #(1.0, '/home/jujuman/Research/GDB-11-AL-wB97x631gd/elements_SFCl/gdb11_size3/inputs/'), #(1.0, '/home/jujuman/Research/GDB-11-AL-wB97x631gd/elements_SFCl/gdb11_size4/inputs/'), (1.0, '/home/jujuman/Research/GDB-11-AL-wB97x631gd/elements_SFCl/gdb11_size5/inputs/' ), ] #------------------------------------------- activ = pya.moldynactivelearning(cnstfile, saefile, wkdir + 'train', 5) difo = open(dstore + 'info_data_mdso.nfo', 'w') Nmol = 0 ftme = 0.0 for di, id in enumerate(idir): files = os.listdir(id[1]) random.shuffle(files) dnfo = str(di) + ' of ' + str( len(idir)) + ') dir: ' + str(id) + ' Selecting: ' + str( id[0] * len(files)) print(dnfo) Nmol += len(files) difo.write(dnfo + '\n') ftme_t = 0.0