예제 #1
0
    def __init__(self, user_incar_settings, 
                 constrain_total_magmom=False, sort_structure=False,
                 kpoints_density=1000, sym_prec=0.1):
        self.sym_prec = sym_prec
        
        DictVaspInputSet.__init__(
            self, "MaterialsProject Static",
            loadfn(os.path.join(MODULE_DIR, "MPVaspInputSet.yaml")),
            constrain_total_magmom=constrain_total_magmom,
            sort_structure=sort_structure)

        self.user_incar_settings = user_incar_settings

        # impose tetrahedron method
        self.incar_settings.update(
            {"IBRION": -1, "ISMEAR": -5, "LCHARG": False,
             "LORBIT": 11, "LWAVE": False, "NSW": 0, "ISYM": 0, "ICHARG": 11})

        # this variable may have been used in the  ground state calculation,
        #  but is not relevant to the tetrahedron DOS calculation; its superfluous
        # presence in the INCAR leads to (human) confusion (VASP doesn't care).
        self.incar_settings.pop('SIGMA',None) 

        self.kpoints_settings.update({"kpoints_density": kpoints_density})

        # Set dense DOS output
        self.incar_settings.update({"NEDOS": 2001})

        if "NBANDS" not in user_incar_settings:
            raise KeyError("For NonSCF runs, NBANDS value from SC runs is "
                           "required!")
        else:
            self.incar_settings.update(user_incar_settings)
예제 #2
0
파일: GW.py 프로젝트: qimin/python_script
 def __init__(self, user_incar_settings=None, constrain_total_magmom=False):
     module_dir = os.path.dirname(os.path.abspath(__file__))
     with open(os.path.join(module_dir, "QiminGWVaspInputSet.json")) as f:
         DictVaspInputSet.__init__(
             self, "Qimin GW", json.load(f),
             constrain_total_magmom=constrain_total_magmom)
     if user_incar_settings:
         self.incar_settings.update(user_incar_settings)
예제 #3
0
 def __init__(self, structure, spec, functional='PBE', sym_prec=0.01, **kwargs):
     """
     Supports the same kwargs as :class:`JSONVaspInputSet`.
     """
     with open(GWVaspInputSet) as f:
         DictVaspInputSet.__init__(
             self, "MP Static Self consistent run for GW", json.load(f), **kwargs)
     self.structure = structure
     self.tests = self.__class__.get_defaults_tests()
     self.convs = self.__class__.get_defaults_convs()
     self.functional = functional
     self.set_dens(spec)
     self.sym_prec = sym_prec
예제 #4
0
 def __init__(self, structure, spec, functional='PBE', sym_prec=0.01, **kwargs):
     """
     Supports the same kwargs as :class:`JSONVaspInputSet`.
     """
     with open(os.path.join(MODULE_DIR, "GWVaspInputSet.json")) as f:
         DictVaspInputSet.__init__(
             self, "MP Static Self consistent run for GW", json.load(f), **kwargs)
     self.structure = structure
     self.tests = self.__class__.get_defaults_tests()
     self.convs = self.__class__.get_defaults_convs()
     self.functional = functional
     self.set_dens(spec)
     self.sym_prec = sym_prec
예제 #5
0
    def get_vasp_input_set(self, date_string=None):
        """
        Returns the VaspInputSet used by the Materials Project at a
        particular date.

        Args:
            date_string:
                A date string in the format of "YYYY-MM-DD". Defaults to
                None, which means the VaspInputSet today.

        Returns:
            DictVaspInputSet
        """
        url = "{}/parameters/vasp".format(self.preamble)
        payload = {"date": date_string} if date_string else {}
        try:
            response = self.session.get(url, data=payload)
            if response.status_code in [200, 400]:
                data = json.loads(response.text, cls=PMGJSONDecoder)
                if data["valid_response"]:
                    if data.get("warning"):
                        warnings.warn(data["warning"])
                    return DictVaspInputSet("MPVaspInputSet", data["response"])
                else:
                    raise MPRestError(data["error"])

            raise MPRestError(
                "REST query returned with error status code {}".format(
                    response.status_code))
        except Exception as ex:
            raise MPRestError(str(ex))
