Skip to content

Instantly share code, notes, and snippets.

@computron
Created November 9, 2014 06:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save computron/051eeb8c75e3e0c5b7d0 to your computer and use it in GitHub Desktop.
Save computron/051eeb8c75e3e0c5b7d0 to your computer and use it in GitHub Desktop.
basic demo of using the fireworks-vasp codebase
from fireworks import Firework
from fireworks.core.firework import Workflow
from fireworks_vasp.tasks import WriteVaspInputTask, VaspCustodianTask, VaspAnalyzeTask
from pymatgen.matproj.rest import MPRester
"""
This demo shows how one can use the fireworks-vasp codebase. It runs only a single VASP job.
To run multiple VASP jobs in a workflow, one needs to pass the directory information between
jobs such that input files can be copied.
"""
def get_wf_from_structure(structure, viset='MPVaspInputSet', params={}, handlers="all", vasp_cmd="vasp"):
name = structure.formula
wf_name = name
t1 = WriteVaspInputTask(structure=structure, vasp_input_set=viset, input_set_params=params)
t2 = VaspCustodianTask(vasp_cmd=vasp_cmd, handlers=handlers)
t3 = VaspAnalyzeTask()
return Workflow.from_FireWork(Firework([t1, t2, t3], name=name), name=wf_name)
if __name__ == '__main__':
structure = MPRester().get_structures('mp-19017')[0]
wf = get_wf_from_structure(structure)
print wf.to_format('json')
@georgeyumnam
Copy link

Hello @computron

This demo version seems to use a deprecated version of fireworks. Certain fixes required with the newer version of Fireworks.

Especially, Workflow.from_FireWork

Thanks

@MilMou
Copy link

MilMou commented Dec 6, 2018

how can i install these please:
from fireworks.core.firework import Workflow from fireworks_vasp.tasks import WriteVaspInputTask, VaspCustodianTask, VaspAnalyzeTask from pymatgen.matproj.rest import MPRester
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment