How to use the fireworks.Workflow function in FireWorks

To help you get started, we’ve selected a few FireWorks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hackingmaterials / atomate / atomate / vasp / workflows / base / defects.py View on Github external
t = []
    if parents:
        t.append(CopyVaspOutputs(calc_loc= True ))

    t.append(DefectSetupFiretask(structure=prim_structure, cellmax=n_max, conventional=conventional,
                                 vasp_cmd=vasp_cmd, db_file=db_file, user_incar_settings=user_incar_settings,
                                 user_kpoints_settings=user_kpoints_settings,
                                 vacancies=vacancies, substitutions=substitutions,
                                 interstitials=interstitials, initial_charges=initial_charges))

    fw_name = "{} Defect Supercell Setup".format(structure.composition.reduced_formula)
    setup_fw = Firework(t,parents = parents, name=fw_name)
    fws.append(setup_fw)

    wfname = "{}:{}".format(structure.composition.reduced_formula, name)
    final_wf = Workflow(fws, name=wfname)

    return final_wf
github materialsproject / mpmorph / mpmorph / firetasks / mdtasks.py View on Github external
"optional_fw_params": optional_params, "tag_id": tag_id}
                fw = powerups.add_rescale_volume(fw, **rescale_args)
                fw = powerups.add_pass_pv(fw)
                fw = powerups.add_converge_task(fw, **_spawner_args)
                wf = Workflow([fw])
                return FWAction(detours=wf, stored_data={'pressure': pressure, 'energy': mu})
            else:
                fw = MDFW(structure, name=f'energy_run_{energy_spawn_count + 1}_{tag_id}', previous_structure=False,
                          **run_specs, **md_params, **optional_params)
                converge_params["energy_spawn_count"] += 1
                _spawner_args = {"converge_params": converge_params, "rescale_params": rescale_params,
                                 "run_specs": run_specs, "md_params": md_params,
                                 "optional_fw_params": optional_params, "tag_id": tag_id}
                fw = powerups.add_pass_pv(fw)
                fw = powerups.add_converge_task(fw, **_spawner_args)
                wf = Workflow([fw])
                return FWAction(detours=wf, stored_data={'pressure': pressure, 'energy': mu})
        else:
            return FWAction(stored_data={'pressure': pressure,
                                         'energy': mu,
                                         'density_calculated': True})
github henniggroup / MPInterfaces / examples / workflows / slab_workflow.py View on Github external
fw_calibrate = Firework([caltask],
                             name="relaxation",
                             fw_id = wf_id)
    #firework2 = [msrtask]
    msrtask['fw_id'] = wf_id+1    
    fw_measure = Firework([msrtask],
                            name="static",
                            fw_id = wf_id+1 )
    #firework3 = [solmsrtask]
    solmsrtask['fw_id'] = wf_id+2    
    fw_solmeasure = Firework([solmsrtask],
                            name="solvation",
                            fw_id = wf_id+2 )
    #workflow = [firework1, firework2, firework3]
    #firework2 is linked to firework1
    return Workflow(
        [fw_calibrate, fw_measure, fw_solmeasure],
        links_dict = {
            fw_calibrate.fw_id:[fw_measure.fw_id],
            fw_measure.fw_id:[fw_solmeasure.fw_id] } ,
        name=name )
github SUNCAT-Center / CatKit / catkit / flow / laminar.py View on Github external
func='catkit.flow.fwio.encode_to_atoms',
            args=[encoding])

        t1 = fireworks.PyTask(
            func='catkit.flow.fwase.get_potential_energy',
            args=[calculator],
            stored_data_varname='trajectory')
        tasks = [t0, t1]

        if spec is None:
            spec = {'keys': keys, 'data': data}
        else:
            spec.update({'keys': keys, 'data': data})

        firework = fireworks.Firework(tasks, spec=spec)
        workflow = fireworks.Workflow([firework], name=workflow_name)
        self.launchpad.add_wf(workflow)
github SUNCAT-Center / CatalysisHubBackend / apps / fireworks / __init__.py View on Github external
for i, calculation in enumerate(calculations):
        gas_phase_tasks = create_gas_phase_tasks(calculation)
        bulk_tasks = create_bulk_tasks(calculation)
        slab_tasks = create_slab_tasks(calculation)
        collector_tasks = create_collector_tasks(calculation)

        # declare job dependecy
        task_dependency = {}
        for bulk_task in bulk_tasks:
            task_dependency[bulk_task] = slab_tasks

        for task in gas_phase_tasks + slab_tasks:
            task_dependency[task] = collector_tasks

        workflow = fw.Workflow(bulk_tasks
                               + gas_phase_tasks
                               + slab_tasks
                               + collector_tasks,
                               task_dependency,
                               name='calculation')

        messages.update(launchpad.add_wf(workflow,))
    return flask.jsonify({
        'messages': messages,
    })
