How to use the atomate.vasp.firetasks.glue_tasks.CopyVaspOutputs function in atomate

To help you get started, we’ve selected a few atomate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hackingmaterials / atomate / atomate / vasp / fireworks / core.py View on Github external
parents (Firework): Parents of this particular Firework.
                FW or list of FWS.
            user_incar_settings (dict): Parameters in INCAR to override
            \*\*kwargs: Other kwargs that are passed to Firework.__init__.
        """
        name = "{}_{}_{}".format(name, str(mode), str(displacement))
        fw_name = "{}-{}".format(structure.composition.reduced_formula if structure else "unknown", name)

        user_incar_settings = user_incar_settings or {}

        t = []

        if prev_calc_dir:
            t.append(CopyVaspOutputs(calc_dir=prev_calc_dir, contcar_to_poscar=True))
        elif parents:
            t.append(CopyVaspOutputs(calc_loc=True, contcar_to_poscar=True))
        else:
            raise ValueError("Must specify a previous calculation")

        t.append(WriteVaspStaticFromPrev(lepsilon=True, other_params={
            'user_incar_settings': user_incar_settings}))

        t.append(WriteNormalmodeDisplacedPoscar(mode=mode,
                                                displacement=displacement))

        t.append(RunVaspCustodian(vasp_cmd=vasp_cmd))

        key = "{}_{}".format(mode, displacement).replace('-', 'm').replace('.',
                                                                           'd')
        t.append(pass_vasp_result(pass_dict={"mode": mode,
                                             "displacement": displacement,
                                             "epsilon": "a>>epsilon_static"},
github materialsproject / mpmorph / mpmorph / workflow / old_temp_mdtasks.py View on Github external
override_default_vasp_params['user_incar_settings'] = override_default_vasp_params.get(
            'user_incar_settings') or {}
        override_default_vasp_params['user_incar_settings'].update({"ISIF": 1, "LWAVE": False})

        fw1 = MDFW(structure=structure, start_temp=temperature, end_temp=temperature, nsteps=run_steps,
                   name=name + "_" + str(spawn_count), vasp_input_set=vasp_input_set, db_file=db_file,
                   vasp_cmd=vasp_cmd, wall_time=run_time, override_default_vasp_params=override_default_vasp_params,
                   **optional_MDWF_params)
        _steps += run_steps
        spawn_count += 1
        fw_list.append(fw1)

        while _steps < target_steps:
            _name = (name + "_" + str(spawn_count))
            t = []
            t.append(CopyVaspOutputs(calc_loc=True, contcar_to_poscar=True, additional_files=["XDATCAR", "OSZICAR", "DOSCAR"]))
            if spawn_count == 1:
                if copy_calcs:
                    t.append(CopyCalsHome(calc_home=calc_home, run_name=name + "_0"))
            t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, gamma_vasp_cmd=">>gamma_vasp_cmd<<",
                                      handler_group="md", wall_time=run_time, gzip_output=False))
            if copy_calcs:
                t.append(CopyCalsHome(calc_home=calc_home, run_name=_name))
            t.append(PassCalcLocs(name=_name))
            new_fw = Firework(tasks=t, name=_name, parents=[fw_list[spawn_count-1]], spec=priority_spec)
            _steps += run_steps
            spawn_count += 1
            fw_list.append(new_fw)
        return fw_list
github materialsproject / mpmorph / mpmorph / workflow / old_mdtasks.py View on Github external
snaps = self.get("cool", False)
        averaging_fraction = self.get("averaging_fraction", 0.5)
        p = parse_pressure("./", averaging_fraction)[0]

        final_run = self.get("final_run", True)

        pressure_threshold = 5

        if np.fabs(p) > pressure_threshold:
            t = []
            # Copy the VASP outputs from previous run. Very first run get its from the initial MDWF which
            # uses PassCalcLocs. For the rest we just specify the previous dir.
            if spawn_count == 0:
                t.append(CopyVaspOutputs(calc_dir=current_dir, contcar_to_poscar=False))
            else:
                t.append(CopyVaspOutputs(calc_dir=current_dir, contcar_to_poscar=True))

            t.append(RescaleVolumeTask(initial_pressure=p * 1000.0, initial_temperature=1, beta = rsv_beta))
            t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, gamma_vasp_cmd=">>gamma_vasp_cmd<<",
                                      handler_group="md", wall_time=wall_time, gzip_output=False))
            t.append(PassCalcLocs(name=name))
            # Will implement the database insertion
            # t.append(VaspToDbTask(db_file=db_file,
            #                       additional_fields={"task_label": "density_adjustment"}))
            if copy_calcs:
                t.append(CopyCalsHome(calc_home=calc_home, run_name=name))
            t.append(SpawnMDFWTask(pressure_threshold=pressure_threshold,
                                   max_rescales=max_rescales,
                                   wall_time=wall_time,
                                   vasp_cmd=vasp_cmd,
                                   db_file=db_file,
                                   spawn_count=spawn_count + 1,
github materialsproject / mpmorph / mpmorph / workflow / old_workflows.py View on Github external
while temperature > end_temp:
        # Cool Step
        t = []
        t.append(CopyVaspOutputs(calc_loc=True, contcar_to_poscar=True, additional_files=["XDATCAR", "OSZICAR", "DOSCAR"]))
        t.append(WriteSetTask(start_temp= temperature, end_temp = temperature - temp_decrement, nsteps= nsteps_cool))
        t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, gamma_vasp_cmd=">>gamma_vasp_cmd<<",
                                  handler_group="md", wall_time=wall_time, gzip_output=False))
        t.append(PassCalcLocs(name=name+"_cool_"+str(temperature-temp_decrement)))
        if copy_calcs:
            t.append(CopyCalsHome(calc_home=os.path.join(calc_home, name), run_name="cool_"+str(temperature-temp_decrement)))
        fw_list.append(Firework(t, name=name + "_cool_" + str(temperature - temp_decrement), parents=[fw_list[len(fw_list)-1]], spec=priority_spec))

        # Hold Step
        t = []
        t.append(
            CopyVaspOutputs(calc_loc=True, contcar_to_poscar=True, additional_files=["XDATCAR", "OSZICAR", "DOSCAR"]))
        t.append(WriteSetTask(start_temp=temperature-temp_decrement, end_temp=temperature - temp_decrement, nsteps=nsteps_hold))
        t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, gamma_vasp_cmd=">>gamma_vasp_cmd<<",
                                  handler_group="md", wall_time=wall_time, gzip_output=False))
        t.append(PassCalcLocs(name=name + "_hold_" + str(temperature - temp_decrement)))
        if copy_calcs:
            t.append(CopyCalsHome(calc_home=os.path.join(calc_home, name),
                                  run_name="hold_" + str(temperature - temp_decrement)))
        if temperature == end_temp+temp_decrement:
            t.append(RelaxStaticTask(copy_calcs=copy_calcs, calc_home=calc_home, db_file=db_file, snap_num=snap_num, priority_spec=priority_spec))
            if diffusion:
                t.append(DiffusionTask(copy_calcs=copy_calcs, calc_home=calc_home, db_file=db_file, snap_num=snap_num, priority_spec=priority_spec))
        fw_list.append(Firework(t, name=name+"_hold_"+str(temperature-temp_decrement), parents=[fw_list[len(fw_list)-1]], spec=priority_spec))
        temperature -= temp_decrement


    wf = Workflow(fw_list, name=wflow_name + "_" + name + "simulated_anneal_WF")
github materialsproject / mpmorph / mpmorph / workflow / old_mdtasks.py View on Github external
_poscar = Poscar.from_file(os.path.join(current_dir, 'POSCAR'))

            name = str(_poscar.structure.composition.reduced_formula)
            if final_run or snaps:
                if diffusion_bool:
                    _steps = 40000
                    _name = "diffusion_run"
                else:
                    _steps = 10000
                    _name = "longrun"
                fw_list = self.get_final_run_fws(_poscar.structure, name=_name, copy_calcs=copy_calcs,
                                                 calc_home=calc_home, target_steps=_steps, temperature=temperature,
                                                 priority_spec=priority_spec)
            if snaps:
                t = []
                t.append(CopyVaspOutputs(calc_loc=True, contcar_to_poscar=True, additional_files=["XDATCAR"]))
                t.append(StructureSamplerTask(copy_calcs=copy_calcs, calc_home=calc_home, n_snapshots=snaps, priority_spec=priority_spec))
                if len(fw_list) > 0:
                    new_fw = Firework(t, name=name + "structure_sampler", parents=fw_list[len(fw_list)-1], spec=priority_spec)
                else:
                    new_fw = Firework(t, name=name + "structure_sampler", spec=priority_spec)
                fw_list.append(new_fw)
            if snaps or final_run:
                wf = Workflow(fw_list, name=name + "_" + str(temperature) + "_longruns")
                wf = powerups.add_modify_incar_envchk(wf)
                return FWAction(stored_data={'pressure':p, 'density_calculated': True}, additions=wf)
            return FWAction(stored_data={'pressure':p, 'density_calculated': True})
github materialsproject / mpmorph / mpmorph / workflow / old_workflows.py View on Github external
override_default_vasp_params = override_default_vasp_params or {}
    override_default_vasp_params['user_incar_settings'] = override_default_vasp_params.get('user_incar_settings') or {}
    override_default_vasp_params['user_incar_settings'].update({"ISIF": 1, "LWAVE": False})

    fw_list = []

    temperature = start_temp

    # Firework for first cool step
    fw1 = MDFW(structure=structure, start_temp=start_temp, end_temp=start_temp - temp_decrement, nsteps=nsteps_cool,
               name=name + "_cool_" + str(start_temp - temp_decrement), vasp_input_set=vasp_input_set, db_file=db_file,
               vasp_cmd=vasp_cmd, wall_time=wall_time, copy_vasp_outputs=False, override_default_vasp_params=override_default_vasp_params,
               **optional_MDWF_params)
    fw_list.append(fw1)
    t = []
    t.append(CopyVaspOutputs(calc_loc=True, contcar_to_poscar=True, additional_files=["XDATCAR", "OSZICAR", "DOSCAR"]))

    if copy_calcs:
        t.append(
            CopyCalsHome(calc_home=os.path.join(calc_home, name), run_name="cool_" + str(start_temp - temp_decrement)))

    # Firework for first hold step
    t.append(WriteSetTask(start_temp= start_temp - temp_decrement, end_temp = start_temp - temp_decrement, nsteps= nsteps_hold))
    t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, gamma_vasp_cmd=">>gamma_vasp_cmd<<",
                              handler_group="md", wall_time=wall_time, gzip_output=False))
    t.append(PassCalcLocs(name=str(name) + "_hold_" + str(start_temp - temp_decrement)))

    if copy_calcs:
        t.append(
            CopyCalsHome(calc_home=os.path.join(calc_home, name), run_name="hold_" + str(start_temp - temp_decrement)))

    fw_list.append(Firework(t, parents=[fw1], name=name + "_hold_" + str(start_temp - temp_decrement), spec=priority_spec))
github materialsproject / mpmorph / mpmorph / workflow / old_mdtasks.py View on Github external
override_default_vasp_params['user_incar_settings'] = override_default_vasp_params.get(
            'user_incar_settings') or {}
        override_default_vasp_params['user_incar_settings'].update({"ISIF": 1, "LWAVE": False})

        fw1 = MDFW(structure=structure, start_temp=temperature, end_temp=temperature, nsteps=run_steps,
                   name=name + "_" + str(spawn_count), vasp_input_set=vasp_input_set, db_file=db_file,
                   vasp_cmd=vasp_cmd, wall_time=run_time, copy_vasp_outputs=False, override_default_vasp_params=override_default_vasp_params,
                   **optional_MDWF_params)
        _steps += run_steps
        spawn_count += 1
        fw_list.append(fw1)

        while _steps < target_steps:
            _name = (name + "_" + str(spawn_count))
            t = []
            t.append(CopyVaspOutputs(calc_loc=True, contcar_to_poscar=True, additional_files=["XDATCAR", "OSZICAR", "DOSCAR"]))
            if spawn_count == 1:
                if copy_calcs:
                    t.append(CopyCalsHome(calc_home=calc_home, run_name=name + "_0"))
            t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, gamma_vasp_cmd=">>gamma_vasp_cmd<<",
                                      handler_group="md", wall_time=run_time, gzip_output=False))
            if copy_calcs:
                t.append(CopyCalsHome(calc_home=calc_home, run_name=_name))
            t.append(PassCalcLocs(name=_name))
            new_fw = Firework(tasks=t, name=_name, parents=[fw_list[spawn_count-1]], spec=priority_spec)
            _steps += run_steps
            spawn_count += 1
            fw_list.append(new_fw)
        return fw_list
github hackingmaterials / atomate / atomate / vasp / fireworks / core.py View on Github external
name of the FW.
            name (str): Name for the Firework.
            prev_calc_dir (str): Path to a previous calculation to copy from
            vasp_cmd (str): Command to run vasp.
            copy_vasp_outputs (bool): Whether to copy outputs from previous
                run. Defaults to True.
            db_file (str): Path to file specifying db credentials.
            parents (Firework): Parents of this particular Firework.
                FW or list of FWS.
            \*\*kwargs: Other kwargs that are passed to Firework.__init__.
        """
        fw_name = "{}-{}".format(structure.composition.reduced_formula if structure else "unknown", name)

        t = []
        if prev_calc_dir:
            t.append(CopyVaspOutputs(calc_dir=prev_calc_dir, additional_files=["CHGCAR"], contcar_to_poscar=True))
            t.append(WriteVaspSOCFromPrev(prev_calc_dir=".", magmom=magmom,
                                          saxis=saxis))
        elif parents and copy_vasp_outputs:
            t.append(CopyVaspOutputs(calc_loc=True, additional_files=["CHGCAR"],
                                     contcar_to_poscar=True))
            t.append(WriteVaspSOCFromPrev(prev_calc_dir=".", magmom=magmom,
                                          saxis=saxis))
        elif structure:
            vasp_input_set = MPSOCSet(structure)
            t.append(WriteVaspFromIOSet(structure=structure,
                                        vasp_input_set=vasp_input_set))
        else:
            raise ValueError("Must specify structure or previous calculation.")

        t.extend(
            [RunVaspCustodian(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<"),
github hackingmaterials / atomate / atomate / vasp / fireworks / core.py View on Github external
copy_vasp_outputs (bool): Whether to copy outputs from previous
                run. Defaults to True.
            db_file (str): Path to file specifying db credentials.
            parents (Firework): Parents of this particular Firework.
                FW or list of FWS.
            \*\*kwargs: Other kwargs that are passed to Firework.__init__.
        """
        fw_name = "{}-{}".format(structure.composition.reduced_formula if structure else "unknown", name)

        t = []
        if prev_calc_dir:
            t.append(CopyVaspOutputs(calc_dir=prev_calc_dir, additional_files=["CHGCAR"], contcar_to_poscar=True))
            t.append(WriteVaspSOCFromPrev(prev_calc_dir=".", magmom=magmom,
                                          saxis=saxis))
        elif parents and copy_vasp_outputs:
            t.append(CopyVaspOutputs(calc_loc=True, additional_files=["CHGCAR"],
                                     contcar_to_poscar=True))
            t.append(WriteVaspSOCFromPrev(prev_calc_dir=".", magmom=magmom,
                                          saxis=saxis))
        elif structure:
            vasp_input_set = MPSOCSet(structure)
            t.append(WriteVaspFromIOSet(structure=structure,
                                        vasp_input_set=vasp_input_set))
        else:
            raise ValueError("Must specify structure or previous calculation.")

        t.extend(
            [RunVaspCustodian(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<"),
             PassCalcLocs(name=name),
             VaspToDb(db_file=db_file, additional_fields={"task_label": name})])
        super(SOCFW, self).__init__(t, parents=parents, name=fw_name, **kwargs)
github materialsproject / mpmorph / mpmorph / workflow / old_temp_mdtasks.py View on Github external
snaps = self.get("cool", False)
        averaging_fraction = self.get("averaging_fraction", 0.5)
        p = parse_pressure("./", averaging_fraction)[0]

        final_run = self.get("final_run", True)

        pressure_threshold = 5

        if np.fabs(p) > pressure_threshold:
            t = []
            # Copy the VASP outputs from previous run. Very first run get its from the initial MDWF which
            # uses PassCalcLocs. For the rest we just specify the previous dir.
            if spawn_count == 0:
                t.append(CopyVaspOutputs(calc_dir=current_dir, contcar_to_poscar=False))
            else:
                t.append(CopyVaspOutputs(calc_dir=current_dir, contcar_to_poscar=True))

            t.append(RescaleVolumeTask(initial_pressure=p * 1000.0, initial_temperature=1, beta = 0.000002))
            t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, gamma_vasp_cmd=">>gamma_vasp_cmd<<",
                                      handler_group="md", wall_time=wall_time, gzip_output=False))
            t.append(PassCalcLocs(name=name))
            # Will implement the database insertion
            # t.append(VaspToDbTask(db_file=db_file,
            #                       additional_fields={"task_label": "density_adjustment"}))
            if copy_calcs:
                t.append(CopyCalsHome(calc_home=calc_home, run_name=name))
            t.append(SpawnMDFWTask(pressure_threshold=pressure_threshold,
                                   max_rescales=max_rescales,
                                   wall_time=wall_time,
                                   vasp_cmd=vasp_cmd,
                                   db_file=db_file,
                                   spawn_count=spawn_count + 1,