Пример #1
0
    def isotope (self,before="POMASS =    1.000", change="POMASS =    3.000"):
        from pymatgen.io.vasp.outputs import Poscar
        from pymatgen.io.vasp.inputs import PotcarSingle
        from pymatgen.io.vasp.outputs import Potcar
        from pymatgen.io.vasp.sets import MPNMRSet
        import shutil
        import os
        os.chdir(self.dire)
        print (os.getcwd())
        poscar= Poscar.from_file("POSCAR")
        # structure = poscar.structure
        print (poscar)
        potcar= Potcar.from_file("POTCAR")
        potc=str(potcar)

        cc= potc.replace(before,change)

        vv=PotcarSingle(cc,)
        vv.write_file("POTCAR_1")

        print (vv)
Пример #2
0
    def potcar_from_linklist(cls, poscar_data, linklist):
        """
        Assemble pymatgen Potcar object from a list of VaspPotcarData instances

        Reads pseudo-potential from the passed list connecting each element
        with it's potential and creates the complete Potcar file according
        to the element ordering fodun in the passed poscar data object.

        :param poscar_data: input structure for VASP calculations
        :type poscar: :class:`aiida_cusp.data.inputs.VaspPoscarData`
        :param linklist: dictionary mapping element names to VaspPotcarData
            instances
        :type linklist: `dict`
        :returns: pymatgen Potcar data instance with containing the
            concatenated pseudo-potential information for all elements defined
            in the linklist
        :rtype: :class:`~pymatgen.io.vasp.inputs.Potcar`
        """
        # initialize empty Potcar object
        complete_potcar = Potcar()
        # file empty potcar with potential in order of elements found in the
        # passed structure data
        site_symbols = poscar_data.get_poscar().site_symbols
        for site_symbol in site_symbols:
            try:
                potential_pointer = linklist[site_symbol]
            except KeyError:
                raise VaspPotcarDataError(
                    "Found no potential in passed "
                    "potential-element map for "
                    "site symbol '{}'".format(site_symbol))
            potential_file = potential_pointer.load_potential_file_node()
            potential_contents = potential_file.get_content()
            potcar_single = PotcarSingle(potential_contents)
            complete_potcar.append(potcar_single)
        return complete_potcar