def rexHist(iterable, title, write=False, imgFilePath=None): """ `iterable` *string # An iterable of the CHARMM .out files `title` string # The title of the plot. `write` [`False`,`"svg"`,`"png"`] # The plot's output format, # False won't write a file. `imgFilePath` string # The plot's file path, defaults # to `$cwd/default_title`. """ fileList = list(iterable) fileList = map(expandPath, fileList) tempArray = [] for fileName in fileList: print 'Processing %s...' % fileName filePointer = open(fileName) rawData = getProp(filePointer, 'averener', 'avertemp') tempArray.append(np.array(rawData['avertemp']).mean()) # Calc Temp histData = np.histogram(rawData['averener'], 20, new=True) pyplot.plot(histData[1][1:],histData[0],label=os.path.basename(fileName)) pyplot.legend( ['%3dK' % tempArray[i] for i in xrange(len(fileList))] ,loc=0, ncol=2) pyplot.xlabel(r'$Energy\ (kcal\ mol^{-1})$') pyplot.ylabel(r'$Frequency$') pyplot.title(r'%s' % title) if write: if imgFilePath is None: imgFilePath = '%s/%s.%s' % (os.path.dirname(fileList[0]), title, write) else: imgFilePath = expandPath(imgFilePath) pyplot.savefig(imgFilePath, format=write) else: pyplot.show()
def read_charmm_out(self,filename): outDict = getprop.getProp(open(filename),'dynatime','dynaener', 'dynapresse','dynapressi','dynatemp') #'averener','dynavdw') if not self.startedout: self.ener = np.array(outDict['dynaener']) self.time = np.array(outDict['dynatime']) self.presse = np.array(outDict['dynapresse']) self.pressi = np.array(outDict['dynapressi']) self.temp = np.array(outDict['dynatemp']) self.startedout = True else: self.ener = np.append(self.ener,outDict['dynaener']) self.time = np.append(self.time,outDict['dynatime']) self.presse = np.append(self.presse,outDict['dynapresse']) self.pressi = np.append(self.pressi,outDict['dynapressi']) self.temp = np.append(self.temp,outDict['dynatemp'])
### Files to extract temperature data from tempFileList = glob('%s/*out_*' % taco.dcdPathname) tempFileBase = os.path.basename(tempFileList[0]).split('_')[0] tempFileList = [ '%s/%s_%d' % (taco.dcdPathname, tempFileBase, i) for i in xrange(len(tempFileList)) ] ### Files to extract dynamics data from dcdFileList = glob('%s/*dcd_*' % taco.dcdPathname) dcdFileBase = os.path.basename(dcdFileList[0]).split('_')[0] dcdFileList = [ '%s/%s_%d' % (taco.dcdPathname, dcdFileBase, i) for i in xrange(len(dcdFileList)) ] ### Temperature Data tempList = [] for tempFile in tempFileList: tempList.append(np.array(getProp(open(tempFile), 'avertemp', stopIter=1000)['avertemp']).mean()) ############# # DO Correl # ############# # Write/Run Correl Jobs if 0: taco.correlStart = 0 taco.correlStop = -2 for i, dcdFile in enumerate(dcdFileList): print "Processing Correl jobs on replica %d." % i taco.anlPathname = anlPath % (nscale, i) taco.anlFilename = '%s/gyro_%s.anl' % (taco.anlPathname, taco.correlAtomSelection) taco.outFilename = '%s/gyro_%s.out' % (taco.anlPathname, taco.correlAtomSelection) taco.inpFilename = '%s/gyro_%s.inp' % (taco.anlPathname, taco.correlAtomSelection)