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, ref_dirs_si) 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 _simulate_vasprun(self, wf): reference_dir = os.path.abspath(os.path.join(ref_dir, "raman_wf")) si_ref_dirs = {"structure optimization": os.path.join(reference_dir, "1"), "phonon static dielectric": os.path.join(reference_dir, "2"), "raman_0_-0.005 static dielectric": os.path.join(reference_dir, "6"), "raman_0_0.005 static dielectric": os.path.join(reference_dir, "5"), "raman_1_-0.005 static dielectric": os.path.join(reference_dir, "4"), "raman_1_0.005 static dielectric": os.path.join(reference_dir, "3")} return use_fake_vasp(wf, si_ref_dirs, params_to_check=["ENCUT"])
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, ref_dirs_si) 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 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_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, ref_dirs_si) 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_bandgap_check_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, ref_dirs_si) else: my_wf = use_custodian(my_wf) my_wf = add_namefile(my_wf) # add a slug of fw-name to output files my_wf = add_bandgap_check(my_wf, check_bandgap_params={"max_gap": 0.1}, fw_name_constraint="structure optimization") 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")})) # structure optimization should be completed self.assertEqual( self.lp.fireworks.find_one({"name": "Si-structure optimization"}, {"state": 1})["state"], "COMPLETED") self.assertEqual( self.lp.fireworks.find_one({"name": "Si-static"}, {"state": 1})["state"], "DEFUSED")