def request(self, parameters: Parameters, compute: bool = True) -> Path: self.logger.info("request wave function for parameters %s", repr(parameters)) with cwd.WorkingDir(self.working_dir.parent): common_parameter_names = parameters.get_common_parameter_names( self.prototype, ) path = self.get_path(parameters) if path: self.logger.info("wave function is present") return path self.logger.info("wave function is not present") p = copy.deepcopy(self.prototype) for name in common_parameter_names: p[name] = parameters[name] if p not in self.missing_wave_functions: self.store_missing_wave_function(p) self.combinations = (self.stored_wave_functions + self.missing_wave_functions) if not compute: raise MissingWfnError(p) self._compute(p) return self.request(parameters, compute)
def get_simulation_path(self, parameters: Parameters) -> Optional[Path]: common_parameter_names = parameters.get_common_parameter_names( self.prototype) for p in self.stored_wave_functions: if p.has_same_common_parameters(parameters, common_parameter_names): path = self.working_dir.resolve() / "sim" / hash_string( repr(p)) return path return None