def copyresult(self,jobnr,runnr): savepath = self.workpath+self.getparfolder(jobnr) if self.testrun: print "savepath "+savepath return True print "saving in: "+savepath if not os.path.isdir(savepath): os.mkdir(savepath) path = self.gettemppath(jobnr) success = True for importantfile in ["mist","CONTCAR","OSZICAR","OUTCAR","vasprun.xml"]: if not os.path.isfile(path+importantfile): success = False self.printstatus(jobnr,["file not found:",path+importantfile]) elif not os.path.getsize(path+importantfile)>0: success = False self.printstatus(jobnr,["file empty:",path+importantfile]) if not success: print "postprocess broken? ("+self.getparfolder(jobnr)+")" if self.oldFilesPath == self.workpath: runnr = files.getHighestNumber(savepath+self.workfiles[1][1]) for workfile in self.workfiles: self.deletehigher(jobnr,savepath+workfile[1],runnr) self.copymove(jobnr,path+workfile[0],savepath+workfile[1]+str(runnr),workfile[2]) if self.copyWAVECARback: self.deletehigher(jobnr,savepath+"WAVECAR",runnr) self.copymove(jobnr,path+"WAVECAR",savepath+"WAVECAR"+str(runnr)) self.copymove(jobnr,path+"CONTCAR",path+"POSCAR",True) return success
def getoldFile(self,jobnr,filename): oldpath="" if self.oldFilesPath == self.workpath or self.oldFilesPath=="": oldpath= self.workpath run = files.getHighestNumber(oldpath) self.detailedruns[jobnr]=run+1 self.jobruns[jobnr]=run else: oldpath=self.oldFilesPath if len(files.getDirectories(oldpath))==1: oldpath = files.getDirectories(self.oldFilesPath)[0]+filename else: oldpath= oldpath+self.getparfolder(jobnr,usepar2=self.oldusedparameters2)+filename newfile = [oldpath] print "searching in "+oldpath if not files.getHighestVersion(newfile): return "" if os.path.isfile(newfile[0]): return newfile[0] else: return ""