def define(cls, spec): super(SelfConsistentHubbardWorkChain, cls).define(spec) spec.input('structure', valid_type=StructureData) spec.input('hubbard_u', valid_type=ParameterData) spec.input('tolerance', valid_type=Float, default=Float(0.1)) spec.input('max_iterations', valid_type=Int, default=Int(5)) spec.input('is_insulator', valid_type=Bool, required=False) spec.input('meta_convergence', valid_type=Bool, default=Bool(False)) spec.expose_inputs(PwBaseWorkChain, namespace='scf', exclude=('structure')) spec.expose_inputs(HpWorkChain, namespace='hp', exclude=('parent_calculation')) spec.outline( cls.setup, cls.validate_inputs, if_(cls.should_run_recon)( cls.run_recon, cls.inspect_recon, ), while_(cls.should_run_iteration)( if_(cls.should_run_relax)( cls.run_relax, cls.inspect_relax, ), if_(cls.is_metal)(cls.run_scf_smearing).elif_(cls.is_magnetic)( cls.run_scf_smearing, cls.run_scf_fixed_magnetic).else_(cls.run_scf_fixed), cls.run_hp, cls.inspect_hp, ), cls.run_results, )
def define(cls, spec): super().define(spec) spec.expose_inputs(FleurEosWorkChain, namespace_options={ 'required': False, 'populate_defaults': False }, namespace='eos', exclude=('structure',)) spec.expose_inputs(FleurBaseRelaxWorkChain, namespace_options={ 'required': False, 'populate_defaults': False }, namespace='relax', exclude=('structure',)) spec.input('wf_parameters', valid_type=Dict, required=False) spec.input('eos_output', valid_type=Dict, required=False) spec.input('optimized_structure', valid_type=StructureData, required=False) spec.input('distance_suggestion', valid_type=Dict, required=False) spec.outline(cls.start, if_(cls.eos_needed)(cls.run_eos,), if_(cls.relax_needed)(cls.run_relax,), cls.make_magnetic) spec.output('magnetic_structure', valid_type=StructureData) # exit codes spec.exit_code(230, 'ERROR_INVALID_INPUT_PARAM', message='Invalid workchain parameters.') spec.exit_code(231, 'ERROR_INVALID_INPUT_CONFIG', message='Invalid input configuration.') spec.exit_code(380, 'ERROR_NOT_SUPPORTED_LATTICE', message='Specified substrate has to be bcc or fcc.') spec.exit_code(382, 'ERROR_RELAX_FAILED', message='Relaxation calculation failed.') spec.exit_code(383, 'ERROR_EOS_FAILED', message='EOS WorkChain failed.')
def define(cls, spec): """Define the process specification.""" # yapf: disable super().define(spec) spec.expose_inputs(PwRelaxWorkChain, namespace='relax', exclude=('clean_workdir', 'structure'), namespace_options={'required': False, 'populate_defaults': False, 'help': 'Inputs for the `PwRelaxWorkChain`, if not specified at all, the relaxation step is skipped.'}) spec.expose_inputs(PwBaseWorkChain, namespace='scf', exclude=('clean_workdir', 'pw.structure'), namespace_options={'help': 'Inputs for the `PwBaseWorkChain` for the SCF calculation.'}) spec.expose_inputs(PwBaseWorkChain, namespace='bands', exclude=('clean_workdir', 'pw.structure', 'pw.kpoints', 'pw.kpoints_distance'), namespace_options={'help': 'Inputs for the `PwBaseWorkChain` for the BANDS calculation.'}) spec.input('structure', valid_type=orm.StructureData, help='The inputs structure.') spec.input('clean_workdir', valid_type=orm.Bool, default=lambda: orm.Bool(False), help='If `True`, work directories of all called calculation will be cleaned at the end of execution.') spec.input('nbands_factor', valid_type=orm.Float, required=False, help='The number of bands for the BANDS calculation is that used for the SCF multiplied by this factor.') spec.input('bands_kpoints', valid_type=orm.KpointsData, required=False, help='Explicit kpoints to use for the BANDS calculation. Specify either this or `bands_kpoints_distance`.') spec.input('bands_kpoints_distance', valid_type=orm.Float, required=False, help='Minimum kpoints distance for the BANDS calculation. Specify either this or `bands_kpoints`.') spec.inputs.validator = validate_inputs spec.outline( cls.setup, if_(cls.should_run_relax)( cls.run_relax, cls.inspect_relax, ), if_(cls.should_run_seekpath)( cls.run_seekpath, ), cls.run_scf, cls.inspect_scf, cls.run_bands, cls.inspect_bands, cls.results, ) spec.exit_code(201, 'ERROR_INVALID_INPUT_NUMBER_OF_BANDS', message='Cannot specify both `nbands_factor` and `bands.pw.parameters.SYSTEM.nbnd`.') spec.exit_code(202, 'ERROR_INVALID_INPUT_KPOINTS', message='Cannot specify both `bands_kpoints` and `bands_kpoints_distance`.') spec.exit_code(401, 'ERROR_SUB_PROCESS_FAILED_RELAX', message='The PwRelaxWorkChain sub process failed') spec.exit_code(402, 'ERROR_SUB_PROCESS_FAILED_SCF', message='The scf PwBasexWorkChain sub process failed') spec.exit_code(403, 'ERROR_SUB_PROCESS_FAILED_BANDS', message='The bands PwBasexWorkChain sub process failed') spec.output('primitive_structure', valid_type=orm.StructureData, required=False, help='The normalized and primitivized structure for which the bands are computed.') spec.output('seekpath_parameters', valid_type=orm.Dict, required=False, help='The parameters used in the SeeKpath call to normalize the input or relaxed structure.') spec.output('scf_parameters', valid_type=orm.Dict, help='The output parameters of the SCF `PwBaseWorkChain`.') spec.output('band_parameters', valid_type=orm.Dict, help='The output parameters of the BANDS `PwBaseWorkChain`.') spec.output('band_structure', valid_type=orm.BandsData, help='The computed band structure.')
def define(cls, spec): super(HTSWorkChain, cls).define(spec) spec.expose_inputs(ZeoppCalculation, namespace='zeopp', include=['atomic_radii', 'code', 'metadata']) spec.expose_inputs(RaspaBaseWorkChain, namespace='raspa_base', exclude=['raspa.structure', 'raspa.parameters']) spec.input('structure', valid_type=CifData, help='Adsorbent framework CIF.') spec.input( "mixture", valid_type=Dict, help= 'A dictionary of components with their corresponding mol fractions in the mixture.' ) spec.input( "parameters", valid_type=Dict, help= 'It provides the parameters which control the decision making behavior of workchain.' ) spec.input( "geometric", valid_type=Dict, required=False, help= '[Only used by IsothermMultiTempWorkChain] Already computed geometric properties' ) spec.outline( cls.setup, cls.run_zeopp, cls.inspect_zeopp_calc, if_(cls.should_run_widom)( cls.run_raspa_widom, cls.inspect_widom_calc, if_(cls.should_run_gcmc)(cls.run_raspa_gcmc), ), cls.return_output_parameters, ) spec.output('output_parameters', valid_type=Dict, required=True, help='Results of the HTSWorkChain') spec.output_namespace( 'block_files', valid_type=SinglefileData, required=False, dynamic=True, help= 'Generated block pocket files for each probe if there are blocking spheres.' )
def define(cls, spec): """Define the process specification.""" # yapf: disable super().define(spec) spec.input('structure', valid_type=StructureData, help='The inputs structure.') spec.input('clean_workdir', valid_type=Bool, default=lambda: Bool(False), help='If `True`, work directories of all called calculation will be cleaned at the end of execution.') spec.expose_inputs(PwRelaxWorkChain, namespace='relax', exclude=('clean_workdir', 'structure'), namespace_options={'required': False, 'populate_defaults': False, 'help': 'Inputs for the `PwRelaxWorkChain`, if not specified at all, the relaxation step is skipped.'}) spec.expose_inputs(PwBandsWorkChain, namespace='bands', exclude=('clean_workdir', 'structure', 'relax'), namespace_options={'required': False, 'populate_defaults': False, 'help': 'Inputs for the `PwBandsWorkChain`.'}) spec.expose_inputs(PdosWorkChain, namespace='pdos', exclude=('clean_workdir', 'structure'), namespace_options={'required': False, 'populate_defaults': False, 'help': 'Inputs for the `PdosWorkChain`.'}) spec.input( 'kpoints_distance_override', valid_type=Float, required=False, help='Override for the kpoints distance value of all `PwBaseWorkChains` save for the `nscf` calculations.' ) spec.input( 'degauss_override', valid_type=Float, required=False, help='Override for the `degauss` value of all `PwBaseWorkChains` save for the `nscf` calculations.' ) spec.outline( cls.setup, if_(cls.should_run_relax)( cls.run_relax, cls.inspect_relax ), if_(cls.should_run_bands)( cls.run_bands, cls.inspect_bands ), if_(cls.should_run_pdos)( cls.run_pdos, cls.inspect_pdos ), cls.results ) spec.exit_code(401, 'ERROR_SUB_PROCESS_FAILED_RELAX', message='The PwRelaxWorkChain sub process failed') spec.exit_code(403, 'ERROR_SUB_PROCESS_FAILED_BANDS', message='The PwBandsWorkChain sub process failed') spec.exit_code(404, 'ERROR_SUB_PROCESS_FAILED_PDOS', message='The PdosWorkChain sub process failed') spec.output('structure', valid_type=StructureData, required=False) spec.output('band_parameters', valid_type=Dict, required=False) spec.output('band_structure', valid_type=BandsData, required=False) spec.output('nscf_parameters', valid_type=Dict, required=False) spec.output('dos', valid_type=XyData, required=False) spec.output('projections', valid_type=Orbital, required=False)
def define(cls, spec): super(HTSEvWorkChain, cls).define(spec) spec.expose_inputs(ZeoppCalculation, namespace='zeopp', include=['atomic_radii', 'code', 'metadata']) spec.expose_inputs(RaspaBaseWorkChain, namespace='raspa_base', exclude=['raspa.structure', 'raspa.parameters']) spec.input('structure', valid_type=CifData, help='Adsorbent framework CIF.') spec.input( "mixture", valid_type=Dict, help= 'A dictionary of components with their corresponding mol fractions in the mixture.' ) spec.input( "parameters", valid_type=Dict, help= 'It provides the parameters which control the decision making behavior of workchain.' ) spec.input("ev_output", valid_type=Dict, required=False, help='Output Dict of VoronoiEnergyWorkChain') spec.outline( cls.setup, cls.run_zeopp, if_(cls.should_run_widom)( cls.run_raspa_widom, cls.inspect_widom_calc, if_(cls.should_run_gcmc)(cls.run_raspa_gcmc), ), cls.return_output_parameters, ) spec.output('output_parameters', valid_type=Dict, required=True, help='Results of the HTSEvWorkChain') spec.expose_outputs(ZeoppCalculation, include=['block']) #only if porous
def define(cls, spec): super().define(spec) spec.input('fleur', valid_type=Code, required=True) spec.input('inpgen', valid_type=Code, required=False) spec.input('wf_parameters', valid_type=Dict, required=False) spec.input('structure', valid_type=StructureData, required=False) spec.input('calc_parameters', valid_type=Dict, required=False) spec.input('fleurinp', valid_type=FleurinpData, required=False) spec.input('remote_data', valid_type=RemoteData, required=False) spec.input('options', valid_type=Dict, required=False) spec.input('settings', valid_type=Dict, required=False) spec.input('settings_inpgen', valid_type=Dict, required=False) spec.outline(cls.start, cls.validate_input, if_(cls.fleurinpgen_needed)(cls.run_fleurinpgen), cls.run_fleur, cls.inspect_fleur, cls.get_res, while_(cls.condition)(cls.run_fleur, cls.inspect_fleur, cls.get_res), cls.return_results) spec.output('fleurinp', valid_type=FleurinpData) spec.output('output_scf_wc_para', valid_type=Dict) spec.output('last_fleur_calc_output', valid_type=Dict) # exit codes spec.exit_code(230, 'ERROR_INVALID_INPUT_PARAM', message='Invalid workchain parameters.') spec.exit_code(231, 'ERROR_INVALID_INPUT_CONFIG', message='Invalid input configuration.') spec.exit_code(233, 'ERROR_INVALID_CODE_PROVIDED', message='Input codes do not correspond to fleur or inpgen respectively.') spec.exit_code(235, 'ERROR_CHANGING_FLEURINPUT_FAILED', message='Input file modification failed.') spec.exit_code(236, 'ERROR_INVALID_INPUT_FILE', message="Input file was corrupted after user's modifications.") spec.exit_code(360, 'ERROR_INPGEN_CALCULATION_FAILED', message='Inpgen calculation failed.') spec.exit_code(361, 'ERROR_FLEUR_CALCULATION_FAILED', message='Fleur calculation failed.') spec.exit_code(362, 'ERROR_DID_NOT_CONVERGE', message='SCF cycle did not lead to convergence.')
def define(cls, spec): super(IterHarmonicApprox, cls).define(spec) spec.expose_inputs(PhonopyWorkChain, exclude=[ 'immigrant_calculation_folders', 'calculation_nodes', 'dry_run' ]) spec.input('max_iteration', valid_type=Int, required=False, default=Int(10)) spec.input('number_of_snapshots', valid_type=Int, required=False, default=Int(100)) spec.input('number_of_steps_for_fitting', valid_type=Int, required=False, default=Int(4)) spec.input('random_seed', valid_type=Int, required=False) spec.input('temperature', valid_type=Float, required=False, default=Float(300.0)) spec.input('initial_nodes', valid_type=Dict, required=False) spec.input('include_ratio', valid_type=Float, required=False) spec.outline( cls.initialize, if_(cls.import_initial_nodes)( cls.set_initial_nodes, cls.run_phonon, ).else_(cls.run_initial_phonon, ), while_(cls.is_loop_finished)(cls.run_phonon, ), )
def define(cls, spec): """Define the process specification.""" # yapf: disable super().define(spec) # spec.expose_inputs(PwRelaxWorkChain, namespace='relax', exclude=('clean_workdir', 'structure'), # namespace_options={'required': False, 'populate_defaults': False, # 'help': 'Inputs for the `PwRelaxWorkChain`, if not specified at all, the relaxation step is skipped.'}) spec.expose_inputs(PwBaseWorkChain, namespace='scf', exclude=('clean_workdir', 'pw.structure'), namespace_options={'help': 'Inputs for the `PwBaseWorkChain` for the SCF calculation.'}) spec.expose_inputs(PwBaseWorkChain, namespace='nscf', exclude=('clean_workdir', 'pw.structure'), namespace_options={'help': 'Inputs for the `PwBaseWorkChain` for the NSCF calculation.'}) spec.expose_inputs(Pw2gwCalc, namespace='pw2gw', exclude=('parent_folder', ), namespace_options={'help': 'Inputs for the `DosCalculation` for the DOS calculation.'}) spec.input('parent_folder', valid_type=orm.RemoteData, required=False) spec.input('structure', valid_type=orm.StructureData, help='The inputs structure.') # spec.input('kpoints_distance', valid_type=orm.Float, required=False, # help='The minimum desired distance in 1/Å between k-points in reciprocal space. The explicit k-points will ' # 'be generated automatically by a calculation function based on the input structure.') spec.input('nbands_factor', valid_type=orm.Float, default=lambda: orm.Float(1.5), help='The number of bands for the BANDS calculation is that used for the SCF multiplied by this factor.') spec.input('clean_workdir', valid_type=orm.Bool, default=lambda: orm.Bool(False), help='If `True`, work directories of all called calculation will be cleaned at the end of execution.') spec.outline( cls.setup, if_(cls.should_do_scf)( cls.run_scf, cls.inspect_scf, ), cls.run_nscf, cls.inspect_nscf, cls.run_pw2gw, cls.inspect_pw2gw, cls.results, ) spec.exit_code(201, 'ERROR_INVALID_INPUT_NUMBER_OF_BANDS', message='Cannot specify both `nbands_factor` and `bands.pw.parameters.SYSTEM.nbnd`.') spec.exit_code(202, 'ERROR_INVALID_INPUT_KPOINTS', message='Cannot specify both `bands_kpoints` and `bands_kpoints_distance`.') spec.exit_code(401, 'ERROR_SUB_PROCESS_FAILED_RELAX', message='The PwRelaxWorkChain sub process failed') spec.exit_code(402, 'ERROR_SUB_PROCESS_FAILED_SCF', message='The scf PwBasexWorkChain sub process failed') spec.exit_code(403, 'ERROR_SUB_PROCESS_FAILED_NSCF', message='The bands PwBasexWorkChain sub process failed') spec.exit_code(405, 'ERROR_SUB_PROCESS_FAILED_PW2GW', message='The pw2gw Pw2gwCalculation sub process failed') spec.output('scf_remote_folder', valid_type=orm.RemoteData, required=False) spec.output('nscf_remote_folder', valid_type=orm.RemoteData) spec.output('scf_parameters', valid_type=orm.Dict, required=False, help='The output parameters of the SCF `PwBaseWorkChain`.') spec.output('nscf_parameters', valid_type=orm.Dict, help='The output parameters of the NSCF `PwBaseWorkChain`.') spec.output('pw2gw_parameters', valid_type=orm.Dict, help='The output parameters of the PW2GW calculation.') spec.output('eps', valid_type=orm.ArrayData)
def define(cls, spec): super().define(spec) spec.expose_inputs(FleurScfWorkChain, namespace='scf') spec.input('wf_parameters', valid_type=Dict, required=False) spec.input('fleur', valid_type=Code, required=True) spec.input('remote', valid_type=RemoteData, required=False) spec.input('fleurinp', valid_type=FleurinpData, required=False) spec.input('options', valid_type=Dict, required=False) spec.outline(cls.start, if_(cls.scf_needed)( cls.converge_scf, cls.force_after_scf, ).else_( cls.force_wo_scf, ), cls.get_results, cls.return_results) spec.output('out', valid_type=Dict) # exit codes spec.exit_code(230, 'ERROR_INVALID_INPUT_PARAM', message='Invalid workchain parameters.') spec.exit_code(231, 'ERROR_INVALID_INPUT_CONFIG', message='Invalid input configuration.') spec.exit_code(233, 'ERROR_INVALID_CODE_PROVIDED', message='Invalid code node specified, check inpgen and fleur code nodes.') spec.exit_code(235, 'ERROR_CHANGING_FLEURINPUT_FAILED', message='Input file modification failed.') spec.exit_code(236, 'ERROR_INVALID_INPUT_FILE', message="Input file was corrupted after user's modifications.") spec.exit_code(334, 'ERROR_REFERENCE_CALCULATION_FAILED', message='Reference calculation failed.') spec.exit_code(335, 'ERROR_REFERENCE_CALCULATION_NOREMOTE', message='Found no reference calculation remote repository.') spec.exit_code(336, 'ERROR_FORCE_THEOREM_FAILED', message='Force theorem calculation failed.')
def define(cls, spec): """Workfunction definition """ super(QE_relax, cls).define(spec) spec.expose_inputs(PwBaseWorkChain, namespace='base', namespace_options={'required': True},\ exclude= ['pw.structure',]) spec.input("initial_structure", valid_type=StructureData, required=True, \ help = 'initial structure') #many possibilities, also to define by hand the fitting functions. spec.input("conv_options", valid_type=Dict, required=True, \ help = 'options for the relaxation: a vc-relax with ecutwfc conv or step by step relaxation') #many possibilities, also to define by hand the fitting functions. ##################################### OUTLINE #################################### spec.outline(cls.start_workflow, while_(cls.has_to_continue)( cls.next_step, cls.conv_eval, ), if_(cls.can_do_scf)( cls.do_final_scf), cls.report_wf, ) ################################################################################## spec.output('path', valid_type = List, help='list with convergence path') spec.output('relaxed_scf', valid_type = Int, help='the final structure')
def define(cls, spec): super().define(spec) # spec.expose_inputs(FleurScfWorkChain, namespace='scf') spec.input('wf_parameters', valid_type=Dict, required=False) spec.input('fleur', valid_type=Code, required=True) spec.input('remote', valid_type=RemoteData, required=True) spec.input('fleurinp', valid_type=FleurinpData, required=False) spec.input('options', valid_type=Dict, required=False) spec.outline( cls.start, if_(cls.scf_needed)( cls.converge_scf, cls.create_new_fleurinp, cls.run_fleur, ).else_( cls.create_new_fleurinp, cls.run_fleur, ), cls.return_results) spec.output('output_banddos_wc_para', valid_type=Dict) spec.exit_code(233, 'ERROR_INVALID_CODE_PROVIDED', message='Invalid code node specified, check inpgen and fleur code nodes.') spec.exit_code(231, 'ERROR_INVALID_INPUT_CONFIG', message='Invalid input configuration.')
def define(cls, spec): super().define(spec) spec.input('success', valid_type=Bool) spec.input('through_return', valid_type=Bool, default=lambda: Bool(False)) spec.input('through_exit_code', valid_type=Bool, default=lambda: Bool(False)) spec.exit_code(cls.EXIT_STATUS, 'EXIT_STATUS', cls.EXIT_MESSAGE) spec.outline(if_(cls.should_return_out_of_outline)(return_(cls.EXIT_STATUS)), cls.failure, cls.success) spec.output(cls.OUTPUT_LABEL, required=False)
def define(cls, spec): super().define(spec) spec.expose_inputs(ZeoppCalculation, namespace='zeopp', include=['code', 'metadata']) spec.expose_inputs(RaspaBaseWorkChain, namespace='raspa_base', exclude=['raspa.structure', 'raspa.parameters']) spec.input('structure', valid_type=CifData, help='Adsorbent framework CIF.') spec.input("molecule", valid_type=(Str, Dict), help='Adsorbate molecule: settings to be read from the yaml.' + 'Advanced: input a Dict for non-standard settings.') spec.input("parameters", valid_type=Dict, help='Parameters for the Isotherm workchain: will be merged with IsothermParameters_defaults.') spec.input("geometric", valid_type=Dict, required=False, help='[Only used by IsothermMultiTempWorkChain] Already computed geometric properties') spec.outline( cls.setup, cls.run_zeopp, # computes volpo and blocks if_(cls.should_run_widom)( # run Widom only if porous cls.run_raspa_widom, # run raspa widom calculation if_(cls.should_run_gcmc)( # Kh is high enough cls.init_raspa_gcmc, # initializate setting for GCMC while_(cls.should_run_another_gcmc)( # new pressure cls.run_raspa_gcmc, # run raspa GCMC calculation ), ), ), cls.return_output_parameters, ) spec.expose_outputs(ZeoppCalculation, include=['block']) #only if porous spec.output( 'output_parameters', valid_type=Dict, required=True, help='Results of the single temperature wc: keys can vay depending on is_porous and is_kh_enough booleans.')
def define(cls, spec): super(PhonopyWorkChain, cls).define(spec) spec.input('structure', valid_type=StructureData, required=True) spec.input('phonon_settings', valid_type=Dict, required=True) spec.input('displacement_dataset', valid_type=Dict, required=False) spec.input('immigrant_calculation_folders', valid_type=Dict, required=False) spec.input('calculation_nodes', valid_type=Dict, required=False) spec.input('calculator_settings', valid_type=Dict, required=False) spec.input('code_string', valid_type=Str, required=False) spec.input('options', valid_type=Dict, required=False) spec.input('symmetry_tolerance', valid_type=Float, required=False, default=Float(1e-5)) spec.input('dry_run', valid_type=Bool, required=False, default=Bool(False)) spec.input('run_phonopy', valid_type=Bool, required=False, default=Bool(False)) spec.input('remote_phonopy', valid_type=Bool, required=False, default=Bool(False)) spec.outline( cls.initialize_supercell_phonon_calculation, if_(cls.import_calculations)( if_(cls.import_calculations_from_files)( cls.read_force_and_nac_calculations_from_files, ), if_(cls.import_calculations_from_nodes)( cls.read_calculation_data_from_nodes, ), cls.check_imported_supercell_structures, ).else_(cls.run_force_and_nac_calculations, ), if_(cls.dry_run)(cls.postprocess_of_dry_run, ).else_( cls.create_force_sets, if_(cls.is_nac)(cls.create_nac_params), if_(cls.run_phonopy)(if_(cls.remote_phonopy)( cls.run_phonopy_remote, cls.collect_data, ).else_( cls.create_force_constants, cls.run_phonopy_in_workchain, )))) spec.output('force_constants', valid_type=ArrayData, required=False) spec.output('primitive', valid_type=StructureData, required=False) spec.output('supercell', valid_type=StructureData, required=False) spec.output('force_sets', valid_type=ArrayData, required=False) spec.output('nac_params', valid_type=ArrayData, required=False) spec.output('thermal_properties', valid_type=XyData, required=False) spec.output('band_structure', valid_type=BandsData, required=False) spec.output('dos', valid_type=XyData, required=False) spec.output('pdos', valid_type=XyData, required=False) spec.output('phonon_setting_info', valid_type=Dict, required=True)
def define(cls, spec): super().define(spec) spec.input('a', valid_type=Int) spec.outline( cls.setup, while_(cls.not_finished)(if_(cls.if_multiple_of_three_and_five)( cls.report_fizz_buzz).elif_(cls.if_multiple_of_five)( cls.report_buzz).elif_(cls.if_multiple_of_three)( cls.report_fizz).else_(cls.report_number), cls.decrement))
def define(cls, spec): super().define(spec) spec.input( 'structure', valid_type=orm.StructureData, help= 'Structure of the material for which the tight-binding model should be calculated.' ) spec.expose_inputs( Wannier90Calculation, namespace='wannier', exclude=('structure', ) ) spec.input( 'code_tbmodels', valid_type=orm.Code, help='Code that runs the TBmodels CLI.' ) spec.input( 'slice_idx', valid_type=orm.List, required=False, help= 'Indices of the orbitals which are sliced (selected) from the tight-binding model. This can be used to either reduce the number of orbitals, or re-order the orbitals.' ) spec.input( 'symmetries', valid_type=orm.SinglefileData, required=False, help= 'File containing the symmetries which will be applied to the tight-binding model. The file must be in ``symmetry-representation`` HDF5 format.' ) spec.output( 'tb_model', valid_type=orm.SinglefileData, help='The calculated tight-binding model, in TBmodels HDF5 format.' ) spec.outline( cls.run_wannier, cls.parse, if_(cls.has_slice)(cls.slice), if_(cls.has_symmetries)(cls.symmetrize), cls.finalize )
def define(cls, spec): super().define(spec) spec.input('value', default=lambda: Str('A')) spec.input('n', default=lambda: Int(3)) spec.outputs.dynamic = True spec.outline( cls.s1, if_(cls.isA)(cls.s2).elif_(cls.isB)(cls.s3).else_(cls.s4), cls.s5, while_(cls.ltN)(cls.s6), )
def define(cls, spec): super().define(spec) spec.input('value', default=lambda: Str('A')) spec.input('n', default=lambda: Int(3)) spec.outputs.dynamic = True spec.outline( cls.step1, if_(cls.is_a)(cls.step2).elif_(cls.is_b)(cls.step3).else_(cls.step4), # pylint: disable=no-member cls.step5, while_(cls.larger_then_n)(cls.step6,), )
def define(cls, spec): """ Exposing inputs, defining work chain parameters, and defining the workflow logics. """ super(VoronoiEnergyWorkChain, cls).define(spec) # Zeopp spec.expose_inputs(ZeoppCalculation, namespace='zeopp', exclude=['parameters', 'structure']) # PorousMaterialsCalculation spec.expose_inputs(PorousMaterialsCalculation, namespace='porousmaterials', exclude=['structure', 'acc_voronoi_nodes']) # VoronoiEnergyWorkChain specific inputs! spec.input("structure", valid_type=CifData, required=True, help="Input structure in CIF format") spec.input("parameters", valid_type=Dict, required=True, help="Parameters to do the logic in workchain") spec.input( "components", valid_type=Dict, required=False, help="Dictionary of components along with their probe size.") # Workflow spec.outline( cls.setup, cls.run_zeopp_res, if_(cls.should_run_zeopp_visvoro)( cls.run_zeopp_visvoro, cls.inspect_zeopp_visvoro, if_(cls.should_run_pm)(cls.run_pm, ), ), cls.return_results, ) # Dyanmic output! spec.outputs.dynamic = True
def define(cls, spec): """ Defines the outline of the workflow. """ # Take input of the workflow or use defaults defined above super(kkr_dos_wc, cls).define(spec) spec.input("wf_parameters", valid_type=Dict, required=False, default=Dict(dict=cls._wf_default)) spec.input("options", valid_type=Dict, required=False, default=Dict(dict=cls._wf_default)) spec.input("remote_data", valid_type=RemoteData, required=True) spec.input("kkr", valid_type=Code, required=True) # define outputs spec.output("results_wf", valid_type=Dict, required=True) spec.output("dos_data", valid_type=XyData, required=False) spec.output("dos_data_interpol", valid_type=XyData, required=False) # Here the structure of the workflow is defined spec.outline( # initialize workflow cls.start, # validate input if_(cls.validate_input)( # set DOS contour in parameter node cls.set_params_dos, # calculate DOS and interpolate result # TODO: encapsulate get_dos in restarting mechanism (should be a base class of workflows that start calculations) # i.e. use base_restart_calc workchain as parent cls.get_dos), # collect results and store DOS output as ArrayData node (dos, lmdos, dos.interpolate, ...) cls.return_results) # definition of exit code in case something goes wrong in this workflow spec.exit_code(161, 'ERROR_NO_INPUT_REMOTE_DATA', 'No remote_data was provided as Input') spec.exit_code( 162, 'ERROR_KKRCODE_NOT_CORRECT', 'The code you provided for kkr does not use the plugin kkr.kkr') spec.exit_code( 163, 'ERROR_CALC_PARAMETERS_INVALID', 'calc_parameters given are not consistent! Hint: did you give an unknown keyword?' ) spec.exit_code(164, 'ERROR_CALC_PARAMETERS_INCOMPLETE', 'calc_parameters not complete') spec.exit_code(165, 'ERROR_DOS_PARAMS_INVALID', 'dos_params given in wf_params are not valid') spec.exit_code(166, 'ERROR_DOS_CALC_FAILED', 'KKR dos calculation failed')
def define(cls, spec): super().define(spec) spec.expose_inputs(FleurScfWorkChain, namespace_options={ 'required': False, 'populate_defaults': False }, namespace='scf') spec.input('wf_parameters', valid_type=Dict, required=False) spec.input('fleur', valid_type=Code, required=True) spec.input('remote', valid_type=RemoteData, required=False) spec.input('fleurinp', valid_type=FleurinpData, required=False) spec.input('kpoints', valid_type=KpointsData, required=False) spec.input('options', valid_type=Dict, required=False) spec.outline( cls.start, if_(cls.scf_needed)( cls.converge_scf, cls.banddos_after_scf, ).else_(cls.banddos_wo_scf, ), cls.return_results) spec.output('output_banddos_wc_para', valid_type=Dict) spec.output('last_calc_retrieved', valid_type=FolderData) spec.output('output_banddos_wc_bands', valid_type=BandsData, required=False) spec.output('output_banddos_wc_dos', valid_type=XyData, required=False) spec.exit_code(230, 'ERROR_INVALID_INPUT_PARAM', message='Invalid workchain parameters.') spec.exit_code(231, 'ERROR_INVALID_INPUT_CONFIG', message='Invalid input configuration.') spec.exit_code( 233, 'ERROR_INVALID_CODE_PROVIDED', message= 'Invalid code node specified, check inpgen and fleur code nodes.') spec.exit_code(235, 'ERROR_CHANGING_FLEURINPUT_FAILED', message='Input file modification failed.') spec.exit_code( 236, 'ERROR_INVALID_INPUT_FILE', message="Input file was corrupted after user's modifications.") spec.exit_code(334, 'ERROR_SCF_CALCULATION_FAILED', message='SCF calculation failed.') spec.exit_code(335, 'ERROR_SCF_CALCULATION_NOREMOTE', message='Found no SCF calculation remote repository.')
def define(cls, spec): # yapf: disable super(CifCleanWorkChain, cls).define(spec) spec.expose_inputs(CifFilterCalculation, namespace='cif_filter', exclude=('cif',)) spec.expose_inputs(CifSelectCalculation, namespace='cif_select', exclude=('cif',)) spec.input('cif', valid_type=orm.CifData, help='The CifData node that is to be cleaned.') spec.input('parse_engine', valid_type=orm.Str, default=orm.Str('pymatgen'), help='The atomic structure engine to parse the cif and create the structure.') spec.input('symprec', valid_type=orm.Float, default=orm.Float(5E-3), help='The symmetry precision used by SeeKpath for crystal symmetry refinement.') spec.input('site_tolerance', valid_type=orm.Float, default=orm.Float(5E-4), help='The fractional coordinate distance tolerance for finding overlapping sites (pymatgen only).') spec.input('group_cif', valid_type=orm.Group, required=False, non_db=True, help='An optional Group to which the final cleaned CifData node will be added.') spec.input('group_structure', valid_type=orm.Group, required=False, non_db=True, help='An optional Group to which the final reduced StructureData node will be added.') spec.outline( cls.run_filter_calculation, cls.inspect_filter_calculation, cls.run_select_calculation, cls.inspect_select_calculation, if_(cls.should_parse_cif_structure)( cls.parse_cif_structure, ), cls.results, ) spec.output('cif', valid_type=orm.CifData, help='The cleaned CifData node.') spec.output('structure', valid_type=orm.StructureData, required=False, help='The primitive cell structure created with SeeKpath from the cleaned CifData.') spec.exit_code(401, 'ERROR_CIF_FILTER_FAILED', message='The CifFilterCalculation step failed.') spec.exit_code(402, 'ERROR_CIF_SELECT_FAILED', message='The CifSelectCalculation step failed.') spec.exit_code(410, 'ERROR_CIF_HAS_UNKNOWN_SPECIES', message='The cleaned CifData contains sites with unknown species.') spec.exit_code(411, 'ERROR_CIF_HAS_UNDEFINED_ATOMIC_SITES', message='The cleaned CifData defines no atomic sites.') spec.exit_code(412, 'ERROR_CIF_HAS_ATTACHED_HYDROGENS', message='The cleaned CifData defines sites with attached hydrogens with incomplete positional data.') spec.exit_code(413, 'ERROR_CIF_HAS_INVALID_OCCUPANCIES', message='The cleaned CifData defines sites with invalid atomic occupancies.') spec.exit_code(414, 'ERROR_CIF_STRUCTURE_PARSING_FAILED', message='Failed to parse a StructureData from the cleaned CifData.') spec.exit_code(420, 'ERROR_SEEKPATH_SYMMETRY_DETECTION_FAILED', message='SeeKpath failed to determine the primitive structure.') spec.exit_code(421, 'ERROR_SEEKPATH_INCONSISTENT_SYMMETRY', message='SeeKpath detected inconsistent symmetry operations.')
def define(cls, spec): super(MPDSCrystalWorkchain, cls).define(spec) # define code inputs spec.input('crystal_code', valid_type=Code, required=True) spec.input('properties_code', valid_type=Code, required=False) # MPDS phase id spec.input('mpds_query', valid_type=get_data_class('dict'), required=True) # Add direct structures submitting support: FIXME spec.input('struct_in', valid_type=get_data_class('structure'), required=False) # Basis set spec.expose_inputs(BaseCrystalWorkChain, include=['basis_family']) # Parameters (include OPTGEOM, FREQCALC and ELASTCON) spec.input('crystal_parameters', valid_type=get_data_class('dict'), required=True) spec.input('properties_parameters', valid_type=get_data_class('dict'), required=False) spec.input('options', valid_type=get_data_class('dict'), required=True, help="Calculation options") # define workchain routine spec.outline(cls.init_inputs, cls.validate_inputs, cls.optimize_geometry, if_(cls.needs_phonons)( cls.calculate_phonons), cls.calculate_elastic_constants, # correctly finalized if_(cls.correctly_finalized("elastic_constants"))( cls.print_exit_status), if_(cls.needs_properties_run)( cls.run_properties_calc), cls.retrieve_results) # define outputs spec.output('phonons_parameters', valid_type=get_data_class('dict'), required=False) spec.output('elastic_parameters', valid_type=get_data_class('dict'), required=False) spec.expose_outputs(BaseCrystalWorkChain) spec.expose_outputs(BasePropertiesWorkChain)
def define(cls, spec): super(PolishWorkChain, cls).define(spec) spec.expose_inputs(ArithmeticAddCalculation, namespace='add') spec.input('z', valid_type=Int) spec.output('sum', valid_type=Int) spec.outline( cls.setup, cls.arithmetic_add, while_(cls.should_iterate)( if_(cls.should_run)(cls.add, ), cls.update_iteration, ), )
def define(cls, spec): super().define(spec) spec.expose_inputs(TightBindingCalculation) spec.expose_inputs(ModelEvaluationBase, exclude=['tb_model']) spec.input_namespace( 'model_evaluation', dynamic=True, help= 'Inputs that will be passed to the ``model_evaluation_workflow``.') spec.input( 'window', valid_type=orm.List, help= 'Disentaglement energy windows used by Wannier90, given as a list ``[dis_win_min, dis_froz_min, dis_froz_max, dis_win_max]``.' ) spec.input( 'wannier_bands', valid_type=orm.BandsData, help= "Parsed band structure from the ``*.eig`` file, used to determine " "if the given energy window is valid. Note that this input is " "assumed to be consistent with the ``*.eig`` file given in " "'wannier.{local,remote}_input_folder'.") spec.input( 'model_evaluation_workflow', help= 'AiiDA workflow that will be used to evaluate the tight-binding model.', **PROCESS_INPUT_KWARGS) spec.expose_outputs(ModelEvaluationBase) spec.outputs.dynamic = True spec.outline( if_(cls.window_valid)(cls.calculate_model, cls.evaluate_bands, cls.finalize), if_(cls.window_invalid)(cls.abort_invalid))
def define(cls, spec): super().define(spec) spec.expose_inputs(PhonopyWorkChain, exclude=['immigrant_calculation_folders', 'calculation_nodes', 'dry_run']) spec.input('max_iteration', valid_type=Int, default=lambda: Int(10)) spec.input('number_of_snapshots', valid_type=Int, default=lambda: Int(100)) spec.input('number_of_steps_for_fitting', valid_type=Int, default=lambda: Int(4)) spec.input('temperature', valid_type=Float, default=lambda: Float(300.0)) spec.input('include_ratio', valid_type=Float, default=lambda: Float(1)) spec.input('linear_decay', valid_type=Bool, default=lambda: Bool(False)) spec.input('random_seed', valid_type=Int, required=False) spec.input('initial_nodes', valid_type=Dict, required=False) spec.outline( cls.initialize, if_(cls.import_initial_nodes)( cls.set_initial_nodes, ).else_( cls.run_initial_phonon, ), while_(cls.is_loop_finished)( cls.collect_displacements_and_forces, if_(cls.remote_phonopy)( cls.run_force_constants_calculation_remote, cls.generate_displacements, ).else_( cls.generate_displacements_local, ), cls.run_phonon, ), cls.finalize, )
def define(cls, spec): """Define the process specification.""" # yapf: disable super().define(spec) spec.expose_inputs(PwBaseWorkChain, namespace='base', exclude=('clean_workdir', 'pw.structure', 'pw.parent_folder'), namespace_options={'help': 'Inputs for the `PwBaseWorkChain` for the main relax loop.'}) spec.expose_inputs(PwBaseWorkChain, namespace='base_final_scf', exclude=('clean_workdir', 'pw.structure', 'pw.parent_folder'), namespace_options={'required': False, 'populate_defaults': False, 'help': 'Inputs for the `PwBaseWorkChain` for the final scf.'}) spec.input('structure', valid_type=orm.StructureData, help='The inputs structure.') spec.input('final_scf', valid_type=orm.Bool, default=lambda: orm.Bool(False), validator=validate_final_scf, help='If `True`, a final SCF calculation will be performed on the successfully relaxed structure.') spec.input('relaxation_scheme', valid_type=orm.Str, required=False, validator=validate_relaxation_scheme, help='The relaxation scheme to use: choose either `relax` or `vc-relax` for variable cell relax.') spec.input('relax_type', valid_type=orm.Str, default=lambda: orm.Str(RelaxType.ATOMS_CELL.value), validator=validate_relax_type, help='The relax type to use: should be a value of the enum ``common.types.RelaxType``.') spec.input('meta_convergence', valid_type=orm.Bool, default=lambda: orm.Bool(True), help='If `True` the workchain will perform a meta-convergence on the cell volume.') spec.input('max_meta_convergence_iterations', valid_type=orm.Int, default=lambda: orm.Int(5), help='The maximum number of variable cell relax iterations in the meta convergence cycle.') spec.input('volume_convergence', valid_type=orm.Float, default=lambda: orm.Float(0.01), help='The volume difference threshold between two consecutive meta convergence iterations.') spec.input('clean_workdir', valid_type=orm.Bool, default=lambda: orm.Bool(False), help='If `True`, work directories of all called calculation will be cleaned at the end of execution.') spec.outline( cls.setup, while_(cls.should_run_relax)( cls.run_relax, cls.inspect_relax, ), if_(cls.should_run_final_scf)( cls.run_final_scf, cls.inspect_final_scf, ), cls.results, ) spec.exit_code(401, 'ERROR_SUB_PROCESS_FAILED_RELAX', message='the relax PwBaseWorkChain sub process failed') spec.exit_code(402, 'ERROR_SUB_PROCESS_FAILED_FINAL_SCF', message='the final scf PwBaseWorkChain sub process failed') spec.expose_outputs(PwBaseWorkChain, exclude=('output_structure',)) spec.output('output_structure', valid_type=orm.StructureData, required=False, help='The successfully relaxed structure, unless `relax_type is RelaxType.NONE`.')
def define(cls, spec): super().define(spec) spec.expose_inputs(FleurScfWorkChain, namespace_options={ 'required': False, 'populate_defaults': False }, namespace='scf_no_ldau') spec.input('remote', valid_type=RemoteData, required=False) spec.input('fleurinp', valid_type=FleurinpData, required=False) spec.expose_inputs(FleurScfWorkChain, namespace_options={ 'required': False, 'populate_defaults': False }, exclude=('structure', 'fleurinp', 'remote_data'), namespace='scf_with_ldau') spec.input('fleur', valid_type=Code, required=True) spec.input('wf_parameters', valid_type=Dict, required=False) spec.input('options', valid_type=Dict, required=False) spec.input('settings', valid_type=Dict, required=False) spec.outline(cls.start, cls.validate_input, if_(cls.scf_no_ldau_needed)(cls.converge_scf_no_ldau), cls.create_configurations, cls.run_fleur_fixed, cls.converge_scf, cls.return_results) spec.output('output_orbcontrol_wc_para', valid_type=Dict) spec.output('output_orbcontrol_wc_gs_scf', valid_type=Dict) spec.output('output_orbcontrol_wc_gs_fleurinp', valid_type=FleurinpData) spec.exit_code(230, 'ERROR_INVALID_INPUT_PARAM', message='Invalid workchain parameters.') spec.exit_code(231, 'ERROR_INVALID_INPUT_CONFIG', message='Invalid input configuration.') spec.exit_code(233, 'ERROR_INVALID_CODE_PROVIDED', message='Input codes do not correspond to fleur or inpgen respectively.') spec.exit_code(235, 'ERROR_CHANGING_FLEURINPUT_FAILED', message='Input file modification failed.') spec.exit_code(236, 'ERROR_INVALID_INPUT_FILE', message="Input file was corrupted after user's modifications.") spec.exit_code(342, 'ERROR_SOME_CONFIGS_FAILED', message='Convergence LDA+U calculation failed for some Initial configurations.') spec.exit_code(343, 'ERROR_ALL_CONFIGS_FAILED', message='Convergence LDA+U calculation failed for all Initial configurations.') spec.exit_code(450, 'ERROR_SCF_NOLDAU_FAILED', message='Convergence workflow without LDA+U failed.')
def define(cls, spec): # yapf: disable super(PwBandsWorkChain, cls).define(spec) spec.expose_inputs(PwRelaxWorkChain, namespace='relax', exclude=('clean_workdir', 'structure'), namespace_options={'required': False, 'populate_defaults': False, 'help': 'Inputs for the `PwRelaxWorkChain`, if not specified at all, the relaxation step is skipped.'}) spec.expose_inputs(PwBaseWorkChain, namespace='scf', exclude=('clean_workdir', 'pw.structure'), namespace_options={'help': 'Inputs for the `PwBaseWorkChain` for the SCF calculation.'}) spec.expose_inputs(PwBaseWorkChain, namespace='bands', exclude=('clean_workdir', 'pw.structure'), namespace_options={'help': 'Inputs for the `PwBaseWorkChain` for the BANDS calculation.'}) spec.input('structure', valid_type=orm.StructureData, help='The inputs structure.') spec.input('clean_workdir', valid_type=orm.Bool, default=orm.Bool(False), help='If `True`, work directories of all called calculation will be cleaned at the end of execution.') spec.input('nbands_factor', valid_type=orm.Float, default=orm.Float(1.2), help='The number of bands for the BANDS calculation is that used for the SCF multiplied by this factor.') spec.outline( cls.setup, if_(cls.should_do_relax)( cls.run_relax, cls.inspect_relax, ), cls.run_seekpath, cls.run_scf, cls.inspect_scf, cls.run_bands, cls.inspect_bands, cls.results, ) spec.exit_code(401, 'ERROR_SUB_PROCESS_FAILED_RELAX', message='the PwRelaxWorkChain sub process failed') spec.exit_code(402, 'ERROR_SUB_PROCESS_FAILED_SCF', message='the scf PwBasexWorkChain sub process failed') spec.exit_code(403, 'ERROR_SUB_PROCESS_FAILED_BANDS', message='the bands PwBasexWorkChain sub process failed') spec.output('primitive_structure', valid_type=orm.StructureData, help='The normalized and primitivized structure for which the bands are computed.') spec.output('seekpath_parameters', valid_type=orm.Dict, help='The parameters used in the SeeKpath call to normalize the input or relaxed structure.') spec.output('scf_parameters', valid_type=orm.Dict, help='The output parameters of the SCF `PwBaseWorkChain`.') spec.output('band_parameters', valid_type=orm.Dict, help='The output parameters of the BANDS `PwBaseWorkChain`.') spec.output('band_structure', valid_type=orm.BandsData, help='The computed band structure.')