def run_task(self, fw_spec): unitcell = Structure.from_file("POSCAR") supercell = self.get("supercell", None) if supercell is not None: os.system('cp POSCAR POSCAR-unitcell') unitcell.make_supercell(supercell) lepsilon = self.get("lepsilon", False) standardize = self.get("standardize", False) other_params = self.get("other_params", {}) user_incar_settings = self.get("user_incar_settings", {}) finder = SpacegroupAnalyzer(unitcell) prims = finder.get_primitive_standard_structure() # for lepsilon runs, the kpoints should be denser if lepsilon: kpoint_set = Generate_kpoints(prims, 0.02) struct = prims elif standardize: kpoint_set = Generate_kpoints(prims, 0.03) struct = prims else: kpoint_set = Generate_kpoints(unitcell, 0.03) struct = unitcell vis = MPStaticSet(struct, user_incar_settings=user_incar_settings, user_kpoints_settings=kpoint_set, sym_prec=self.get("sym_prec", 0.1), lepsilon=lepsilon, **other_params) vis.write_input(".")
"EDIFF": 1E-7, "EDIFFG": -1E-3, "PREC": "Accurate", "NPAR": 2} custom_settings_dfpt = {"SYSTEM": "Si", "ENCUT": 600, "ISTART": 0, "ICHARG": 2, "ISMEAR": -5, "SIGMA": 0.02, "IBRION": 8, "IALGO": 38, "EDIFF": 1E-7, "EDIFFG": 1E-6, "PREC": "Accurate", "LCHARG": ".FALSE.", "LWAVE": ".FALSE.", "LREAL": ".FALSE.", "ADDGRID": ".TRUE."} KPOINT = Generate_kpoints(struct, 0.03) # set up the LaunchPad and reset it launchpad = LaunchPad(host=<your database url>, name="test") launchpad.reset('', require_password=False) workflow = wf_phonon_conductivity(struct, vasp_input_set_relax=custom_settings_relax, vasp_input_set_fixvol_relax=custom_settings_fixvol_relax, vasp_input_set_dfpt=custom_settings_dfpt, vasp_kpoint_set=KPOINT, vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<", Temp=[300], ifscale=True, supercell=[2,2,2]) # store workflow and launch it locally launchpad.add_wf(workflow)
def run_task(self, fw_spec): try: OSZICAR = Oszicar('OSZICAR') except VaspParserError as err: print(err) else: if len(OSZICAR.ionic_steps) == 1: new_name = "{}-{}".format(self.get("name"), "final") calc_locs = list(fw_spec.get("calc_locs", [])) calc_locs.append({ "name": new_name, "filesystem": env_chk(self.get('filesystem', None), fw_spec), "path": self.get("path", os.getcwd()) }) return FWAction(mod_spec=[{ '_push_all': { 'calc_locs': calc_locs } }]) else: stru = Structure.from_file("CONTCAR") kpoint_set = Generate_kpoints(stru, 0.03) if self.get("vasp_input_set", None) is not None: vasp_input_set_temp = self.get("vasp_input_set") tempdict = dict(vasp_input_set_temp.incar.items()) vasp_input_set = MPRelaxSet( stru, user_incar_settings=tempdict, user_kpoints_settings=kpoint_set) else: vasp_input_set_params = self.get("vasp_input_set_params") vasp_input_set = MPRelaxSet( stru, user_incar_settings=vasp_input_set_params, user_kpoints_settings=kpoint_set) vasp_cmd = self.get("vasp_cmd") db_file = self.get("db_file") name = self.get("name") count = self.get("count") kwargs = self.get("kwargs", {}) calc_locs = list(fw_spec.get("calc_locs", [])) calc_locs.append({ "name": "{}-{}".format(name, str(count)), "filesystem": env_chk(self.get('filesystem', None), fw_spec), "path": self.get("path", os.getcwd()) }) count = count + 1 from aicon.myfireworks import MyOptimizeFW new_fw = MyOptimizeFW(structure=stru, vasp_input_set=vasp_input_set, vasp_cmd=vasp_cmd, db_file=db_file, name=name, count=count, **kwargs) return FWAction(mod_spec=[{ '_push_all': { 'calc_locs': calc_locs } }], detours=new_fw)