Example #1
0
def static(structure_file, functional, directory, write_chgcar, in_custodian,
           number_nodes, launchpad_file, lpad_name):
    """
    Set up an static calculation workflow.
    """
    from pybat.workflow.workflows import get_wf_static

    # Process the input options
    if number_nodes == 0:
        number_nodes = None
    functional = string_to_functional(functional)

    # Set up the calculation directory
    directory = set_up_directory(directory, functional, "static")

    cat = Cathode.from_file(structure_file)

    if launchpad_file:
        lpad = LaunchPad.from_file(launchpad_file)
    else:
        lpad = _load_launchpad(lpad_name)

    lpad.add_wf(
        get_wf_static(structure=cat,
                      functional=functional,
                      directory=directory,
                      write_chgcar=write_chgcar,
                      in_custodian=in_custodian,
                      number_nodes=number_nodes))
Example #2
0
def optimize(structure_file, functional, directory, is_metal, in_custodian,
             number_nodes, launchpad_file, lpad_name):
    """
    Set up a geometry optimization workflow.
    """
    from pybat.workflow.workflows import get_wf_optimize

    cat = Cathode.from_file(structure_file)

    # Process the input options
    if number_nodes == 0:
        number_nodes = None
    functional = string_to_functional(functional)

    # Set up the calculation directory
    directory = set_up_directory(directory, functional, "optimize")

    if launchpad_file:
        lpad = LaunchPad.from_file(launchpad_file)
    else:
        lpad = _load_launchpad(lpad_name)

    lpad.add_wf(
        get_wf_optimize(structure=cat,
                        functional=functional,
                        directory=directory,
                        is_metal=is_metal,
                        in_custodian=in_custodian,
                        number_nodes=number_nodes))
Example #3
0
def _get_launchpad(submission_script='FW_submit.script'):
    '''
    This function assumes that you're in a directory where a "FW_submit.script"
    exists and contains the location of your launchpad.yaml file. It then uses
    this yaml file to instantiate a LaunchPad object for you.

    Arg:
        submission_script   String indicating the path of the job submission
                            script used to launch this firework. It should
                            contain an `rlaunch` command in it.
    Returns:
        lpad    A configured and authenticated `fireworks.LaunchPad` object
    '''
    # Look for the line in the submission script that has `rlaunch`
    with open(submission_script, 'r') as file_handle:
        for line in file_handle.readlines():
            if line.startswith('rlaunch'):
                break

    # The line with `rlaunch` should also have the location of the launchpad
    words = line.split(' ')
    for i, word in enumerate(words):
        if word == '-l':
            lpad_file = words[i + 1]
            break

    # Instantiate the lpad with the yaml and return it
    lpad = LaunchPad.from_file(lpad_file)
    return lpad
Example #4
0
    def setUp(self, lpad=True):
        """
        Create scratch directory(removes the old one if there is one) and change to it.
        Also initialize launchpad.
        """
        if not SETTINGS.get("PMG_VASP_PSP_DIR"):
            SETTINGS["PMG_VASP_PSP_DIR"] = os.path.abspath(
                os.path.join(MODULE_DIR, "..", "vasp", "test_files"))
            print(
                'This system is not set up to run VASP jobs. '
                'Please set PMG_VASP_PSP_DIR variable in your ~/.pmgrc.yaml file.'
            )

        self.scratch_dir = os.path.join(MODULE_DIR, "scratch")
        if os.path.exists(self.scratch_dir):
            shutil.rmtree(self.scratch_dir)
        os.makedirs(self.scratch_dir)
        os.chdir(self.scratch_dir)
        if lpad:
            try:
                self.lp = LaunchPad.from_file(
                    os.path.join(DB_DIR, "my_launchpad.yaml"))
                self.lp.reset("", require_password=False)
            except:
                raise unittest.SkipTest(
                    'Cannot connect to MongoDB! Is the database server running? '
                    'Are the credentials correct?')
