コード例 #1
0
 def get_appname(self):
     if self.hasInputFromPort('application'):
         return alpscore._get_path(self.getInputFromPort('application'))
     else:
         if self.appname != '':
             return alpscore._get_path(self.appname)
         else:
             raise ModuleError(self, 'No application specified')
コード例 #2
0
 def compute(self):
     input_file = self.getInputFromPort('input_file')
     output_file = self.interpreter.filePool.create_file(suffix='.txt')
     self.execute([
         alpscore._get_path('convert2text'), input_file.name, '>',
         output_file.name
     ])
     self.setResult('output_file', output_file)
コード例 #3
0
 def compute(self):
     outputfile = self.interpreter.filePool.create_file(suffix=self.suffix)
     cmdlist = [
         alpscore._get_path(self.extractapp),
         self.getInputFromPort('plot').name, '>', outputfile.name
     ]
     self.execute(cmdlist)
     self.setResult('file', outputfile)
     f = file(outputfile.name, 'r')
     self.setResult('source', f.read())
コード例 #4
0
 def convert(self, input_file):
     output_file = self.interpreter.filePool.create_file(suffix='.html')
     if platform.system() == 'Windows':
         cmdlist = ['msxsl.exe', input_file
                    ] + self.style + ['-o', output_file.name]
     else:
         cmdlist = [alpscore._get_path('xslttransform')
                    ] + self.style + [input_file, '>', output_file.name]
     self.execute(cmdlist)
     return output_file
コード例 #5
0
 def compute(self):
     tmp = self.interpreter.filePool.create_file()
     os.unlink(tmp.name)
     os.mkdir(tmp.name)
     resultdir = basic.Directory()
     resultdir.name = tmp.name
     id = self.getInputFromPort('fileID')
     paraminput = self.getInputFromPort('dmftparams')
     c = 0
     for parms in paraminput:
         f = file(os.path.join(resultdir.name, id + str(c)), 'w')
         for key in parms:
             value = parms[key]
             if type(value) == str:
                 f.write(str(key) + ' = "' + value + '"\n')
             else:
                 f.write(str(key) + ' = ' + str(value) + '\n')
         f.close()
         self.execute([alpscore._get_path('dmft'), f.name])
         c = c + 1
     self.setResult('dir', resultdir)
コード例 #6
0
 def compute(self):
     o = self.interpreter.filePool.create_file()
     os.unlink(o.name)
     os.mkdir(o.name)
     input_file = self.getInputFromPort("file")
     base_name = os.path.basename(input_file.name)
     dir = basic.Directory
     dir.name = o.name
     self.execute([
         'cd', o.name, ';',
         alpscore._get_path('parameter2xml'), input_file.name, base_name
     ])
     # Things would be easier on our side if ALPS somehow
     # advertised all the files it creates. Right now, it will be
     # hard to make sure all temporary files that are created will
     # be cleaned up. We are trying to keep all the temporaries
     # inside a temp directory, but the lack of control over where
     # the files are created hurt.
     ofile = basic.File()
     ofile.name = os.path.join(o.name, base_name + '.in.xml')
     self.setResult("output_dir", dir)
     self.setResult("output_file", ofile)
コード例 #7
0
 def get_path(self, appname):
     return alpscore._get_path(appname)
コード例 #8
0
 def compute(self):
     name = self.get_sim_name(self.getInputFromPort('dir').name)
     taskname = name.replace('.out.xml', '.task*.out.xml')
     tasklist = glob.glob(taskname)
     self.execute([alpscore._get_path('spinmc_evaluate')] + tasklist)
     self.setResult('dir', self.getInputFromPort('dir'))
コード例 #9
0
 def compute(self):
     name = self.get_sim_name(self.getInputFromPort('dir').name)
     self.execute([alpscore._get_path('loop'), '--evaluate', name])
     self.setResult('dir', self.getInputFromPort('dir'))