예제 #1
0
    def incar(self):
        parent_incar = super(PRLRoughStaticSet, self).incar
        incar = Incar(self.prev_incar) if self.prev_incar is not None else \
            Incar(parent_incar)

        for k in ["MAGMOM", "NUPDOWN"] + list(
                self.kwargs.get("user_incar_settings", {}).keys()):
            # For these parameters as well as user specified settings, override
            # the incar settings.
            if parent_incar.get(k, None) is not None:
                incar[k] = parent_incar[k]
            else:
                incar.pop(k, None)

        # use new LDAUU when possible b/c the Poscar might have changed
        # representation
        if incar.get('LDAU'):
            u = incar.get('LDAUU', [])
            j = incar.get('LDAUJ', [])
            if sum([u[x] - j[x] for x, y in enumerate(u)]) > 0:
                for tag in ('LDAUU', 'LDAUL', 'LDAUJ'):
                    incar.update({tag: parent_incar[tag]})
            # ensure to have LMAXMIX for GGA+U static run
            if "LMAXMIX" not in incar:
                incar.update({"LMAXMIX": parent_incar["LMAXMIX"]})

        # Compare ediff between previous and staticinputset values,
        # choose the tighter ediff
        incar["EDIFF"] = min(incar.get("EDIFF", 1), parent_incar["EDIFF"])
        return incar
예제 #2
0
    def incar(self):
        parent_incar = super(PRLStaticSet, self).incar
        incar = Incar(self.prev_incar) if self.prev_incar is not None else \
            Incar(parent_incar)

        incar.update({
            "IBRION": -1,
            "ISMEAR": -5,
            "LAECHG": True,
            "LCHARG": True,
            "LORBIT": 11,
            "LVHAR": True,
            "LWAVE": False,
            "NSW": 0,
            "ICHARG": 0,
            "ALGO": "Normal"
        })

        if self.lepsilon:
            incar["IBRION"] = 8
            incar["LEPSILON"] = True

            # LPEAD=T: numerical evaluation of overlap integral prevents
            # LRF_COMMUTATOR errors and can lead to better expt. agreement
            # but produces slightly different results
            incar["LPEAD"] = True

            # Note that DFPT calculations MUST unset NSW. NSW = 0 will fail
            # to output ionic.
            incar.pop("NSW", None)
            incar.pop("NPAR", None)

        if self.lcalcpol:
            incar["LCALCPOL"] = True

        for k in ["MAGMOM", "NUPDOWN"] + list(
                self.kwargs.get("user_incar_settings", {}).keys()):
            # For these parameters as well as user specified settings, override
            # the incar settings.
            if parent_incar.get(k, None) is not None:
                incar[k] = parent_incar[k]
            else:
                incar.pop(k, None)

        # use new LDAUU when possible b/c the Poscar might have changed
        # representation
        if incar.get('LDAU'):
            u = incar.get('LDAUU', [])
            j = incar.get('LDAUJ', [])
            if sum([u[x] - j[x] for x, y in enumerate(u)]) > 0:
                for tag in ('LDAUU', 'LDAUL', 'LDAUJ'):
                    incar.update({tag: parent_incar[tag]})
            # ensure to have LMAXMIX for GGA+U static run
            if "LMAXMIX" not in incar:
                incar.update({"LMAXMIX": parent_incar["LMAXMIX"]})

        # Compare ediff between previous and staticinputset values,
        # choose the tighter ediff
        incar["EDIFF"] = min(incar.get("EDIFF", 1), parent_incar["EDIFF"])
        return incar
예제 #3
0
def get_defect_charge_state(poscar: Poscar, potcar: Potcar, incar: Incar):
    """Get defect charge state from structure, potcar, and NELECT in INCAR. """
    nelect = incar.get("NELECT", None)
    if nelect is None:
        logger.info("Since NELECT is not written in INCAR, so 0 is returned.")
        return 0
    potcar_elements = [symbol.split("_")[0] for symbol in potcar.symbols]
    if poscar.site_symbols != potcar_elements:
        raise ValueError(
            f"Sequence of elements in POSCAR {poscar.site_symbols}"
            f" and that in POTCAR {potcar.symbols} is different.")
    num_elect_neutral = sum([
        num_atom * pot.nelectrons
        for num_atom, pot in zip(poscar.natoms, potcar)
    ])
    excess_num_electrons = int(nelect - num_elect_neutral)
    return -excess_num_electrons