Example #5
0
 def __init__(self, *args, **kwargs):
     '''
     :param args:       (VaspFirework objects) objects to create Workflow from.  No limit
                        on the amount of VaspInputInterface objects to be given.  Entered as just
                        comma separated objects passed to class.
     :param deps_dict:  (dict) specifies the dependency of the VaspInputInterface objects given.  
                        If no dependency is given, Firworks are assumed to be 
                        sequentially dependent.
     :param name        (str) Name given to Workflow
     '''
     self.fws = []
     self.name = kwargs.get('name', 'Sequential WF')
     self.deps_dict = kwargs.get('deps_dict', {})
     self.dependency = {}
     if self.deps_dict:
         for i in self.deps_dict.keys():
             fw_deps = []
             for j in self.deps_dict[i]:
                 fw_deps.append(j.Firework)                    
             self.dependency[i.Firework]=fw_deps
     self.deps = True if self.dependency else False
     for id, fw_task in enumerate(args):
         self.fws.append(fw_task.Firework)
         if not self.deps and id != 0:
             self.dependency[self.fws[id-1]]=[fw_task.Firework]
     self.wf = Workflow(self.fws, self.dependency, name=self.name)
     # Try to establish connection with Launchpad
     try:
         self.LaunchPad=LaunchPad.from_file(os.path.join(os.environ["HOME"], ".fireworks", "my_launchpad.yaml"))
     except:
         self.LaunchPad = None
Example #6
0
def dimer(structure_file, dimer_indices, distance, functional, is_metal,
          in_custodian, number_nodes, launchpad_file, lpad_name):
    """
    Set up dimer calculation workflows.
    """
    from pybat.workflow.workflows import get_wf_dimer

    cat = LiRichCathode.from_file(structure_file)

    # Process the input options
    if number_nodes == 0:
        number_nodes = None

    if launchpad_file:
        lpad = LaunchPad.from_file(launchpad_file)
    else:
        lpad = _load_launchpad(lpad_name)

    lpad.add_wf(
        get_wf_dimer(structure=cat,
                     dimer_indices=dimer_indices,
                     distance=distance,
                     functional=string_to_functional(functional),
                     is_metal=is_metal,
                     in_custodian=in_custodian,
                     number_nodes=number_nodes))
Example #7
0
    def __init__(self,vasp_task=None,name='vaspfw',handlers=None, handler_params=None, config_file=None):
        self.name = name
        self.handlers=handlers if handlers else []
        self.handler_params=handler_params if handler_params else {}

        if config_file:
            config_dict = loadfn(config_file)
        elif os.path.exists(os.path.join(os.environ['HOME'], 'vasp_interface_defaults.yaml')):
            config_dict = loadfn(os.path.join(os.environ['HOME'], 'vasp_interface_defaults.yaml'))
        else:
            config_dict = {}

        if config_dict:
            self.custodian_opts = config_dict.get('CUSTODIAN_PARAMS', {})
            if self.custodian_opts.get('handlers', []):
                self.handlers.extend(self.custodian_opts.get('handlers', []))
            self.handler_params.update(self.custodian_opts.get('handler_params', {}))

        self.tasks=[vasp_task.input,RunCustodianTask(handlers=self.handlers, 
                handler_params=self.handler_params)] if isinstance(vasp_task, 
                VaspInputInterface) else [vasp_task]
        self.Firework=Firework(self.tasks,name=self.name)
        # Try to establish connection with Launchpad
        try:
            self.LaunchPad=LaunchPad.from_file(os.path.join(os.environ["HOME"], ".fireworks", "my_launchpad.yaml"))
        except:
            self.LaunchPad = None
Example #8
0
def load_config(config, name="base"):
    """
    Load a LaunchPad, FWorker of QueueAdapter from the configuration files.

    Args:
        config (str): Type of configuration file to load. Either "launchpad", "fworker"
            or "qadapter".
        name (str): Name of the configuration. Defaults to "base".

    Returns:
        Either a LaunchPad, FWorker or QueuAdapter, depending on the "config" argument.

    """
    try:
        if config == "launchpad":
            return LaunchPad.from_file(
                os.path.join(os.path.expanduser("~"), ".workflow_config",
                             "launchpad", name + "_launchpad.yaml"))
        if config == "fworker":
            return FWorker.from_file(
                os.path.join(os.path.expanduser("~"), ".workflow_config",
                             "fworker", name + "_fworker.yaml"))
        if config == "qadapter":
            return CommonAdapter.from_file(
                os.path.join(os.path.expanduser("~"), ".workflow_config",
                             "fworker", name + "_qadapter.yaml"))
    except FileNotFoundError:
        raise FileNotFoundError(
            "Did not find the corresponding configuration file in " +
            os.path.join(os.path.expanduser("~"), ".workflow_config") +
            ". Use 'vsc config " + config + "' to set up the " + name +
            " configuration for the " + config + ".")
