def _storeConfigurations(self): "Store Configuration files" self._updateStatus("prepare-configs") #pfnlist = [] # Save 4 config files for type in FILETYPE: inputs = self.clerk.getQEConfigurations(where = "taskid='%s' and type='%s'" % \ (self.taskid, type)) if len(inputs) == 0: return # assert input.type == type input = latestInput(inputs) fn = input.type #pfn = packname(input.id, fn) # E.g. 44XXJJG2filecrys #pfnlist.append(pfn) # Read text and store it in different location. # Not very efficient but will work for file of size < 1Mb text = readRecordFile(self.dds, input, fn) writeRecordFile(self.dds, self._job, fn, text) # -> qejobs directory self.dds.remember(self._job, fn) # Change object and filename? self._files.append(fn) # Main config file text = EPSC_IN_TEXT #% pfnlist # Should be 4 element list writeRecordFile(self.dds, self._job, EPSC_IN, text) # -> qejobs directory self.dds.remember(self._job, EPSC_IN) # Change object and filename? self._files.append(EPSC_IN)
def _storePosFile(self): "Stores positions to cp.pos file" str = "" for ts in range(len(self._pos)): str += " %s %s\n" % (self._step[ts], self._time[ts]) for atom in self._pos[ts]: str += " %s %s %s\n" % (atom[0], atom[1], atom[2]) str = str.rstrip("\n") writeRecordFile(self.dds, self._job, POSFILE, str) self.dds.remember(self._job, POSFILE) # Important step self._files.append(POSFILE)
def _storeVelFile(self): "Stores velocities to cp.vel file" str = "" for ts in range(len(self._vel)): str += " %s %s\n" % (self._step[ts], self._time[ts]) for atom in self._vel[ts]: str += " %s %s %s\n" % (atom[0], atom[1], atom[2]) str = str.rstrip("\n") writeRecordFile(self.dds, self._job, VELFILE, str) self.dds.remember(self._job, VELFILE) # Important step self._files.append(VELFILE)
def _createRunScript(self): "Creates run script" self._updateStatus("prepare-controls") server = self.clerk.getServers(id = self._job.serverid) self._task = self.clerk.getQETasks(id = self.taskid) if self._task.type == "trajectory": # Special case for trajectory task args = self._trajectoryArgs() else: args = self._commandArgs() cmds = [ "#!/bin/env bash", # Suppose there is bash available "export ESPRESSO_TMPDIR=%s/" % self._outdir(server), " ".join(args) ] writeRecordFile(self.dds, self._job, RUNSCRIPT, "\n".join(cmds)) # -> qejobs directory self.dds.remember(self._job, RUNSCRIPT) # Important step during which the .__dds_nodelist* files are created self._files.append(RUNSCRIPT)
def _createRunScript(self): "Creates run script" self._updateStatus("prepare-controls") server = self.clerk.getServers(id = self._job.serverid) self._task = self.clerk.getQETasks(id = self.taskid) dest = self.dds.abspath(self._job, server=server) # Important # This is a nasty HACK! # EPSC simulation if NOT ever intended for usage other than on desktop! cmds = [ "#!/bin/env bash", # Suppose there is bash available "", "dest='%s'" % dest, # Destination directory in qejobs (on computational cluster) "", "epsc3path=`which %s`" % EPSC_BIN, "cp $epsc3path $dest", # Copy binary to destination directory "cd $dest", # Go to this directory "./%s > %s" % (EPSC_BIN, EPSC_OUT)] # Execute binary writeRecordFile(self.dds, self._job, RUNSCRIPT, "\n".join(cmds)) # -> qejobs directory self.dds.remember(self._job, RUNSCRIPT) # Important step during which the .__dds_nodelist* files are created self._files.append(RUNSCRIPT)
def _storeConfigurations(self): "Store Configuration files" self._updateStatus("prepare-configs") inputs = self.clerk.getQEConfigurations(where = "taskid='%s'" % self.taskid) dds = self.dds if len(inputs) <= 0: return input = inputs[0] # Take the first input record fn = defaultInputName(input.type) pfn = packname(input.id, fn) # E.g. 44XXJJG2pw.in # Read text and store it in different location. # Not very efficient but will work for file of size < 1Mb text = readRecordFile(dds, input, fn) writeRecordFile(dds, self._job, pfn, text) # -> qejobs directory dds.remember(self._job, pfn) # Change object and filename? self._files.append(pfn)