Beispiel #1
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)
    difo.write(dnfo + '\n')

    for i in range(id[0]):
        for n, m in enumerate(files):
            data = hdn.read_rcdb_coordsandnm(id[1] + m)
            mols.append(data)

dgen = pmf.dimergenerator(cnstfilecv, saefilecv, nnfprefix, 5, mols)

difo.write('Beginning dimer generation...\n')

Nt = 0
Nd = 0
for i in range(Nr):
    dgen.init_dynamics(Nm, V, L, dt, T)

    dgen.run_dynamics(Ni, xyzfile, trajfile)
    dgen.__fragmentbox__(molfile + str(i).zfill(4) + '_')

    Nt += dgen.Nt
    Nd += dgen.Nd

    print('Step (', i, ') [', str(dgen.Nd), '/', str(dgen.Nt), '] generated ',
Beispiel #2
0
    def dimer_sampling(self, tid, Nr, dparam, gpuid):
        mds_select = dparam['mdselect']
        #N = dparam['N']
        T = dparam['T']
        L = dparam['L']
        V = dparam['V']
        maxNa = dparam['maxNa']
        dt = dparam['dt']
        sig = dparam['sig']
        Nm = dparam['Nm']
        Ni = dparam['Ni']
        Ns = dparam['Ns']

        mols = []
        difo = open(
            self.ldtdir + self.datdir + '/info_data_mddimer-' + str(tid) +
            '.nfo', 'w')
        for di, id in enumerate(dparam['mdselect']):
            files = os.listdir(self.idir[id[1]])
            random.shuffle(files)

            dnfo = str(di) + ' of ' + str(len(
                dparam['mdselect'])) + ') dir: ' + str(
                    self.idir[id[1]]) + ' Selecting: ' + str(
                        id[0] * len(files))
            #print(dnfo)
            difo.write(dnfo + '\n')

            for i in range(id[0]):
                for n, m in enumerate(files):
                    data = hdt.read_rcdb_coordsandnm(self.idir[id[1]] + m)
                    if len(data['species']) < maxNa:
                        mols.append(data)

        dgen = pmf.dimergenerator(self.netdict['cnstfile'],
                                  self.netdict['saefile'],
                                  self.netdict['nnfprefix'],
                                  self.netdict['num_nets'], mols, gpuid)

        difo.write('Beginning dimer generation...\n')

        Nt = 0
        Nd = 0
        for i in range(Nr):
            dgen.init_dynamics(Nm, V, L, dt, T)

            for j in range(Ns):
                if j != 0:
                    dgen.run_dynamics(Ni)

                fname = self.cdir + 'dimer-' + str(tid).zfill(2) + str(
                    i).zfill(2) + '-' + str(j).zfill(2) + '_'
                max_sig = dgen.__fragmentbox__(fname, sig)
                print('MaxSig:', max_sig)
                #difo.write('Step ('+str(i)+',',+str(j)+') ['+ str(dgen.Nd)+ '/'+ str(dgen.Nt)+']\n')
                difo.write('Step (' + str(i) + ',' + str(j) + ') [' +
                           str(dgen.Nd) + '/' + str(dgen.Nt) +
                           '] max sigma: ' + "{:.2f}".format(max_sig) +
                           ' generated ' + str(len(dgen.frag_list)) +
                           ' dimers...\n')

                Nt += dgen.Nt
                Nd += dgen.Nd

                #print('Step (',tid,',',i,') [', str(dgen.Nd), '/', str(dgen.Nt),'] generated ',len(dgen.frag_list), 'dimers...')
                #difo.write('Step ('+str(i)+') ['+ str(dgen.Nd)+ '/'+ str(dgen.Nt)+'] generated '+str(len(dgen.frag_list))+'dimers...\n')
                if max_sig > 3.0 * sig:
                    difo.write('Terminating dynamics -- max sigma: ' +
                               "{:.2f}".format(max_sig) + ' Ran for: ' +
                               "{:.2f}".format(j * Ni * dt) + 'fs\n')
                    break

        difo.write('Generated ' + str(Nd) + ' of ' + str(Nt) +
                   ' tested dimers. Percent: ' +
                   "{:.2f}".format(100.0 * Nd / float(Nt)))
        difo.close()