How to use the pyiron.vasp.potential.VaspPotentialFile function in pyiron

To help you get started, we’ve selected a few pyiron examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pyiron / pyiron / pyiron / vasp / potential.py View on Github external
Given a list of species symbols, finds the largest applicable encut.

    Args:
        symbol_lst (list): The list of species symbols.
        return_list (bool): Whether to return the list of all ENMAX values (in the same order as `species_lst` along with
            the largest value). (Default is False.)
        xc ("GGA"/"PBE"/"LDA"): The exchange correlation functional for which the POTCARs were generated. (Default is "PBE".)

    Returns:
        (float): The largest ENMAX among the POTCAR files for all the species.
        [optional](list): The ENMAX value corresponding to each species.
    """
    pot_path_dict = Potcar.pot_path_dict

    enmax_lst = []
    vpf = VaspPotentialFile(xc=xc)

    for symbol in symbol_lst:
        potcar_file = find_potential_file(
            path=vpf.find_default(symbol)['Filename'].values[0][0]
        )
        with open(potcar_file) as pf:
            for i, line in enumerate(pf):
                if i == 14:
                    encut_str = line.split()[2][:-1]
                    enmax_lst.append(float(encut_str))
                    break

    if return_list:
        return max(enmax_lst), enmax_lst
    else:
        return max(enmax_lst)
github pyiron / pyiron / pyiron / vasp / vasp.py View on Github external
def _set_potential_paths(self):
        element_list = self._structure.get_species_symbols()  # .ElementList.getSpecies()
        object_list = self._structure.get_species_objects()
        s.logger.debug("element list: {0}".format(element_list))
        self.el_path_lst = list()
        try:
            xc = self.get("xc")
        except tables.exceptions.NoSuchNodeError:
            xc = self.get("xc")
        s.logger.debug("XC: {0}".format(xc))
        vasp_potentials = VaspPotentialFile(xc=xc)
        for i, el_obj in enumerate(object_list):
            if isinstance(el_obj.Parent, str):
                el = el_obj.Parent
            else:
                el = el_obj.Abbreviation
            if isinstance(el_obj.tags, dict) and 'pseudo_potcar_file' in el_obj.tags.keys():
                new_element = el_obj.tags['pseudo_potcar_file']
                vasp_potentials.add_new_element(parent_element=el, new_element=new_element)
                el_path = self._find_potential_file(
                    path=vasp_potentials.find_default(new_element)['Filename'].values[0][0])
                if not (os.path.isfile(el_path)):
                    raise ValueError('such a file does not exist in the pp directory')
            else:
                el_path = self._find_potential_file(path=vasp_potentials.find_default(el)['Filename'].values[0][0])

            if not (os.path.isfile(el_path)):
github pyiron / pyiron / pyiron / vasp / vasp.py View on Github external
def list_potentials(self):
        """
        Lists all the possible POTCAR files for the elements in the structure depending on the XC functional

        Returns:
            pyiron.vasp.potential.VaspPotentialFile: A pandas datafrome like object
        """
        if self.structure is None:
            raise ValueError("Can't list potentials unless a structure is set")
        else:
            return VaspPotentialFile(xc=self.input.potcar['xc']).find(self.structure.get_species_symbols().tolist())
github pyiron / pyiron / pyiron / vasp / vasp.py View on Github external
def _set_default_path_dict(self):
        if self._structure is None:
            return
        vasp_potentials = VaspPotentialFile(xc=self.get("xc"))
        for i, el_obj in enumerate(self._structure.get_species_objects()):
            if isinstance(el_obj.Parent, str):
                el = el_obj.Parent
            else:
                el = el_obj.Abbreviation
            if isinstance(el_obj.tags, dict):
                if 'pseudo_potcar_file' in el_obj.tags.keys():
                    new_element = el_obj.tags['pseudo_potcar_file']
                    vasp_potentials.add_new_element(parent_element=el, new_element=new_element)
            key = vasp_potentials.find_default(el).Species.values[0][0]
            val = vasp_potentials.find_default(el).Name.values[0]
            self[key] = val
github pyiron / pyiron / pyiron / vasp / potential.py View on Github external
def _set_potential_paths(self):
        element_list = (
            self._structure.get_species_symbols()
        )  # .ElementList.getSpecies()
        object_list = self._structure.get_species_objects()
        s.logger.debug("element list: {0}".format(element_list))
        self.el_path_lst = list()
        try:
            xc = self.get("xc")
        except tables.exceptions.NoSuchNodeError:
            xc = self.get("xc")
        s.logger.debug("XC: {0}".format(xc))
        vasp_potentials = VaspPotentialFile(xc=xc)
        for i, el_obj in enumerate(object_list):
            if isinstance(el_obj.Parent, str):
                el = el_obj.Parent
            else:
                el = el_obj.Abbreviation
            if (
                isinstance(el_obj.tags, dict)
                and "pseudo_potcar_file" in el_obj.tags.keys()
            ):
                new_element = el_obj.tags["pseudo_potcar_file"]
                vasp_potentials.add_new_element(
                    parent_element=el, new_element=new_element
                )
                el_path = find_potential_file(
                    path=vasp_potentials.find_default(new_element)["Filename"].values[
                        0
github pyiron / pyiron / pyiron / vasp / vasp.py View on Github external
def __init__(self, project, job_name):
        super(Vasp, self).__init__(project, job_name)
        self.__name__ = "Vasp"
        self.__version__ = None  # Reset the version number to the executable is set automatically
        self._sorted_indices = None
        self._executable_activate()
        self.input = Input()
        self.input.incar["SYSTEM"] = self.job_name
        self._interface = InteractiveVaspInterface()
        self._potential = VaspPotentialFile(xc=self.input.potcar["xc"])
github pyiron / pyiron / pyiron / vasp / base.py View on Github external
def get_nelect(self):
        """
        Returns the number of electrons in the systems

        Returns:
            float: Number of electrons in the system

        """
        if not self.status.finished and self.structure is not None:
            potential = VaspPotentialFile(xc=self.input.potcar["xc"])
            return sum(
                [
                    potential.find_default(el).n_elect.values[-1] * n_atoms
                    for el, n_atoms in self.structure.get_parent_basis()
                    .get_number_species_atoms()
                    .items()
                ]
            )
        else:
            return self["output/generic/dft/n_elect"]