def wf_bandstructure_plus_boltztrap(structure, c=None): c = c or {} vasp_cmd = c.get("VASP_CMD", VASP_CMD) db_file = c.get("DB_FILE", DB_FILE) params = [] for x in range(4): params.append({"vasp_cmd": vasp_cmd, "db_file": db_file}) params.append({"db_file": db_file}) wf = get_wf(structure, "bandstructure_boltztrap.yaml", vis=MPRelaxSet(structure, force_gamma=True), params=params) 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
def wf_static(structure, c=None): c = c or {} vasp_cmd = c.get("VASP_CMD", VASP_CMD) db_file = c.get("DB_FILE", DB_FILE) wf = get_wf(structure, "static_only.yaml", vis=MPStaticSet(structure), common_params={"vasp_cmd": vasp_cmd, "db_file": db_file}) wf = add_common_powerups(wf, c) if c.get("ADD_WF_METADATA", ADD_WF_METADATA): wf = add_wf_metadata(wf, structure) return wf
def wf_dielectric_constant(structure, c=None): c = c or {} vasp_cmd = c.get("VASP_CMD", VASP_CMD) db_file = c.get("DB_FILE", DB_FILE) wf = get_wf(structure, "dielectric_constant.yaml", vis=MPRelaxSet(structure, force_gamma=True), common_params={"vasp_cmd": vasp_cmd, "db_file": db_file}) wf = add_common_powerups(wf, c) if c.get("ADD_WF_METADATA", ADD_WF_METADATA): wf = add_wf_metadata(wf, structure) return wf
def test_single_Vasp_dbinsertion(self): # add the workflow structure = self.struct_si # instructs to use db_file set by FWorker, see env_chk my_wf = get_wf(structure, "optimize_only.yaml", vis=MPRelaxSet(structure, force_gamma=True), common_params={"vasp_cmd": VASP_CMD, "db_file": ">>db_file<<"}) if not VASP_CMD: my_wf = use_fake_vasp(my_wf) else: my_wf = use_custodian(my_wf) self.lp.add_wf(my_wf) # run the workflow # set the db_file variable rapidfire(self.lp, fworker=FWorker(env={"db_file": os.path.join(db_dir, "db.json")})) d = self._get_task_collection().find_one() self._check_run(d, mode="structure optimization")
def test_single_Vasp(self): # add the workflow structure = self.struct_si my_wf = get_wf(structure, "optimize_only.yaml", vis=MPRelaxSet(structure, force_gamma=True), common_params={"vasp_cmd": VASP_CMD}) if not VASP_CMD: my_wf = use_fake_vasp(my_wf) else: my_wf = use_custodian(my_wf) self.lp.add_wf(my_wf) # run the workflow rapidfire(self.lp) fw = self.lp.get_fw_by_id(1) with open(os.path.join(fw.launches[-1].launch_dir, "task.json")) as f: d = json.load(f) self._check_run(d, mode="structure optimization")
def test_trackers(self): # add the workflow structure = self.struct_si my_wf = get_wf(structure, "optimize_only.yaml", vis=MPRelaxSet(structure, force_gamma=True), common_params={"vasp_cmd": VASP_CMD}) if not VASP_CMD: my_wf = use_fake_vasp(my_wf) else: my_wf = use_custodian(my_wf) my_wf = add_trackers(my_wf) self.lp.add_wf(my_wf) # run the workflow rapidfire(self.lp) for x in self.lp.get_tracker_data(1): for t in x["trackers"]: self.assertGreater(len(t.content.split("\n")), 20)
def test_single_Vasp(self): # add the workflow structure = self.struct_si my_wf = get_wf(structure, "optimize_only.yaml", vis=MPRelaxSet(structure, force_gamma=True), common_params={"vasp_cmd": VASP_CMD}) if not VASP_CMD: my_wf = use_fake_vasp(my_wf, ref_dirs_si) else: my_wf = use_custodian(my_wf) self.lp.add_wf(my_wf) # run the workflow rapidfire(self.lp) fw = self.lp.get_fw_by_id(1) with open(os.path.join(fw.launches[-1].launch_dir, "task.json")) as f: d = json.load(f) self._check_run(d, mode="structure optimization")
def test_bandstructure_Vasp(self): # add the workflow structure = self.struct_si # instructs to use db_file set by FWorker, see env_chk my_wf = get_wf(structure, "bandstructure.yaml", vis=MPRelaxSet(structure, force_gamma=True), common_params={"vasp_cmd": VASP_CMD, "db_file": ">>db_file<<"}) if not VASP_CMD: my_wf = use_fake_vasp(my_wf) else: my_wf = use_custodian(my_wf) my_wf = add_namefile(my_wf) # add a slug of fw-name to output files self.lp.add_wf(my_wf) # run the workflow # set the db_file variable rapidfire(self.lp, fworker=FWorker(env={"db_file": os.path.join(db_dir, "db.json")})) # make sure the structure relaxation ran OK d = self._get_task_collection().find_one({"task_label": "structure optimization"}, sort=[("_id", DESCENDING)]) self._check_run(d, mode="structure optimization") # make sure the static run ran OK d = self._get_task_collection().find_one({"task_label": "static"}, sort=[("_id", DESCENDING)]) self._check_run(d, mode="static") # make sure the uniform run ran OK d = self._get_task_collection().find_one({"task_label": "nscf uniform"}, sort=[("_id", DESCENDING)]) self._check_run(d, mode="nscf uniform") # make sure the uniform run ran OK d = self._get_task_collection().find_one({"task_label": "nscf line"}, sort=[("_id", DESCENDING)]) self._check_run(d, mode="nscf line")
def setUpClass(cls): struct_si = PymatgenTest.get_structure("Si") vis = MPRelaxSet(struct_si, force_gamma=True) cls.bs_wf = get_wf(struct_si, "bandstructure.yaml", vis=vis, common_params={"vasp_cmd": "test_VASP"})