Extract Fireworks Workflow from Atomate to VASP files without actually adding it to the launchpad.

Hi all,

If I have a Fireworks workflow from Atomate, is there a way to extract the VASP files this workflow will create and run, and which variable it will look at from the VASP calculations?

For example, if I create the following workflow (wf) using this code:

from pymatgen import Structure, Lattice, MPRester, Molecule
from pymatgen.analysis.adsorption import *
from pymatgen.core.surface import generate_all_slabs
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

import pymatgen as mg
znte_lattice = mg.Lattice.hexagonal(4.373, 10.705)
species = [“Zn”, “Zn”,“Zn”,“Te”,“Te”,“Te”]
coordinates = [[0.3606,0.0212,0.0265], [0.6606,0.6394,0.6932],[0.9788,0.3394,0.3598],
[0.0237,0.353,0.1102],
[0.3293,0.9763,0.7768],[0.647,0.6707,0.4435]]
znte = mg.Structure(znte_lattice,species=species,coords=coordinates)

slabs = generate_all_slabs(znte, max_index=1, min_slab_size=8.0,min_vacuum_size=10.0)

znte_100 = [slab for slab in slabs if slab.miller_index==(1,0,0)][0] #Use first slab with 100 surface

from atomate.vasp.workflows.base import adsorption

co = Molecule(“CO”, [[0, 0, 0], [0, 0, 1.23]])
h = Molecule(“H”, [[0, 0, 0]])
adsorbate_config = {(1,1,1):[co, h],(1,0,0):[co]}

wf = adsorption.get_wf_slab(znte_100,adsorbate_config)

``

Is there a way to see what VASP files “wf” object will create to a specific local directory? I’m pretty new to computational materials, so being able to look into these files would help me learn whats happening behind the hood, and learn VASP/DFT better. I think this would also be useful in general for people who may want to create customized workflows in the future.

Thanks!

I’m going to answer my own question in case anyone is curious - it is possible!

First let me change the code to get a workflow object (turns out I was using an old version of atomate…)

from pymatgen import Structure, MPRester, Molecule

from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

from fireworks import LaunchPad

from atomate.vasp.workflows.base.adsorption import get_wfs_all_slabs

mpr=MPRester()

#typical adsorbates to use for CO2 reduction workflows

CO = Molecule(“CO”, [[0, 0, 0],[0, 0, 1.23]])

list of adsorbates for current run

adsorbates = [CO]

#list of catalysts from materials project to run workflows for

catalysts = “mp-2176”

struct = mpr.get_structure_by_material_id(catalyst)

struct = SpacegroupAnalyzer(struct).get_conventional_standard_structure()