예제 #6
0
 def __init__(self, structure, spec, functional='PBE', sym_prec=0.01, **kwargs):
     """
     Supports the same kwargs as :class:`JSONVaspInputSet`.
     """
     with open(GWVaspInputSet) as f:
         DictVaspInputSet.__init__(
             self, "MP Static exact diagonalization", json.load(f), **kwargs)
     self.structure = structure
     self.tests = self.__class__.get_defaults_tests()
     self.convs = self.__class__.get_defaults_convs()
     self.functional = functional
     self.sym_prec = sym_prec
     self.set_dens(spec)
     npar = self.get_npar(self.structure)
     #single step exact diagonalization, output WAVEDER
     self.incar_settings.update({"ALGO": "Exact", "NELM": 1, "LOPTICS": "TRUE"})
     # for large systems exact diagonalization consumes too much memory
     self.set_gw_bands(15)
     self.incar_settings.update({"NPAR": npar})
예제 #7
0
 def __init__(self, structure, spec, functional='PBE', sym_prec=0.01, **kwargs):
     """
     Supports the same kwargs as :class:`JSONVaspInputSet`.
     """
     with open(os.path.join(MODULE_DIR, "GWVaspInputSet.json")) as f:
         DictVaspInputSet.__init__(
             self, "MP Static exact diagonalization", json.load(f), **kwargs)
     self.structure = structure
     self.tests = self.__class__.get_defaults_tests()
     self.convs = self.__class__.get_defaults_convs()
     self.functional = functional
     self.sym_prec = sym_prec
     self.set_dens(spec)
     npar = self.get_npar(self.structure)
     #single step exact diagonalization, output WAVEDER
     self.incar_settings.update({"ALGO": "Exact", "NELM": 1, "LOPTICS": "TRUE"})
     # for large systems exact diagonalization consumes too much memory
     self.set_gw_bands(15)
     self.incar_settings.update({"NPAR": npar})
예제 #8
0
 def __init__(self, structure, spec, functional='PBE', sym_prec=0.01, **kwargs):
     """
     Supports the same kwargs as :class:`JSONVaspInputSet`.
     """
     with open(GWVaspInputSet) as f:
         DictVaspInputSet.__init__(
             self, "MP Static G0W0", json.load(f), **kwargs)
     self.structure = structure
     self.tests = self.__class__.get_defaults_tests()
     self.convs = self.__class__.get_defaults_convs()
     self.functional = functional
     self.sym_prec = sym_prec
     npar = self.get_npar(structure)
     # G0W0 calculation with reduced cutoff for the response function
     self.incar_settings.update({"ALGO": "GW0", "ENCUTGW": 250, "LWAVE": "FALSE", "NELM": 1})
     self.set_dens(spec)
     self.nomega_max = 2 * self.get_kpoints(structure).kpts[0][0]**3
     nomega = npar * int(self.nomega_max / npar)
     self.set_gw_bands(15)
     self.incar_settings.update({"NPAR": npar})
     self.incar_settings.update({"NOMEGA": nomega})
     self.tests = self.__class__.get_defaults_tests()
예제 #9
0
 def __init__(self, structure, spec, functional='PBE', sym_prec=0.01, **kwargs):
     """
     Supports the same kwargs as :class:`JSONVaspInputSet`.
     """
     with open(os.path.join(MODULE_DIR, "GWVaspInputSet.json")) as f:
         DictVaspInputSet.__init__(
             self, "MP Static G0W0", json.load(f), **kwargs)
     self.structure = structure
     self.tests = self.__class__.get_defaults_tests()
     self.convs = self.__class__.get_defaults_convs()
     self.functional = functional
     self.sym_prec = sym_prec
     npar = self.get_npar(structure)
     # G0W0 calculation with reduced cutoff for the response function
     self.incar_settings.update({"ALGO": "GW0", "ENCUTGW": 250, "LWAVE": "FALSE", "NELM": 1})
     self.set_dens(spec)
     self.nomega_max = 2 * self.get_kpoints(structure).kpts[0][0]**3
     nomega = npar * int(self.nomega_max / npar)
     self.set_gw_bands(15)
     self.incar_settings.update({"NPAR": npar})
     self.incar_settings.update({"NOMEGA": nomega})
     self.tests = self.__class__.get_defaults_tests()