Example #9
0
def get_launchpad(launchpad_file=None):
    """
    Returns a LaunchPad object. If the launchpad_file is None, then try to auto load from environment

    Args:
        launchpad_file (File-like): A file-like or file path to the LaunchPad file.

    Returns:
        LaunchPad
    """
    if launchpad_file:
        if isinstance(launchpad_file, file):
            # a file object was found
            ext = launchpad_file.name.split('.')[-1]
            if ext == 'yaml':
                launchpad = LaunchPad.from_format(launchpad_file.read(),
                                                  f_format='yaml')
            else:
                # assume json
                launchpad = LaunchPad.from_format(launchpad_file.read())
        else:
            # assume launchpad_file is a path
            launchpad = LaunchPad.from_file(launchpad_file)
    else:
        launchpad = LaunchPad.auto_load()
    return launchpad
def launch():
    descr  = "Smart rocket launcher."\
        "Uses the execution termination emails send by the batch system to "\
        "launch fireworks that depend on other fireworks i.e fireworks that "\
        "have 'cal_objs' in their spec."\
        "Takes in fw_ids of fireworks to be launched. "\
        "Range specification of fw_ids is also supported."\
        "All the jobs are launched to hipergator remotely using fabric."\
        "Note: Ensure that the submit scripts have the appropriate email settings and "\
        "that the mail daemon is fetching emails to the folder polled by this script."\
        "Note: All rocket launches take place in the home directory. If "\
        "_launch_dir spec is set for the firework the job files will be written to "\
        "that folder and jobs to the batch system will be done from there."
    parser = ArgumentParser(description=descr)
    parser.add_argument('-f', '--fw_ids', help='one or more of fw_ids to run', 
                        default=None, type=int, nargs='+')
    parser.add_argument('-r', '--r_fw_ids', 
                        help='start and end fw_ids of the range of fw_ids to run', 
                        default=None, type=int, nargs=2)
    args = parser.parse_args()
    fw_ids = args.fw_ids
    if args.r_fw_ids is not None:
        fw_ids += range(args.r_fw_ids[0], args.r_fw_ids[1])
    job_ids = None
    lp = LaunchPad.from_file(LAUNCHPAD_LOC)
    print('Firework ids: ',fw_ids)
    if fw_ids is None:
        print('No fw ids given')
        return
    for fid in fw_ids:
        m_fw = lp._get_a_fw_to_run(fw_id=fid, checkout=False)
        if m_fw is None:
            print('No firework with that id')
            return
        fw_spec = dict(m_fw.spec)
        done = []
        if fw_spec.get('cal_objs',None) is not None:
            for calparams in fw_spec['cal_objs']:
                if calparams.get('job_ids', None) is not None:
                    job_ids = calparams.get('job_ids', None)
                    print(fid,' depends on jobs with ids : ',job_ids)
                    if job_ids is not None:
                        for jid in job_ids:
                            done.append(check_done(jid))
                    else:
                        print('job_ids not set')
        else:
            print('This firework doesnt depend on any other fireworks.')
            done.append(True)
        if done and all(done):
            print('Launching ', fid, ' ...')
            with settings(host_string='*****@*****.**'):
                run("ssh dev1 rlaunch singleshot -f "+str(fid))
        else:
            print("Haven't recieved execution termination confirmation for the jobs in the firework from hipergator resource manager")
        time.sleep(3)
    return
Example #11
0
    def no_connection(self):
        """Check for connection to local MongoDB."""

        try:
            lp = LaunchPad.from_file(os.path.join(DB_DIR, "my_launchpad.yaml"))
            lp.reset("", require_password=False)
            return False
        except:
            return True
Example #12
0
 def setUp(self):
     if os.path.exists(self.scratch_dir):
         shutil.rmtree(self.scratch_dir)
     os.makedirs(self.scratch_dir)
     os.chdir(self.scratch_dir)
     try:
         self.lp = LaunchPad.from_file(os.path.join(db_dir, "my_launchpad.yaml"))
         self.lp.reset("", require_password=False)
     except:
         raise unittest.SkipTest(
             'Cannot connect to MongoDB! Is the database server running? '
             'Are the credentials correct?')