wfs = get_wfs_all_slabs(struct, True, adsorbates, vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<")

``

Then let’s explore one of the workflow object:

wfs[0].fws[0].tasks

``

This returns the tasks for the first Fireworks. In this you see an important line:

'vasp_input_set': MPSurfaceSet

``

This class can be used to write out the input file:

from atomate.vasp.workflows.base.adsorption import MPSurfaceSet

s = MPSurfaceSet(wfs[0].fws[0].tasks[0][“structure”])

s.write_input(output_dir=“test”)

``

This will write the input files in a “test” directory.

The same can be done for other types of workflows!

Now my question is: is there an easy way to check out what values from the VASP calculation atomate checks for a specific workflow?

···

On Thursday, April 25, 2019 at 9:44:51 AM UTC-7, ma…@berkeley.edu wrote:

Hi all,

If I have a Fireworks workflow from Atomate, is there a way to extract the VASP files this workflow will create and run, and which variable it will look at from the VASP calculations?

For example, if I create the following workflow (wf) using this code:

from pymatgen import Structure, Lattice, MPRester, Molecule
from pymatgen.analysis.adsorption import *
from pymatgen.core.surface import generate_all_slabs
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

import pymatgen as mg
znte_lattice = mg.Lattice.hexagonal(4.373, 10.705)
species = [“Zn”, “Zn”,“Zn”,“Te”,“Te”,“Te”]
coordinates = [[0.3606,0.0212,0.0265], [0.6606,0.6394,0.6932],[0.9788,0.3394,0.3598],
[0.0237,0.353,0.1102],
[0.3293,0.9763,0.7768],[0.647,0.6707,0.4435]]
znte = mg.Structure(znte_lattice,species=species,coords=coordinates)

slabs = generate_all_slabs(znte, max_index=1, min_slab_size=8.0,min_vacuum_size=10.0)

znte_100 = [slab for slab in slabs if slab.miller_index==(1,0,0)][0] #Use first slab with 100 surface

from atomate.vasp.workflows.base import adsorption

co = Molecule(“CO”, [[0, 0, 0], [0, 0, 1.23]])
h = Molecule(“H”, [[0, 0, 0]])
adsorbate_config = {(1,1,1):[co, h],(1,0,0):[co]}

wf = adsorption.get_wf_slab(znte_100,adsorbate_config)

``

Is there a way to see what VASP files “wf” object will create to a specific local directory? I’m pretty new to computational materials, so being able to look into these files would help me learn whats happening behind the hood, and learn VASP/DFT better. I think this would also be useful in general for people who may want to create customized workflows in the future.

Thanks!

Hi Martin

You are correct that the VaspInputSet can be used to check what inputs will be written out. Although, keep in mind that some of the Fireworks, particularly ones in the middle of a workflow, use the “from_prev()” method of the Vaspinputset. This method does not exist for MPSurfaceSet but exists for some of the other vasp input sets.

As for checking what values will be parsed in a workflow, the “Drone” code is the one that does that. For each job (Firework), you want to check the FireTask that is something like “VaspToDb”. For example, for the OptimizeFW the drone that is used is:

drone = VaspDrone(additional_fields=self.get(“additional_fields”),

parse_dos=self.get(“parse_dos”, False),

bandstructure_mode=self.get(“bandstructure_mode”, False),

parse_chgcar=self.get(“parse_chgcar”, False),

parse_aeccar=self.get(“parse_aeccar”, False))

Once you have that drone object, you can use:

task_doc = drone.assimilate(calc_dir)

To see the JSON data that results from parsing a particular VASP calculation directory. In some cases, downstream code in the Firetask might add / remove / modify some of this information.

···

On Monday, May 6, 2019 at 11:03:52 AM UTC-7, [email protected] wrote:

I’m going to answer my own question in case anyone is curious - it is possible!

First let me change the code to get a workflow object (turns out I was using an old version of atomate…)

from pymatgen import Structure, MPRester, Molecule

from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

from fireworks import LaunchPad

from atomate.vasp.workflows.base.adsorption import get_wfs_all_slabs

mpr=MPRester()

#typical adsorbates to use for CO2 reduction workflows

CO = Molecule(“CO”, [[0, 0, 0],[0, 0, 1.23]])

list of adsorbates for current run

adsorbates = [CO]

#list of catalysts from materials project to run workflows for

catalysts = “mp-2176”

struct = mpr.get_structure_by_material_id(catalyst)

struct = SpacegroupAnalyzer(struct).get_conventional_standard_structure()

wfs = get_wfs_all_slabs(struct, True, adsorbates, vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<")

``

Then let’s explore one of the workflow object:

wfs[0].fws[0].tasks

``

This returns the tasks for the first Fireworks. In this you see an important line:

'vasp_input_set': MPSurfaceSet

``

This class can be used to write out the input file:

from atomate.vasp.workflows.base.adsorption import MPSurfaceSet

s = MPSurfaceSet(wfs[0].fws[0].tasks[0][“structure”])

s.write_input(output_dir=“test”)

``

This will write the input files in a “test” directory.

The same can be done for other types of workflows!

Now my question is: is there an easy way to check out what values from the VASP calculation atomate checks for a specific workflow?

On Thursday, April 25, 2019 at 9:44:51 AM UTC-7, ma…@berkeley.edu wrote:

Hi all,

If I have a Fireworks workflow from Atomate, is there a way to extract the VASP files this workflow will create and run, and which variable it will look at from the VASP calculations?

For example, if I create the following workflow (wf) using this code:

from pymatgen import Structure, Lattice, MPRester, Molecule
from pymatgen.analysis.adsorption import *
from pymatgen.core.surface import generate_all_slabs
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

import pymatgen as mg
znte_lattice = mg.Lattice.hexagonal(4.373, 10.705)
species = [“Zn”, “Zn”,“Zn”,“Te”,“Te”,“Te”]
coordinates = [[0.3606,0.0212,0.0265], [0.6606,0.6394,0.6932],[0.9788,0.3394,0.3598],
[0.0237,0.353,0.1102],
[0.3293,0.9763,0.7768],[0.647,0.6707,0.4435]]
znte = mg.Structure(znte_lattice,species=species,coords=coordinates)

slabs = generate_all_slabs(znte, max_index=1, min_slab_size=8.0,min_vacuum_size=10.0)

znte_100 = [slab for slab in slabs if slab.miller_index==(1,0,0)][0] #Use first slab with 100 surface

from atomate.vasp.workflows.base import adsorption

co = Molecule(“CO”, [[0, 0, 0], [0, 0, 1.23]])
h = Molecule(“H”, [[0, 0, 0]])
adsorbate_config = {(1,1,1):[co, h],(1,0,0):[co]}

wf = adsorption.get_wf_slab(znte_100,adsorbate_config)

``

Is there a way to see what VASP files “wf” object will create to a specific local directory? I’m pretty new to computational materials, so being able to look into these files would help me learn whats happening behind the hood, and learn VASP/DFT better. I think this would also be useful in general for people who may want to create customized workflows in the future.

Thanks!