github hackingmaterials / atomate / atomate / vasp / workflows / base / bulk_modulus.py View on Github external
tag = tag or "bulk_modulus group: >>{}<<".format(str(uuid4()))

    deformations = [Deformation(defo_mat) for defo_mat in deformations]

    vis_static = vasp_input_set or MPStaticSet(structure=structure, force_gamma=True, lepsilon=False,
                                               user_kpoints_settings=user_kpoints_settings,
                                               user_incar_settings=user_incar_settings)

    wf_bulk_modulus = get_wf_deformations(structure, deformations, name="bulk_modulus deformation",
                                          vasp_input_set=vis_static, vasp_cmd=vasp_cmd,
                                          db_file=db_file, tag=tag)

    fw_analysis = Firework(FitEOSToDb(tag=tag, db_file=db_file, eos=eos), name="fit equation of state")

    wf_bulk_modulus.append_wf(Workflow.from_Firework(fw_analysis), wf_bulk_modulus.leaf_fw_ids)

    wf_bulk_modulus.name = "{}:{}".format(structure.composition.reduced_formula, "Bulk modulus")

    return wf_bulk_modulus
github materialsproject / fireworks / fireworks / examples / custom_firetasks / merge_task / merge_task.py View on Github external
print("This is task C.")
        print("Task A gave me: {}".format(fw_spec["param_A"]))
        print("Task B gave me: {}".format(fw_spec["param_B"]))


if __name__ == "__main__":
    # set up the LaunchPad and reset it
    launchpad = LaunchPad()
    # launchpad.reset('', require_password=False)

    fw_A = Firework([TaskA()])
    fw_B = Firework([TaskB()])
    fw_C = Firework([TaskC()], parents=[fw_A, fw_B])

    # assemble Workflow from FireWorks and their connections by id
    workflow = Workflow([fw_A, fw_B, fw_C])

    # store workflow and launch it locally
    launchpad.add_wf(workflow)
    rapidfire(launchpad)
github hackingmaterials / rocketsled / rocketsled / examples / basic.py View on Github external
3. You use MissionControl's "configure" method to set up the optimization,
        and pass in wf_creator as it's first argument.

    Args:
        x (list): The wf_creator input vector. In this example, it is just 3
            integers between 1 and 5 (inclusive).

    Returns:
        (Workflow): A workflow containing one FireWork (two FireTasks) which
            is automatically set up to run the optimization loop.

    """
    spec = {"_x": x}
    # ObjectiveFuncTask writes _y field to the spec internally.
    firework1 = Firework([ObjectiveFuncTask(), OptTask(**db_info)], spec=spec)
    return Workflow([firework1])
github materialsproject / mpmorph / mpmorph / firetasks / vibtasks.py View on Github external
_struct_dict = ad_struct.as_dict()
            for site in _struct_dict["sites"]:
                if "velocities" in site["properties"].keys():
                    del site["properties"]["velocities"]

            _ad_struct = Structure.from_dict(_struct_dict)
            opt_fws.append(
                OptimizeFW(structure=_ad_struct, name=structure.composition.reduced_formula + "_slab_optimize",
                           **run_specs))
            stat_fw = StaticFW(structure=_ad_struct, name=structure.composition.reduced_formula + "_slab_static",
                               prev_calc_loc=True, **run_specs, parents=[opt_fws[-1]])
            stat_fw.tasks.append(SpawnVibrationalFWTask(run_specs=run_specs))
            stat_fws.append(stat_fw)
        fws = opt_fws
        fws.extend(stat_fws)
        wf = Workflow(fws)

        return FWAction(additions=wf)
github hackingmaterials / atomate / atomate / vasp / workflows / base / magnetism.py View on Github external
input_index=self.input_index,
                perform_bader=perform_bader,
                scan=scan,
                additional_fields=additional_fields,
            ),
            name="Magnetic Orderings Analysis",
            parents=analysis_parents,
            spec={"_allow_fizzled_parents": True},
        )
        fws.append(fw_analysis)

        formula = self.sanitized_structure.composition.reduced_formula
        wf_name = "{} - magnetic orderings".format(formula)
        if scan:
            wf_name += " - SCAN"
        wf = Workflow(fws, name=wf_name)

        wf = add_additional_fields_to_taskdocs(wf, {"wf_meta": self.wf_meta})

        tag = "magnetic_orderings group: >>{}<<".format(self.uuid)
        wf = add_tags(wf, [tag, ordered_structure_origins])

        return wf