Example #13
0
def launchpad(launchpad_file=None, lpad_name="base"):
    """
    Script to set up the configuration of the launchpad for accessing the workflow
    server.

    Args:
        launchpad_file (str): my_launchpad.yaml file from which to load the
            mongoDB database details.
        lpad_name (str): Name to give to the database in the configuration setup.

    Returns:
        None

    """

    if launchpad_file:
        lpad = LaunchPad.from_file(launchpad_file)
    else:
        host = input("Please provide the server host: ")
        port = int(input("Please provide the port number: "))
        name = input("Please provide the server name: ")
        username = input("Please provide your username: "******"Please provide your password: "******"admin")

    # Test the launchpad
    print("\nAttempting connection to mongoDB database...")
    _ = lpad.get_fw_ids()
    print("Connection successful!\n")

    config_lpad_file = os.path.join(os.path.expanduser("~"),
                                    ".workflow_config", "launchpad",
                                    lpad_name + "_launchpad.yaml")
    try:
        os.makedirs(
            os.path.join(os.path.expanduser("~"), ".workflow_config",
                         "launchpad"))
    except FileExistsError:
        pass

    lpad.to_file(config_lpad_file)
    print("Launchpad file written to " + config_lpad_file + "\n")
Example #14
0
def neb(directory, nimages, functional, is_metal, in_custodian, number_nodes,
        launchpad_file, lpad_name):
    """
    Set up dimer calculation workflows.
    """
    from pybat.workflow.workflows import get_wf_neb

    if launchpad_file:
        lpad = LaunchPad.from_file(launchpad_file)
    else:
        lpad = _load_launchpad(lpad_name)

    lpad.add_wf(
        get_wf_neb(directory=directory,
                   nimages=nimages,
                   functional=string_to_functional(functional),
                   is_metal=is_metal,
                   in_custodian=in_custodian,
                   number_nodes=number_nodes))
Example #15
0
def noneq_dimers(structure_file, distance, functional, is_metal, in_custodian,
                 number_nodes, launchpad_file, lpad_name):
    """
    Set up dimer calculations for all nonequivalent dimers in a structure.
    """
    from pybat.workflow.workflows import get_wfs_noneq_dimers

    cat = LiRichCathode.from_file(structure_file)

    if launchpad_file:
        lpad = LaunchPad.from_file(launchpad_file)
    else:
        lpad = _load_launchpad(lpad_name)

    for wf in get_wfs_noneq_dimers(structure=cat,
                                   distance=distance,
                                   functional=string_to_functional(functional),
                                   is_metal=is_metal,
                                   in_custodian=in_custodian,
                                   number_nodes=number_nodes):
        lpad.add_wf(wf)
Example #16
0
    def setUp(self, lpad=True):
        """
        Create scratch directory(removes the old one if there is one) and change to it.
        Also initialize launchpad.
        """
        if not SETTINGS.get("PMG_VASP_PSP_DIR"):
            SETTINGS["PMG_VASP_PSP_DIR"] = os.path.abspath(os.path.join(MODULE_DIR, "..", "vasp", "test_files"))
            print('This system is not set up to run VASP jobs. '
                  'Please set PMG_VASP_PSP_DIR variable in your ~/.pmgrc.yaml file.')

        self.scratch_dir = os.path.join(MODULE_DIR, "scratch")
        if os.path.exists(self.scratch_dir):
            shutil.rmtree(self.scratch_dir)
        os.makedirs(self.scratch_dir)
        os.chdir(self.scratch_dir)
        if lpad:
            try:
                self.lp = LaunchPad.from_file(os.path.join(DB_DIR, "my_launchpad.yaml"))
                self.lp.reset("", require_password=False)
            except:
                raise unittest.SkipTest('Cannot connect to MongoDB! Is the database server running? '
                                        'Are the credentials correct?')
