Unable to update custom Incar parameters using config_dict!

Hello ,

first off ,thanks for creating atomate …I would like to use MITRelaxSet and wanted to modify Incar parameters ISPIN to 3 and add KPAR = 1…i have used the following code…

from fireworks import Workflow
from atomate.vasp.fireworks.core import OptimizeFW
from pymatgen.io.vasp.sets import MITRelaxSet
from pymatgen import Structure
from fireworks import LaunchPad

def get_optimize_wf(structure, name="optimization wf", vasp_input_set=None,
                    tag="", metadata=None):

    # Structure optimization firework
    fws = [OptimizeFW(structure=structure, vasp_input_set = vasp_input_set,
                      name="{} structure optimization".format(tag))]

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

    return Workflow(fws, name=wfname, metadata=metadata)


#load your structure, e.g. from a POSCAR
struct = Structure.from_file('POSCAR')

# create a custom input set
my_custom_input_set = MITRelaxSet(struct)



print('Before change: {}'.format(my_custom_input_set._config_dict["INCAR"]))



my_custom_input_set._config_dict["INCAR"].update({"ISPIN":3,"KPAR":1})

print('After change: {}'.format(my_custom_input_set._config_dict["INCAR"]))


# create the workflow
my_wf = get_optimize_wf(struct, vasp_input_set = my_custom_input_set)

lpad = LaunchPad.auto_load() # loads this based on the FireWorks configuration
lpad.add_wf(my_wf)

I could successfully print the applied incar parameters …but unable to actually pass those parameters in the calculation…It is still using the predefined incar…and i don’t know whether i’ve written the correct code …so please check and I am unable to properly paste the code here so correct indentations before copying the code and trying it out.

P.S : I have successfully run the calculations using user_incar_settings …but i wanted to try this way using config_dict …help is much appreciated

Hi Ram,

Changing the private _config_dict attribute is not a recommended way of customising an input set. Instead you should use the user_incar_settings option of the underlying DictSet object. For example, your code could be rewritten:

from fireworks import Workflow
from atomate.vasp.fireworks.core import OptimizeFW
from pymatgen.io.vasp.sets import MITRelaxSet
from pymatgen import Structure
from fireworks import LaunchPad

def get_optimize_wf(structure, name="optimization wf", vasp_input_set=None,
                    tag="", metadata=None):

    # Structure optimization firework
    fws = [OptimizeFW(structure=structure, vasp_input_set = vasp_input_set,
                      name="{} structure optimization".format(tag))]

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

    return Workflow(fws, name=wfname, metadata=metadata)

#load your structure, e.g. from a POSCAR
struct = Structure.from_file('POSCAR')

# create a custom input set
custom_incar_settings = {"ISPIN":3, "KPAR":1}
my_custom_input_set = MITRelaxSet(struct, user_incar_settings=custom_incar_settings)

# create the workflow
my_wf = get_optimize_wf(struct, vasp_input_set = my_custom_input_set)

lpad = LaunchPad.auto_load() # loads this based on the FireWorks configuration
lpad.add_wf(my_wf)

You can find more documentation here:

https://pymatgen.org/pymatgen.io.vasp.sets.html?highlight=dictset#pymatgen.io.vasp.sets.DictSet

Hope that helps.

Best,
Alex