def perform_next(self): if self.ctx.last_step_kind == 'yambo' or self.ctx.last_step_kind == 'yambo_p2y': if load_node(self.ctx.yambo_res.out.gw.get_dict() ["yambo_pk"]).get_state() == u'FINISHED': if self.inputs.to_set_qpkrange and 'QPkrange' not in self.ctx.parameters_yambo.get_dict( ).keys(): self.ctx.parameters_yambo = default_qpkrange( self.ctx.pw_wf_res.out.pw.get_dict()["nscf_pk"], self.ctx.parameters_yambo) start_from_initialize = load_node( self.ctx.yambo_res.out.gw.get_dict() ["yambo_pk"]).inp.settings.get_dict().pop( 'INITIALISE', None) if start_from_initialize: # YamboRestartWf will initialize before starting QP calc for us, self.report( "YamboRestartWf will start from initialise mode (yambo init) " ) yambo_result = self.run_yambo() return ResultToContext(yambo_res=yambo_result) else: # Possibly a restart, after some type of failure, why was is not handled by YamboRestartWf? maybe restarting whole workchain self.report( " Restarting {}, this is some form of restart for the workchain" .format(self.ctx.last_step_kind)) yambo_result = self.run_yambo() return ResultToContext(yambo_res=yambo_result) if len(self.ctx.yambo_pks) > 0: if load_node(self.ctx.yambo_pks[-1]).get_state( ) == u'FAILED': # Needs a resubmit depending on the error. self.report( "Last {} calculation (pk: {}) failed, will attempt a restart" .format(self.ctx.last_step_kind, self.ctx.yambo_pks[-1])) if self.ctx.last_step_kind == 'pw' and self.ctx.pw_wf_res: if self.ctx.pw_wf_res.out.pw.get_dict()['success'] == True: self.report( "PwRestartWf was successful, running initialize next with: YamboRestartWf " ) p2y_result = self.run_initialize() return ResultToContext(yambo_res=p2y_result) if self.ctx.pw_wf_res.out.pw.get_dict()['success'] == False: self.report("PwRestartWf subworkflow NOT successful") return if self.ctx.last_step_kind == None or self.ctx.last_step_kind == 'pw' and not self.ctx.pw_wf_res: # this is likely the very begining, we can start with the scf/nscf here extra = {} self.report("Launching PwRestartWf ") if 'parameters_pw_nscf' in self.inputs.keys(): extra['parameters_nscf'] = self.inputs.parameters_pw_nscf if 'parent_folder' in self.inputs.keys(): extra['parent_folder'] = self.inputs.parent_folder pw_wf_result = self.run_pw(extra) return ResultToContext(pw_wf_res=pw_wf_result)
def yambo_restart(self): """Submits a yambo calculation using the yambo plugin This function submits a calculation, usually this represents a resubmission of a failed calculation, or a continuation from P2Y/Init run. """ calc = load_node(self.ctx.yambo_pks[-1]) if calc.get_state() == calc_states.SUBMISSIONFAILED: calc = self.get_last_submitted(calc.pk) if not calc: raise ValidationError("restart calculations can not start from" "calculations in SUBMISSIONFAILED state") return #parameters = calc.get_inputs_dict()['parameters'].get_dict() parent_folder = calc.out.remote_folder new_settings = self.inputs.settings.get_dict() parent_calc = parent_folder.get_inputs_dict( link_type=LinkType.CREATE)['remote_folder'] yambo_parent = isinstance(parent_calc, YamboCalculation) p2y_restart = calc.get_state( ) != calc_states.FINISHED and calc.inp.settings.get_dict().pop( 'INITIALISE', None) == True if not yambo_parent or p2y_restart == True: new_settings['INITIALISE'] = True self.ctx.last = 'INITIALISE' self.report(" restarting from: {}, a P2Y calculation ".format( self.ctx.yambo_pks[-1])) else: new_settings['INITIALISE'] = False self.ctx.last = 'NOTINITIALISE' self.report(" restarting from: {}, a GW calculation ".format( self.ctx.yambo_pks[-1])) inputs = generate_yambo_input_params(self.inputs.precode, self.inputs.yambocode, parent_folder, self.ctx.parameters, self.ctx.calculation_set, ParameterData(dict=new_settings)) future = self.run_yambo(inputs) self.ctx.yambo_pks.append(future.pid) self.ctx.restart += 1 self.report(" restarting from:{} ".format(future.pid)) return ResultToContext(yambo_restart=future)
def yambobegin(self): """Submits a calculation using the yambo plugin. This function takes inputs provided and using the YamboCalculation class submits a calculation. This will run only *ONE* calculation at a time, it may be a p2y conversion or a yambo init or a yambo calculation run, P2Y conversion will be done by providing a parent calculation of type PW, Initialize (yambo init) calculation can be done independently by having the INITIALISE key in the settings dict. Yambo Calc will be done when the parent calculation is P2Y/other yambo calculation, and INITIALISE is not provided. """ self.ctx.yambo_pks = [] self.ctx.yambo_nodes = [] self.ctx.restart = 0 # run YamboCalculation if not isinstance(self.inputs.parent_folder, RemoteData): raise InputValidationError("parent_calc_folder must be of" " type RemoteData") self.ctx.last = '' self.ctx.parameters = self.inputs.parameters self.ctx.calculation_set = self.inputs.calculation_set new_settings = self.inputs.settings.get_dict() parent_calc = self.inputs.parent_folder.get_inputs_dict( link_type=LinkType.CREATE)['remote_folder'] yambo_parent = isinstance(parent_calc, YamboCalculation) if 'INITIALISE' not in new_settings.keys() and not yambo_parent: new_settings['INITIALISE'] = True self.ctx.last = 'INITIALISE' try: restart_options = self.inputs.restart_options try: max_restarts = restart_options.get_dict()['max_restarts'] except KeyError: max_restarts = 5 except AttributeError: restart_options = None max_restarts = 5 self.ctx.max_restarts = max_restarts inputs = generate_yambo_input_params(self.inputs.precode, self.inputs.yambocode, self.inputs.parent_folder, self.ctx.parameters, self.ctx.calculation_set, ParameterData(dict=new_settings)) future = self.run_yambo(inputs) self.report("workflow start, submitted {}".format(future.pid)) return ResultToContext(yambo=future)
def yambobegin(self): """ Run the pw-> yambo conversion, init and yambo run # precodename,yambocodename, parent_folder, parameters, calculation_set=None, settings """ self.ctx.yambo_pks = [] self.ctx.yambo_nodes = [] self.ctx.restart = 0 # run YamboCalculation if not isinstance(self.inputs.parent_folder, RemoteData): raise InputValidationError("parent_calc_folder must be of" " type RemoteData") self.ctx.last = '' self.ctx.parameters = self.inputs.parameters self.ctx.calculation_set = self.inputs.calculation_set new_settings = self.inputs.settings.get_dict() parent_calc = self.inputs.parent_folder.get_inputs_dict( link_type=LinkType.CREATE)['remote_folder'] yambo_parent = isinstance(parent_calc, YamboCalculation) if 'INITIALISE' not in new_settings.keys() and not yambo_parent: new_settings['INITIALISE'] = True self.ctx.last = 'INITIALISE' try: restart_options = self.inputs.restart_options try: max_restarts = restart_options.get_dict()['max_restarts'] except KeyError: max_restarts = 5 except AttributeError: restart_options = None max_restarts = 5 self.ctx.max_restarts = max_restarts inputs = generate_yambo_input_params(self.inputs.precode, self.inputs.yambocode, self.inputs.parent_folder, self.ctx.parameters, self.ctx.calculation_set, ParameterData(dict=new_settings)) future = self.run_yambo(inputs) self.report("workflow start, submitted {}".format(future.pid)) return ResultToContext(yambo=future)
def pwbegin(self): """ start SCF/NSCF """ if 'parent_folder' in self.inputs.keys(): if not isinstance(self.inputs.parent_folder, RemoteData): raise InputValidationError( "parent_calc_folder when defined must be of" " type RemoteData") parent_folder = None inputs = {} if 'parent_folder' in self.inputs.keys(): parameters = self.inputs.parameters.get_dict() parent_folder = self.inputs.parent_folder calc = parent_folder.get_inputs_dict( link_type=LinkType.CREATE)['remote_folder'] if calc.get_inputs_dict()['parameters'].get_dict( )['CONTROL']['calculation'] == 'scf' and calc.get_state( ) == 'FINISHED': # next nscf if 'force_symmorphic' not in parameters['SYSTEM']: parameters['SYSTEM']['force_symmorphic'] = True if 'nbnd' not in parameters['SYSTEM']: try: parameters['SYSTEM']['nbnd'] = calc.get_outputs_dict( )['output_parameters'].get_dict( )['number_of_electrons'] * 2 except KeyError: parameters['SYSTEM']['nbnd'] = int( calc.get_outputs_dict()['output_parameters']. get_dict()['number_of_bands'] * 1.2) # 20% more parameters['CONTROL']['calculation'] = 'nscf' parameters = ParameterData(dict=parameters) if 'parameters_nscf' in self.inputs.keys(): parameters = self.inputs.parameters_nscf inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, parameters, self.inputs.calculation_set, self.inputs.kpoints, self.inputs.gamma, self.inputs.settings, parent_folder) self.ctx.scf_pk = calc.pk self.report(" submitted NSCF {} ".format(calc.pk)) if calc.get_inputs_dict()['parameters'].get_dict( )['CONTROL']['calculation'] == 'scf' and calc.get_state( ) != 'FINISHED': # starting from failed SCF self.report("restarting failed SCF {} ".format(calc.pk)) inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, self.inputs.parameters, self.inputs.calculation_set, self.inputs.kpoints, self.inputs.gamma, self.inputs.settings, parent_folder) if calc.get_inputs_dict()['parameters'].get_dict( )['CONTROL']['calculation'] == 'nscf' and calc.get_state( ) == 'FINISHED': # self.report(" workflow completed nscf successfully, exiting") self.ctx.nscf_pk = calc.pk # NSCF is done, we should exit else: self.report("Running from SCF") inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, self.inputs.parameters, self.inputs.calculation_set, self.inputs.kpoints, self.inputs.gamma, self.inputs.settings, parent_folder) future = submit(PwBaseWorkChain, **inputs) self.ctx.pw_pks = [] self.ctx.pw_pks.append(future.pid) self.ctx.restart = 0 self.ctx.success = False self.ctx.scf_pk = None self.ctx.nscf_pk = None self.report("submitted subworkflow {}".format(future.pid)) return ResultToContext(first_calc=future)
def pw_continue(self): # restart if neccessary calc = None if len(self.ctx.pw_pks) == 1: calc = load_node(self.ctx.first_calc.out.CALL.pk) else: calc = load_node(self.ctx.last_calc.out.CALL.pk) self.report(" continuing from calculation {}".format(calc.pk)) parameters = calc.get_inputs_dict()['parameters'].get_dict() scf = '' parent_folder = None if parameters['CONTROL']['calculation'] == 'scf' and calc.get_state( ) == 'FINISHED': scf = 'nscf' parent_folder = calc.out.remote_folder self.ctx.scf_pk = calc.pk elif parameters['CONTROL']['calculation'] == 'scf' and calc.get_state( ) != 'FINISHED': scf = 'scf' # RESTART parent_folder = calc.out.remote_folder self.ctx.restart += 1 # so we do not end up in an infinite loop elif parameters['CONTROL']['calculation'] == 'nscf' and calc.get_state( ) == 'FINISHED': self.ctx.nscf_pk = calc.pk self.ctx.success = True self.ctx.restart += 1 # so we do not end up in an infinite loop return # we are finished, ideally we should not need to arrive here, this is also done at self.pw_should_continue elif parameters['CONTROL']['calculation'] == 'nscf' and calc.get_state( ) != 'FINISHED': scf = 'nscf' # RESTART parent_folder = calc.out.remote_folder self.ctx.restart += 1 # so we do not end up in an infinite loop else: self.ctx.success = False self.report("workflow in an inconsistent state.") return if scf == 'nscf': if 'force_symmorphic' not in parameters['SYSTEM']: parameters['SYSTEM']['force_symmorphic'] = True if 'nbnd' not in parameters['SYSTEM']: try: parameters['SYSTEM']['nbnd'] = calc.get_outputs_dict( )['output_parameters'].get_dict( )['number_of_electrons'] * 2 except KeyError: parameters['SYSTEM']['nbnd'] = int( calc.get_outputs_dict() ['output_parameters'].get_dict()['number_of_bands'] * 1.2) # 20% more parameters['CONTROL']['calculation'] = scf self.report(" calculation type: {} and system {}".format( parameters['CONTROL']['calculation'], parameters['SYSTEM'])) parameters = ParameterData(dict=parameters) if 'parameters_nscf' in self.inputs.keys(): parameters = self.inputs.parameters_nscf inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, parameters, self.inputs.calculation_set, self.inputs.kpoints, self.inputs.gamma, self.inputs.settings, parent_folder) #future = submit (PwProcess, **inputs) future = submit(PwBaseWorkChain, **inputs) self.ctx.pw_pks.append(future.pid) self.ctx.restart += 1 self.report("submitted pw subworkflow {}".format(future.pid)) return ResultToContext(last_calc=future)
def pwbegin(self): """This function constructs the correct parameters to be passed to the subworkflow, and will also determine the type (SCF vs NSCF) This function evaluates the inputs to the workflow, and if there is a parent calculation passed, check its type if SCF, then performs and NSCF. If there is no parent calculation, will default to running an SCF calculation, all done through subworkflows from aiida-quantumespresso """ if 'parent_folder' in self.inputs.keys(): if not isinstance(self.inputs.parent_folder, RemoteData): raise InputValidationError( "parent_calc_folder when defined must be of" " type RemoteData") try: restart_options = self.inputs.restart_options try: max_restarts = restart_options.get_dict()['max_restarts'] except KeyError: max_restarts = 4 except AttributeError: restart_options = None max_restarts = 4 self.ctx.max_restarts = max_restarts parent_folder = None inputs = {} if 'parent_folder' in self.inputs.keys(): parameters = self.inputs.parameters.get_dict( ) # Will be replaced by parameters_nscf if present and NSCF calc follows. parent_folder = self.inputs.parent_folder calc = parent_folder.get_inputs_dict( link_type=LinkType.CREATE)['remote_folder'] if calc.get_inputs_dict()['parameters'].get_dict( )['CONTROL']['calculation'] == 'scf' and calc.get_state( ) == 'FINISHED': # next nscf if 'calculation_set_nscf' not in self.inputs.keys(): self.inputs.calculation_set_nscf = self.inputs.calculation_set if 'settings_nscf' not in self.inputs.keys(): self.inputs.settings_nscf = self.inputs.settings if 'kpoints_nscf' not in self.inputs.keys(): self.inputs.kpoints_nscf = self.inputs.kpoints if 'parameters_nscf' in self.inputs.keys(): parameters = self.inputs.parameters_nscf.get_dict() if 'force_symmorphic' not in parameters['SYSTEM']: parameters['SYSTEM']['force_symmorphic'] = True if 'nbnd' not in parameters['SYSTEM']: try: parameters['SYSTEM']['nbnd'] = calc.get_outputs_dict( )['output_parameters'].get_dict( )['number_of_electrons'] * 10 except KeyError: parameters['SYSTEM']['nbnd'] = int( calc.get_outputs_dict()['output_parameters']. get_dict()['number_of_bands'] * 10) # if 'ELECTRONS' not in parameters: parameters['ELECTRONS'] = {} parameters['ELECTRONS']['diagonalization'] = 'davidson' parameters['ELECTRONS']['conv_thr'] = 0.000001 parameters['SYSTEM']['nbnd'] = int( parameters['SYSTEM']['nbnd']) parameters['CONTROL']['calculation'] = 'nscf' self.report("NSCF PARAMS {}".format(parameters)) self.inputs.parameters_nscf = ParameterData( dict=parameters ) # Added to inputs to allow for RESTART from failed NSCF inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, self.inputs.parameters_nscf, self.inputs.calculation_set_nscf, self.inputs.kpoints_nscf, self.inputs.gamma, self.inputs.settings_nscf, parent_folder) self.ctx.scf_pk = calc.pk self.report(" submitted NSCF {} ".format(calc.pk)) if calc.get_inputs_dict()['parameters'].get_dict( )['CONTROL']['calculation'] == 'scf' and calc.get_state( ) != 'FINISHED': # starting from failed SCF self.report("restarting failed SCF {} ".format(calc.pk)) inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, self.inputs.parameters, self.inputs.calculation_set, self.inputs.kpoints, self.inputs.gamma, self.inputs.settings, parent_folder) if calc.get_inputs_dict()['parameters'].get_dict( )['CONTROL']['calculation'] == 'nscf' and calc.get_state( ) != 'FINISHED': # starting from failed NSCF self.report("restarting failed NSCF {} ".format(calc.pk)) inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, self.inputs.parameters_nscf, self.inputs.calculation_set_nscf, self.inputs.kpoints_nscf, self.inputs.gamma, self.inputs.settings_nscf, parent_folder) if calc.get_inputs_dict()['parameters'].get_dict( )['CONTROL']['calculation'] == 'nscf' and calc.get_state( ) == 'FINISHED': # self.report(" workflow completed nscf successfully, exiting") self.ctx.nscf_pk = calc.pk # NSCF is done, we should exit return else: self.report("Running from SCF") inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, self.inputs.parameters, self.inputs.calculation_set, self.inputs.kpoints, self.inputs.gamma, self.inputs.settings, parent_folder) future = submit(PwBaseWorkChain, **inputs) self.ctx.pw_pks = [] self.ctx.pw_pks.append(future.pid) self.ctx.restart = 0 self.ctx.success = False self.ctx.scf_pk = None self.ctx.nscf_pk = None self.report("submitted subworkflow {}".format(future.pid)) return ResultToContext(first_calc=future)
def pw_continue(self): """This function does the actual submissions after the decision has been made whether to continue or not, and will (re)start and SCF (NSCF) This function does the actual submission after the first submission done in `self.pwbegin` are complete, and will either restart a failed SCF subworkflow or start an NSCF subworkflow from SCF inputs, or restart a failed NSCF subworkflow """ # restart if neccessary calc = None if len(self.ctx.pw_pks) == 1: calc = load_node(self.ctx.first_calc.out.CALL.pk) else: calc = load_node(self.ctx.last_calc.out.CALL.pk) self.report(" continuing from calculation {}".format(calc.pk)) parameters = calc.get_inputs_dict()['parameters'].get_dict() scf = '' parent_folder = None if parameters['CONTROL']['calculation'] == 'scf' and calc.get_state( ) == 'FINISHED': scf = 'nscf' parent_folder = calc.out.remote_folder self.ctx.scf_pk = calc.pk elif parameters['CONTROL']['calculation'] == 'scf' and calc.get_state( ) != 'FINISHED': scf = 'scf' # RESTART parent_folder = calc.out.remote_folder self.ctx.restart += 1 # so we do not end up in an infinite loop elif parameters['CONTROL']['calculation'] == 'nscf' and calc.get_state( ) == 'FINISHED': self.ctx.nscf_pk = calc.pk self.ctx.success = True self.ctx.restart += 1 # so we do not end up in an infinite loop return # we are finished, ideally we should not need to arrive here, this is also done at self.pw_should_continue elif parameters['CONTROL']['calculation'] == 'nscf' and calc.get_state( ) != 'FINISHED': scf = 'nscf' # RESTART parent_folder = calc.out.remote_folder self.ctx.restart += 1 # so we do not end up in an infinite loop else: self.ctx.success = False self.report("workflow in an inconsistent state.") return if 'parameters_nscf' in self.inputs.keys(): parameters = self.inputs.parameters_nscf.get_dict() if scf == 'nscf': if 'calculation_set_nscf' not in self.inputs.keys(): self.inputs.calculation_set_nscf = self.inputs.calculation_set if 'settings_nscf' not in self.inputs.keys(): self.inputs.settings_nscf = self.inputs.settings if 'kpoints_nscf' not in self.inputs.keys(): self.inputs.kpoints_nscf = self.inputs.kpoints if 'force_symmorphic' not in parameters['SYSTEM']: parameters['SYSTEM']['force_symmorphic'] = True if 'nbnd' not in parameters['SYSTEM']: try: parameters['SYSTEM']['nbnd'] = calc.get_outputs_dict( )['output_parameters'].get_dict( )['number_of_electrons'] * 10 except KeyError: parameters['SYSTEM']['nbnd'] = int( calc.get_outputs_dict() ['output_parameters'].get_dict()['number_of_bands'] * 10) # parameters['SYSTEM']['nbnd'] = int(parameters['SYSTEM']['nbnd']) parameters['CONTROL']['calculation'] = scf if 'ELECTRONS' not in parameters: parameters['ELECTRONS'] = {} parameters['ELECTRONS']['diagonalization'] = 'davidson' parameters['ELECTRONS']['conv_thr'] = 0.000001 self.report(" calculation type: {} and system {}".format( parameters['CONTROL']['calculation'], parameters['SYSTEM'])) parameters = ParameterData(dict=parameters) if scf == 'nscf': inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, parameters, self.inputs.calculation_set_nscf, self.inputs.kpoints_nscf, self.inputs.gamma, self.inputs.settings_nscf, parent_folder) else: inputs = generate_pw_input_params( self.inputs.structure, self.inputs.codename, self.inputs.pseudo_family, parameters, self.inputs.calculation_set, self.inputs.kpoints, self.inputs.gamma, self.inputs.settings, parent_folder) future = submit(PwBaseWorkChain, **inputs) self.ctx.pw_pks.append(future.pid) self.ctx.restart += 1 self.report("submitted pw subworkflow {}".format(future.pid)) return ResultToContext(last_calc=future)
def perform_next(self): """This function will submit the next step, depending on the information provided in the context The next step will be a yambo calculation if the provided inputs are a previous yambo/p2y run Will be a PW scf/nscf if the inputs do not provide the NSCF or previous yambo parent calculations""" if self.ctx.last_step_kind == 'yambo' or self.ctx.last_step_kind == 'yambo_p2y' : if load_node(self.ctx.yambo_res.out.gw.get_dict()["yambo_pk"]).get_state() == u'FINISHED': if self.inputs.to_set_qpkrange and 'QPkrange'\ not in self.ctx.parameters_yambo.get_dict().keys(): self.ctx.parameters_yambo = default_qpkrange( self.ctx.pw_wf_res.out.pw.get_dict()["nscf_pk"],\ self.ctx.parameters_yambo) if self.inputs.to_set_bands and ('BndsRnXp' not in self.ctx.parameters_yambo.get_dict().keys()\ or 'GbndRnge' not in self.ctx.parameters_yambo.get_dict().keys()): self.ctx.parameters_yambo = default_bands( self.ctx.pw_wf_res.out.pw.get_dict()["nscf_pk"],\ self.ctx.parameters_yambo) start_from_initialize = load_node(self.ctx.yambo_res.out.gw.get_dict()\ ["yambo_pk"]).inp.settings.get_dict().pop('INITIALISE', None) if start_from_initialize: # YamboRestartWf will initialize before starting QP calc for us, INIT != P2Y self.report ("YamboRestartWf will start from initialise mode (yambo init) ") yambo_result = self.run_yambo() return ResultToContext( yambo_res= yambo_result ) else: # Possibly a restart, after some type of failure, why was is not handled by YamboRestartWf? maybe restarting whole workchain self.report(" Restarting {}, this is some form of restart for the workchain".format(\ self.ctx.last_step_kind) ) yambo_result = self.run_yambo() return ResultToContext( yambo_res= yambo_result ) if len(self.ctx.yambo_pks) > 0: if load_node(self.ctx.yambo_pks[-1] ).get_state() == u'FAILED': # Needs a resubmit depending on the error. self.report("Last {} calculation (pk: {}) failed, will attempt a restart".format(\ self.ctx.last_step_kind, self.ctx.yambo_pks[-1] )) if self.ctx.last_step_kind == 'pw' and self.ctx.pw_wf_res : if self.ctx.pw_wf_res.out.pw.get_dict()['success'] == True: self.report("PwRestartWf was successful, running P2Y next with: YamboRestartWf ") p2y_result = self.run_p2y() return ResultToContext( yambo_res= p2y_result ) if self.ctx.pw_wf_res.out.pw.get_dict()['success'] == False: self.report("PwRestartWf subworkflow NOT successful") return if self.ctx.last_step_kind == None or self.ctx.last_step_kind == 'pw' and not self.ctx.pw_wf_res: # this is likely the very begining, we can start with the scf/nscf here extra = {} self.report("Launching PwRestartWf ") if 'parameters_pw_nscf' in self.inputs.keys(): extra['parameters_nscf'] = self.inputs.parameters_pw_nscf if 'calculation_set_pw_nscf' in self.inputs.keys(): extra['calculation_set_pw_nscf'] = self.inputs.calculation_set_pw_nscf if 'settings_pw_nscf' in self.inputs.keys(): extra['settings_pw_nscf'] = self.inputs.settings_pw_nscf if 'kpoint_pw_nscf' in self.inputs.keys(): extra['kpoint_pw_nscf'] = self.inputs.kpoint_pw_nscf if 'restart_options_pw' in self.inputs.keys(): extra['restart_options'] = self.inputs.restart_options_pw if 'parent_folder' in self.inputs.keys(): extra['parent_folder'] = self.inputs.parent_folder pw_wf_result = self.run_pw(extra) return ResultToContext( pw_wf_res = pw_wf_result )