Example #17
0
def launch():
    descr  = "Smart rocket launcher."\
        "Uses the execution termination emails send by the batch system to "\
        "launch fireworks that depend on other fireworks i.e fireworks that "\
        "have 'cal_objs' in their spec."\
        "Takes in fw_ids of fireworks to be launched. "\
        "Range specification of fw_ids is also supported."\
        "All the jobs are launched to hipergator remotely using fabric."\
        "Note: Ensure that the submit scripts have the appropriate email settings and "\
        "that the mail daemon is fetching emails to the folder polled by this script."\
        "Note: All rocket launches take place in the home directory. If "\
        "_launch_dir spec is set for the firework the job files will be written to "\
        "that folder and jobs to the batch system will be done from there."
    parser = ArgumentParser(description=descr)
    parser.add_argument('-f',
                        '--fw_ids',
                        help='one or more of fw_ids to run',
                        default=None,
                        type=int,
                        nargs='+')
    parser.add_argument(
        '-r',
        '--r_fw_ids',
        help='start and end fw_ids of the range of fw_ids to run',
        default=None,
        type=int,
        nargs=2)
    args = parser.parse_args()
    fw_ids = args.fw_ids
    if args.r_fw_ids is not None:
        fw_ids += range(args.r_fw_ids[0], args.r_fw_ids[1])
    job_ids = None
    lp = LaunchPad.from_file(LAUNCHPAD_LOC)
    print('Firework ids: ', fw_ids)
    if fw_ids is None:
        print('No fw ids given')
        return
    for fid in fw_ids:
        m_fw = lp._get_a_fw_to_run(fw_id=fid, checkout=False)
        if m_fw is None:
            print('No firework with that id')
            return
        fw_spec = dict(m_fw.spec)
        done = []
        if fw_spec.get('cal_objs', None) is not None:
            for calparams in fw_spec['cal_objs']:
                if calparams.get('job_ids', None) is not None:
                    job_ids = calparams.get('job_ids', None)
                    print(fid, ' depends on jobs with ids : ', job_ids)
                    if job_ids is not None:
                        for jid in job_ids:
                            done.append(check_done(jid))
                    else:
                        print('job_ids not set')
        else:
            print('This firework doesnt depend on any other fireworks.')
            done.append(True)
        if done and all(done):
            print('Launching ', fid, ' ...')
            with settings(host_string='*****@*****.**'):
                run("ssh dev1 rlaunch singleshot -f " + str(fid))
        else:
            print(
                "Haven't recieved execution termination confirmation for the jobs in the firework from hipergator resource manager"
            )
        time.sleep(3)
    return
Example #18
0
def configuration(structure_file, functional, sub_sites, element_list, sizes,
                  directory, include_existing, conc_restrict, max_conf,
                  in_custodian, number_nodes, launchpad_file, lpad_name):
    """
    Set up a workflow for a set of configurations.

    Calculate the geometry and total energy of a set of configurations. The
    configurations can be specified using the various options. In case some required
    input is not specified during command execution, it will be requested from the user.

    """
    from pybat.workflow.workflows import get_wf_configurations

    cat = Cathode.from_file(structure_file)

    # Set up the directory
    if directory == "":
        directory = os.getcwd()
    directory = os.path.abspath(directory)

    # Process the option input
    try:
        substitution_sites = eval(sub_sites)
    except SyntaxError:
        substitution_sites = [int(site) for site in sub_sites.split(" ")]
    try:
        element_list = eval(element_list)
    except SyntaxError:
        element_list = [el for el in element_list.split(" ")]
    try:
        sizes = [int(i) for i in sizes.strip("[]").split(",")]
    except ValueError:
        sizes = eval(sizes)
    try:
        conc_restrict = eval(conc_restrict)
    except TypeError:
        conc_restrict = None

    # In case some required settings are missing, request them
    if not substitution_sites:
        print(cat)
        print()
        substitution_sites = [
            int(i) for i in input(
                "Please provide the substitution site indices, separated by a space: "
            ).split(" ")
        ]
    if not element_list:
        element_list = [
            i for i in input(
                "Please provide the substitution elements, separated by a space: "
            ).split(" ")
        ]
    if not sizes:
        sizes = [
            int(i) for i in input(
                "Please provide the possible unit cell sizes, separated by a space: "
            ).split(" ")
        ]

    if launchpad_file:
        lpad = LaunchPad.from_file(launchpad_file)
    else:
        lpad = _load_launchpad(lpad_name)

    lpad.add_wf(
        get_wf_configurations(structure=cat,
                              substitution_sites=substitution_sites,
                              element_list=element_list,
                              sizes=sizes,
                              concentration_restrictions=conc_restrict,
                              max_configurations=max_conf,
                              functional=string_to_functional(functional),
                              directory=directory,
                              include_existing=include_existing,
                              in_custodian=in_custodian,
                              number_nodes=number_nodes))
Example #19
0
 def test_dict_from_file(self):
     lp = LaunchPad.from_file(self.LP_LOC)
     lp_dict = lp.to_dict()
     new_lp = LaunchPad.from_dict(lp_dict)
     self.assertIsInstance(new_lp, LaunchPad)
Example #20
0
from MultiFil_edu.settings.environ import FIREWORKS_LAUNCHPAD_FILE

__author__ = 'Ziqin (Shaun) Rong'
__version__ = '0.1'
__maintainer__ = 'Ziqin (Shaun) Rong'
__email__ = '*****@*****.**'

