Exemplo n.º 1
0
def use_fake_vasp(original_wf, ref_dirs, params_to_check=None):
    """
    Replaces all tasks with "RunVasp" (e.g. RunVaspDirect) to be RunVaspFake. Thus, we do not
    actually run VASP but copy pre-determined inputs and outputs.

    Args:
        original_wf (Workflow)
        ref_dirs (dict): key=firework name, value=path to the reference vasp calculation directory
        params_to_check (list): optional list of incar parameters to check.

    Returns:
        Workflow
    """
    if not params_to_check:
        params_to_check = [
            "ISPIN", "ENCUT", "ISMEAR", "SIGMA", "IBRION", "LORBIT", "NBANDS",
            "LMAXMIX"
        ]
    for idx_fw, fw in enumerate(original_wf.fws):
        for job_type in ref_dirs.keys():
            if job_type in fw.name:
                for idx_t, t in enumerate(fw.tasks):
                    if "RunVasp" in str(t):
                        original_wf.fws[idx_fw].tasks[idx_t] = \
                            RunVaspFake(ref_dir=ref_dirs[job_type],
                                        params_to_check=params_to_check)
                    if "RunVaspCustodian" in str(t) and t.get(
                            "job_type") == "neb":
                        original_wf.fws[idx_fw].tasks[idx_t] = \
                            RunNEBVaspFake(ref_dir=ref_dirs[job_type],
                                           params_to_check=params_to_check)

    return original_wf
Exemplo n.º 2
0
def use_fake_vasp(
    original_wf,
    ref_dirs,
    params_to_check=None,
    check_incar=True,
    check_kpoints=True,
    check_poscar=True,
    check_potcar=True,
    clear_inputs=True,
):
    """
    Replaces all tasks with "RunVasp" (e.g. RunVaspDirect) to be RunVaspFake.
    Thus, we do not actually run VASP but copy pre-determined inputs and
    outputs.

    Args:
        original_wf (Workflow)
        ref_dirs (dict): key=firework name, value=path to the reference vasp
            calculation directory
        params_to_check (list): optional list of incar parameters to check.
        check_incar (bool): whether to confirm the INCAR params.
        check_kpoints (bool): whether to confirm the KPOINTS params.
        check_poscar (bool): whether to confirm the POSCAR params.
        check_potcar (bool): whether to confirm the POTCAR params.
        clear_inputs (bool): whether to delete VASP input files after running.

    Returns:
        Workflow
    """
    if not params_to_check:
        params_to_check = [
            "ISPIN",
            "ENCUT",
            "ISMEAR",
            "SIGMA",
            "IBRION",
            "LORBIT",
            "NBANDS",
            "LMAXMIX",
        ]

    for idx_fw, fw in enumerate(original_wf.fws):
        for job_type in ref_dirs.keys():
            if job_type in fw.name:
                for idx_t, t in enumerate(fw.tasks):
                    t_str = str(t)
                    t_job_type = t.get("job_type")
                    if "RunVasp" in t_str:
                        original_wf.fws[idx_fw].tasks[idx_t] = RunVaspFake(
                            ref_dir=ref_dirs[job_type],
                            params_to_check=params_to_check,
                            check_incar=check_incar,
                            check_kpoints=check_kpoints,
                            check_poscar=check_poscar,
                            check_potcar=check_potcar,
                            clear_inputs=clear_inputs,
                        )

                    if "RunVaspCustodian" in t_str and t_job_type == "neb":
                        original_wf.fws[idx_fw].tasks[idx_t] = RunNEBVaspFake(
                            ref_dir=ref_dirs[job_type], params_to_check=params_to_check,
                        )

    return original_wf