Exemple #1
0
    def load_S2_predictions(self, expS2File):

        self.simulations = {}
        self.S2 = {}

        starttime = time.time()
        messageTemplate = "loading S2 predictions [{:3d}/{:3d}], ETA: {:4.1f} sec."
        message         = messageTemplate.format(0, len(self.simNames), 0)
        sys.stdout.write(message)
        sys.stdout.flush()

        for n, simName in enumerate(self.simNames):

            self.simulations[simName] = md2nmr.md2nmr(self.runName,
                                        path=self.simPath+'/'+simName,
                                        rerun=self.rerunMD2NMR, verbose=False)

            self.simulations[simName].compute_order_parameters()
            self.S2[simName] = self.simulations[simName].NHcorrelations[0].S2 

            eta = (time.time() - starttime) / (n+1) * (len(self.simNames) - n+1)
            backspace = len(message) * '\b'
            message = messageTemplate.format(n+1, len(self.simNames), eta)
            sys.stdout.write(backspace + message)
            sys.stdout.flush()

        sys.stdout.write('\n')

        # load experimental data
        simName         = self.simulations.keys()[0]
        self.S2resids   = self.simulations[simName].resids
        self.S2resnames = self.simulations[simName].resnames
        self.simulations[simName].NHcorrelations[0].read_exp_S2(expS2File,
                                  self.S2resids, self.S2resnames)
        self.S2exp = self.simulations[simName].NHcorrelations[0].S2_exp 
        if proc != 0:
            comm.send(work, dest=proc, tag=123)
        else:
            mywork = work


# receive work from root
if rank != root:
    work = comm.recv(source=0, tag=123)
else:
    work = mywork


# report work
for proc in range(numprocs):
    if rank == proc:
        for w in work:
            print rank, w
        #print ""
        sys.stdout.flush()
    comm.Barrier()


# do work
for simName in work:
    simulations[simName] = md2nmr.md2nmr(runName, path=simPath+'/'+simName, rerun=rerun, verbose=False)
    simulations[simName].compute_order_parameters()


print "Process {} done.".format(rank)
Exemple #3
0
#               'amber99sbnmr1-ildn',
#               'charmm22star',
#               'charmm27',
#               'oplsaa',
#               'gromos54a7']

print "Creating simulation objects"

simulations = {}
for ff in forcefields:
    for index in indices:

        simName = "{:s}_2IL6_{:d}".format(ff, index)
        print simName
        simulations[simName] = md2nmr.md2nmr(runName,
                                             path=simPath + '/' + simName,
                                             rerun=rerun,
                                             verbose=False)

print ""

print "Loading Data into simulation objects"
S2 = {}
for simName in simulations.keys():
    print simName
    simulations[simName].compute_order_parameters()
    S2[simName] = simulations[simName].NHcorrelations[0].S2

# load experimental data
resids = simulations[simName].resids
resnames = simulations[simName].resnames
simulations[simName].NHcorrelations[0].read_exp_S2(expDatFile, resids,