if __name__ == '__main__':
    # Parameters
    moving_cation = Element('Mg')
    calculated_images = [0, 4]  # This is 1st phase screening
    # calculated_images = range(0, 9) # This is 2nd phase MEP calculation
    input_file = 'Mg_approx_neb_example.txt'
    collection_name = 'Mg_MV'

    lp = LaunchPad.from_file(FIREWORKS_LAUNCHPAD_FILE)

    wf_idx = []

    with open(input_file, 'r') as f:
        data = f.readlines()

    for i, content in enumerate(data):
        data[i] = content.split()

    for doc in data:
        wf_idx.append((
            doc[0],
            int(doc[1]),
        ))
               'KPOINTS': [k for k in range(20, 30, 10)]
             }
job_dir = 'calBulk'
job_cmd = ['mpirun', '/home/km468/Software/VASP/vasp.5.3.5/vasp']
qparams= dict(nnodes='1', ppnode='16', 
              job_name='vasp_job', pmem='1000mb',
              walltime='24:00:00',
              rocket_launch=''.join(job_cmd))
# set qadapter to None to launch via qlaunch
# reserve and launch offline
# qlaunch -r singleshot
# lpad recover_offline
qadapter = None #CommonAdapter(q_type="PBS",**qparams)
cal = Calibrate(incar, poscar, potcar, kpoints,
                turn_knobs = turn_knobs,
                qadapter = qadapter,
                job_dir = job_dir, job_cmd=job_cmd)
caltask = MPINTCalibrateTask(cal.as_dict())

#firework with launch directory set to $FW_JOB_DIR, an environment variable
#spec={'_launch_dir':'$FW_JOB_DIR'}, 
fw_calibrate = Firework([caltask], 
                        name="fw_test")
wf = Workflow([fw_calibrate], name="mpint_wf_test")
lp = LaunchPad.from_file(LAUNCHPAD_LOC)
print('fireworks in the database before adding the workflow: \n',
      lp.get_fw_ids())
lp.add_wf(wf)
print('fireworks in the database: \n', lp.get_fw_ids())

Example #22
0
.. codeauthor:: Michele Galasso <*****@*****.**>
"""

import numpy as np

from copy import copy
from ase.io import read
from typing import Union
from itertools import product
from fireworks import LaunchPad, Firework, Workflow

from common.utilities import atoms_to_encode, VaspCalculationTask, WriteOutputTask, WriteChargesTask

# substitute with your launchpad file
launchpad = LaunchPad.from_file('/home/mgalasso/.fireworks/my_launchpad.yaml')


class SubmitFirework(object):
    def __init__(self,
                 poscar_file: str,
                 mode: str,
                 fix_params: dict,
                 magmoms: list,
                 encut_values: Union[list, range] = None,
                 sigma_values: Union[list, range] = None,
                 kpts_values: Union[list, range] = None,
                 pert_values: Union[list, range] = None,
                 setting: int = None,
                 dummy_atom: str = None,
                 dummy_position: int = None):
Example #23
0
 def test_dict_from_file(self):
     lp = LaunchPad.from_file(self.LP_LOC)
     lp_dict = lp.to_dict()
     new_lp = LaunchPad.from_dict(lp_dict)
     self.assertIsInstance(new_lp, LaunchPad)
Example #24
0
        structure (Structure): input structure to be optimized and run
        vasp_cmd (str): command to run
        db_file (str): path to file containing the database credentials.

    Returns:
        Workflow
    """
    fws = []

    fws.append(StaticFW(structure=structure, vasp_cmd=vasp_cmd, db_file=db_file))
    fws.append(NonSCFFW(structure=structure, vasp_cmd=vasp_cmd, db_file=db_file, parents=fws[0]))
    fws.append(BandGapCheckFW(structure=structure, parents=fws[1]))
    fws.append(InterpolateFW(structure=structure, parents=fws[2]))

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

    return Workflow(fws, name=wfname)


if __name__ == "__main__":
    from pymatgen.util.testing import PymatgenTest
    from matmethods.vasp.workflows.presets.core import wf_ferroelectric

    structure = PymatgenTest.get_structure("Si")
    # wf = get_wf_ferroelectric(structure)
    my_wf = wf_ferroelectric(structure)
    # lp = LaunchPad()
    lp = LaunchPad.from_file(os.path.join("/global/homes/s/sbajaj/mm_installdir/config", "my_launchpad.yaml"))
    lp.reset('', require_password=False)
    lp.add_wf(my_wf)