def get_simulated_wf(wf): f_dir = ref_dir / "ferroelectric_wf/scratch" bto_ref_dirs = { "_polar_relaxation": f_dir / "polar_relaxation", "_polar_static": f_dir / "polar_static", "_polar_polarization": f_dir / "polar_polarization", "_nonpolar_relaxation": f_dir / "nonpolar_relaxation", "_nonpolar_static": f_dir / "nonpolar_static", "_nonpolar_polarization": f_dir / "nonpolar_polarization", "_interpolation_1_static": f_dir / "interpolation_1_static", "_interpolation_1_polarization": f_dir / "interpolation_1_polarization", } wf = use_potcar_spec(wf, vasp_to_db_kwargs={ "store_volumetric_data": [], "parse_bader": False }) wf = use_fake_vasp(wf, bto_ref_dirs, params_to_check=["ENCUT", "LWAVE"], check_potcar=False) return wf
def test_use_potcar_spec(self): wf = copy_wf(self.bs_wf) wf = use_potcar_spec(wf) idx_list = get_fws_and_tasks(wf, task_name_constraint="WriteVasp") self.assertTrue(len(idx_list) > 0) for idx_fw, idx_t in idx_list: task = wf.fws[idx_fw].tasks[idx_t] self.assertTrue(task["potcar_spec"])
def get_simulated_wf(wf): dirs = { "parent": wf_dir / "1", "ep0": wf_dir / "2", "ep1": wf_dir / "3", "neb1": wf_dir / "4", "neb2": wf_dir / "5", } wf = use_potcar_spec(wf) wf = use_fake_vasp(wf, dirs, params_to_check=["ENCUT"], check_potcar=False) return wf
def _run_scan_relax(self, wf, dir_name): if not VASP_CMD: wf = use_fake_vasp(wf, { "SCAN structure optimization": os.path.join(reference_dir, dir_name) }, check_kpoints=False, check_potcar=False, clear_inputs=False, check_incar=False) else: wf = use_custodian(wf) wf = use_potcar_spec(wf) self.lp.add_wf(wf) # run the workflow rapidfire(self.lp, fworker=_fworker)
def _run_scan_relax(self, wf, formula): if not VASP_CMD: wf = use_fake_vasp(wf, { "PBEsol structure optimization": os.path.join(reference_dir, "PBESol_pre_opt_for_SCAN_{}".format(formula)), "R2SCAN structure optimization": os.path.join(reference_dir, "SCAN_structure_optimization_{}".format(formula)) }, check_kpoints=False, check_potcar=False, clear_inputs=False, check_incar=False) else: wf = use_custodian(wf) wf = use_potcar_spec(wf) fw_ids = self.lp.add_wf(wf) # run the workflow rapidfire(self.lp, fworker=_fworker) return fw_ids
def setUp(self): super().setUp() input_output_dirs = ref_dir / "insertion_wf" names = os.walk(input_output_dirs).__next__()[1] calc_dirs = {n_: input_output_dirs / n_ for n_ in names} base_struct = Structure.from_file(wf_dir / "YPO4-static/inputs/POSCAR") sm = StructureMatcher(ltol=0.6, stol=0.6, angle_tol=9) # Run the workflow with fake vasp wf = get_ion_insertion_wf( structure=base_struct, structure_matcher=sm, working_ion="Mg", volumetric_data_type="AECCAR", db_file=db_dir / "db.json", vasp_powerups=[ { "powerup_name": "add_modify_incar", "kwargs": {"modify_incar_params": {"incar_update": {"KPAR": 8}}}, }, { "powerup_name": "use_fake_vasp", "kwargs": { "ref_dirs": calc_dirs, "check_incar": False, "check_kpoints": False, "check_poscar": False, "check_potcar": False, }, }, {"powerup_name": "use_potcar_spec", "kwargs": {}}, ], optimizefw_kwargs={"ediffg": -0.05}, ) wf_stop_early = get_ion_insertion_wf( structure=base_struct, structure_matcher=sm, working_ion="Mg", volumetric_data_type="AECCAR", db_file=db_dir / "db.json", max_inserted_atoms=1, vasp_powerups=[ { "powerup_name": "add_modify_incar", "kwargs": {"modify_incar_params": {"incar_update": {"KPAR": 8}}}, }, { "powerup_name": "use_fake_vasp", "kwargs": { "ref_dirs": calc_dirs, "check_incar": False, "check_kpoints": False, "check_poscar": False, "check_potcar": False, }, }, {"powerup_name": "use_potcar_spec", "kwargs": {}}, ], optimizefw_kwargs={"ediffg": -0.05}, ) wf = use_fake_vasp( wf, calc_dirs, check_incar=False, check_kpoints=False, check_poscar=False, check_potcar=False, ) wf = use_potcar_spec(wf) self.wf = wf wf_stop_early = use_fake_vasp( wf_stop_early, calc_dirs, check_incar=False, check_kpoints=False, check_poscar=False, check_potcar=False, ) wf_stop_early = use_potcar_spec(wf_stop_early) self.wf_stop_early = wf_stop_early