def generate_nscf_soc_folders(structures, saxis, user_incar): """ Generate the non self-consistent calculation with the spin-orbit coupling """ for name in structures: # add magmom as a site property for each atom outcar = Outcar(filename=os.path.join(name, 'OUTCAR')) for i, atom in enumerate(structures[name].sites): atom.properties = { "magmom": [0., 0., round(outcar.magnetization[i]['tot'], 2)] } # geterate calculation from the MPSOCSet mpsoc = MPSOCSet(structures[name], saxis=saxis, user_incar_settings=user_incar, user_kpoints_settings={"reciprocal_density": 500}) mpsoc.write_input(os.path.join(name, 'nscf_SOC')) # walk around the bug in MPSICSet to introduce LDAUU and LDAUL into INCAR dic = mpsoc.incar.as_dict() dic["LDAUU"] = list(dic["LDAUU"].values()) dic["LDAUL"] = list(dic["LDAUL"].values()) Incar.from_dict(dic).write_file(os.path.join(name, 'nscf_SOC/INCAR')) shutil.copy(os.path.join(name, 'CHGCAR'), os.path.join(name, 'nscf_SOC'))
def __init__(self, structure, magmom, name="spin-orbit coupling", saxis=(0, 0, 1), vasp_cmd="vasp_ncl", copy_vasp_outputs=True, db_file=None, parents=None, **kwargs): """ Firework for spin orbit coupling calculation. Args: structure (Structure): Input structure. If copy_vasp_outputs, used only to set the name of the FW. name (str): Name for the Firework. 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__. """ t = [] if 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)) else: vasp_input_set = MPSOCSet(structure) t.append( WriteVaspFromIOSet(structure=structure, vasp_input_set=vasp_input_set)) 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="{}-{}".format( structure.composition.reduced_formula, name), **kwargs)
def run_task(self, fw_spec): vis = MPSOCSet.from_prev_calc( prev_calc_dir=self["prev_calc_dir"], magmom=self["magmom"], saxis=self["saxis"], copy_chgcar=self.get("copy_chgcar", False), nbands_factor=self.get("nbands_factor", 1.2), reciprocal_density=self.get("reciprocal_density", 100), small_gap_multiply=self.get("small_gap_multiply", None), standardize=self.get("standardize", False), sym_prec=self.get("sym_prec", 0.1), international_monoclinic=self.get("international_monoclinic", True), **self.get("other_params", {})) vis.write_input(".")
def run_task(self, fw_spec): # TODO: @albalu - can saxis have a default value e.g. [001] and be an optional parameter? # -computron # TODO: @albalu - can magmom be auto-parsed from the previous calc? -computron vis = MPSOCSet.from_prev_calc( prev_calc_dir=self.get("prev_calc_dir", "."), magmom=self["magmom"], saxis=self["saxis"], copy_chgcar=self.get("copy_chgcar", False), nbands_factor=self.get("nbands_factor", 1.2), reciprocal_density=self.get("reciprocal_density", 100), small_gap_multiply=self.get("small_gap_multiply", None), standardize=self.get("standardize", False), sym_prec=self.get("sym_prec", 0.1), international_monoclinic=self.get("international_monoclinic", True), **self.get("other_params", {})) vis.write_input(".")