def init_sub_analyzers(self, series, calc, input): MethodAnalyzer.init_sub_analyzers(self, series, calc, input) source_path = QAanalyzer.run_info.source_path files = self.info.files if 'opt' in files: opt_out_xml = os.path.join(source_path, files.opt) self.wavefunction = WavefunctionAnalyzer(opt_out_xml)
def init_sub_analyzers(self, request=None): own_request = request == None if request == None: request = self.info.request #end if group_num = request.group_num #determine if the run was bundled if request.source.endswith('.xml'): self.info.type = 'single' else: self.info.type = 'bundled' self.bundle(request.source) return #end if self.vlog('reading input file: ' + request.source, n=1) input = QmcpackInput(request.source) input.pluralize() input.unroll_calculations() calculations = input.simulation.calculations self.info.set(input=input, ordered_input=input.read_xml(request.source)) project, wavefunction = input.get('project', 'wavefunction') wavefunction = wavefunction.get_single('psi0') subindent = self.subindent() self.wavefunction = WavefunctionAnalyzer(wavefunction, nindent=subindent) self.vlog('project id: ' + project.id, n=1) file_prefix = project.id if group_num != None: group_ext = '.g' + str(group_num).zfill(3) if not file_prefix.endswith(group_ext): file_prefix += group_ext #end if elif self.info.type == 'single': resdir, infile = os.path.split(request.source) #ifprefix = infile.replace('.xml','') ifprefix = infile.replace('.xml', '.') ls = os.listdir(resdir) for filename in ls: if filename.startswith(ifprefix) and filename.endswith('.qmc'): group_tag = filename.split('.')[-2] #file_prefix = 'qmc.'+group_tag file_prefix = project.id + '.' + group_tag break #end if #end for #end if if 'series' in project: series_start = int(project.series) else: series_start = 0 #end if self.vlog('data file prefix: ' + file_prefix, n=1) run_info = obj(file_prefix=file_prefix, series_start=series_start, source_path=os.path.split(request.source)[0], group_num=group_num, system=input.return_system()) self.info.transfer_from(run_info) self.set_global_info() if len(request.calculations) == 0: request.calculations = set(series_start + arange(len(calculations))) #end if method_aliases = dict() for method in self.opt_methods: method_aliases[method] = 'opt' #end for for method in self.vmc_methods: method_aliases[method] = 'vmc' #end for for method in self.dmc_methods: method_aliases[method] = 'dmc' #end for method_objs = ['qmc', 'opt', 'vmc', 'dmc'] for method in method_objs: self[method] = QAanalyzerCollection() #end for for index, calc in calculations.iteritems(): method = calc.method if method in method_aliases: method_type = method_aliases[method] else: self.error('method ' + method + ' is unrecognized') #end if if method_type in request.methods: series = series_start + index if series in request.calculations: if method in self.opt_methods: qma = OptAnalyzer(series, calc, input, nindent=subindent) primary = self.opt elif method in self.vmc_methods: qma = VmcAnalyzer(series, calc, input, nindent=subindent) primary = self.vmc elif method in self.dmc_methods: qma = DmcAnalyzer(series, calc, input, nindent=subindent) primary = self.dmc #end if primary[series] = qma self.qmc[series] = qma #end if #end if #end for for method in method_objs: if len(self[method]) == 0: del self[method] #end if #end for #Check for multi-qmc results such as # optimization or timestep studies results = QAanalyzerCollection() if 'opt' in self and len(self.opt) > 0: optres = OptimizationAnalyzer(input, self.opt, nindent=subindent) results.optimization = optres #end if if 'dmc' in self and len(self.dmc) > 1: maxtime = 0 times = dict() for series, dmc in self.dmc.iteritems(): blocks, steps, timestep = dmc.info.method_input.list( 'blocks', 'steps', 'timestep') times[series] = blocks * steps * timestep maxtime = max(times[series], maxtime) #end for dmc = QAanalyzerCollection() for series, time in times.iteritems(): if abs(time - maxtime) / maxtime < .5: dmc[series] = self.dmc[series] #end if #end for if len(dmc) > 1: results.timestep_study = TimestepStudyAnalyzer( dmc, nindent=subindent) #end if #end if if len(results) > 0: self.results = results #end if self.unset_global_info()