Creating new workflow with vdw

Hello all,

I am currently working on implementing a workflow for 2d materials that is essentially the same as the wf_bandstructure contained in atomate with the POSCAR changed to the one below

#Standard VASP Settings
PREC = Fast
ALGO = Accurate
EDIFF = 1e-06   !
ENCUT = 600 !
NELM = 60   !
NSW = 50    !
MAGMOM = 
#Changing how calculations are done
GGA = OR    ?
LREAL = Auto
LASPH = True    ?
LUSE_VDW = True ?
ISIF = 3
IBRION = 2
ISPIN = 2
AGGAC = 0.000   ?
SIGMA = 0.05
ISMEAR = 1  !
#OUTPUTS
LORBIT = 11
LCHARG = False  ?
LVTOT = False   ?
LAECHG = False  ?
LWAVE = False
LVHAR = True    ?
#OPTIONAL DIPOLE CORRECTION
LDIPOL = True
IDIPOL = 3
DIPOL = 0.5 0.5 0.5

Below is my implementation of the new workflow

class MPRelaxSet2D(DictSet):
“”"
Implementation of VaspInputSet utilizing parameters in the public
Materials Project. Typically, the pseudopotentials chosen contain more
electrons than the MIT parameters, and the k-point grid is ~50% more dense.
The LDAUU parameters are also different due to the different psps used,
which result in different fitted values.
“”"

CONFIG = _load_yaml_config("MPRelaxSet")

def __init__(self, structure, **kwargs):
    """
    :param structure: Structure
    :param kwargs: Same as those supported by DictSet.
    """
    incar = _read_user_incar('Relax2D.txt')
    super().__init__(structure, MPRelaxSet2D.CONFIG, user_incar_settings=incar, **kwargs)
    self.kwargs = kwargs

def wf_bandstructure2D(structure, c=None):

c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
vdw_kernel = c.get("VDW_KERNEL_DIR", VDW_KERNEL_DIR)

mpr2d = MPRelaxSet2D(structure, force_gamma=True)
'''check bandstructure.yaml'''
wf = get_wf(structure, "bandstructure.yaml", vis=MPRelaxSet2D(structure, force_gamma=True), \
            params=[{'vasp_input_set': mpr2d},{},{},{}], common_params={"vasp_cmd": vasp_cmd, "db_file": db_file,}) #"vdw_kernel_dir": vdw_kernel})

wf = add_common_powerups(wf, c)

if c.get("SMALLGAP_KPOINT_MULTIPLY", SMALLGAP_KPOINT_MULTIPLY):
    wf = add_small_gap_multiply(wf, 0.5, 5, "static")
    wf = add_small_gap_multiply(wf, 0.5, 5, "nscf")

if c.get("STABILITY_CHECK", STABILITY_CHECK):
    wf = add_stability_check(wf, fw_name_constraint="structure optimization")

if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
    wf = add_wf_metadata(wf, structure)

return wf

The issue arises from the (LUSE_VDW = True) tag. I can not seem to get atomate to know to copy the vdw_kernel.bindat to the calculation directory even with vdw_kernel_dir defined in the config files. any suggestions on how to remedy this? Also is the above implementation the proper way to define a new workflow with atomate?

Best,

Jason Gibson

Hi Jason,

I think the issue here is indeed that the vdw_kernel.bindat is not copied. The band structure workflow starts with an atomate.vasp.fireworks.core.OptimizeFW Firework. In ScanOptimizeFW (which is newer than the OptimizeFW I think), we have the lines:

# Copy the pre-compiled VdW kernel for VASP, if required
if orig_input_set.vdw is not None:
    t.append(CopyFiles(from_dir=vdw_kernel_dir))

those are missing in OptimizeFW and also StaticFW, which follows directly after the OptimizeFW in the bandstructure WF. I guess it is quite easy to copy this lines to those Fireworks, which are all in the same module. The only thing to change is the name for the original input set in the class, which is vasp_input_set and not orig_input_set for both the OptimizeFW and StaticFW. If you put them somewhere before

t.append(RunVaspCustodian(...

it should work I think.

Maybe someone on the development team can weigh in here and tell us if we should do a pull request or something to get this working?

Cheers, Michael

Hi again,

I am in the process of developing workflows complex workflows using atomate for fireworks and subworkflows. At the moment new people are coming in to the project and I updated the documentation for my work and also simplified the installation process of my packages to get the new people up to speed quickly.

However, my workflows depend on the functionality in atomate.vasp.fireworks.core.OptimizeFW and atomate.vasp.fireworks.core.StaticFW discussed above if vdW should be used. When working on my own I just added the code to copy the kernel, but this gets old really quickly if a lot of people want to use the package.

Maybe this could be added to atomate officially? Maybe @alex, or @mkhorton can take a look?

I am also happy to discuss this on the github page, but I am not sure if this is a bug or one is just supposed to copy the kernel in a separate FireTask?

Thanks a lot, Michael

Hi Michael,

Thanks for this suggestion. This is definitely something that would be useful. I’ll have a look at implementing this as a powerup.

Best,
Alex

Hi @JasonGibsonUfl, I would second @mwo suggestion to look at the ScanOptimizeFW code for guidance for now. Also make sure you set the vdw_kernel_dir variable in your FWorker (it sounds like you did that already).

As noted, the ScanOptimizeFW is newer than the older OptimizeFW and StaticFW, and we’ll investigate the best way to make this functionality more widely available throughout atomate.

Thanks @rkingsbury for getting involved. Indeed I have set vdw_kernel_dir, and I also modified the code in atomate.vasp.fireworks.core as detailed in my post from September 1., so in my current setup it works just fine. However, changing the code manually after every new installation or update of atomate is not really convenient, thus my suggestion.

@alex, I guess a powerup would also work, but I am not sure if it would be ideal. I am not familiar with the detailed design philosophy of atomate, but if I pass a vasp_input_set with vdw not equal to None, I would expect the calculation to work with vdw without having to wait for the kernel to be computed.

I realize that for this to work the vdw_kernel_dir variable would be have to be set, but one could maybe think about a runtimewarning when it is not. (This is probably not as simple as adding vdw_kernel_dir=VDW_KERNEL_DIR, to def __init__ of OptimizeFW and StaticFW and then adding

# Copy the pre-compiled VdW kernel for VASP, if required
if orig_input_set.vdw is not None:
    t.append(CopyFiles(from_dir=vdw_kernel_dir))

before the RunVaspCustodian Firetask is added.)

However, one could easily change the tutorial at this point to include setting vdw_kernel_dir.

Thanks again to all of you for being so helpful. This forum really improves working with atomate a lot!
Cheers, Michael