Esempio n. 1
0
 def __init__(self, name, incar, poscar, potcar, kpoints,
              qadapter=None, **kwargs ):
     """
     default INCAR from config_dict
     
     """
     self.name = name
     self.incar = Incar.from_dict(incar.as_dict())
     self.poscar = Poscar.from_dict(poscar.as_dict())
     self.potcar = Potcar.from_dict(potcar.as_dict())
     self.kpoints = Kpoints.from_dict(kpoints.as_dict())
     self.extra = kwargs
     if qadapter is not None:
         self.qadapter = qadapter.from_dict(qadapter.to_dict())
     else:
         self.qadapter = None        
     config_dict = {}
     config_dict['INCAR'] = self.incar.as_dict()
     config_dict['POSCAR'] = self.poscar.as_dict() 
     #caution the key and the value are not always the same        
     config_dict['POTCAR'] = self.potcar.as_dict() 
     #dict(zip(self.potcar.as_dict()['symbols'],
     #self.potcar.as_dict()['symbols']))
     config_dict['KPOINTS'] = self.kpoints.as_dict()
     #self.user_incar_settings = self.incar.as_dict()        
     DictVaspInputSet.__init__(self, name, config_dict,
                                ediff_per_atom=False, **kwargs)
Esempio n. 2
0
 def __init__(self, name, incar, poscar, potcar, kpoints,
              qadapter=None, script_name='submit_script',
              vis_logger=None, **kwargs):
     """
     default INCAR from config_dict
     
     """
     self.name = name
     self.incar = Incar.from_dict(incar.as_dict())
     self.poscar = Poscar.from_dict(poscar.as_dict())
     self.potcar = Potcar.from_dict(potcar.as_dict())
     self.kpoints = Kpoints.from_dict(kpoints.as_dict())
     self.extra = kwargs
     if qadapter is not None:
         self.qadapter = qadapter.from_dict(qadapter.to_dict())
     else:
         self.qadapter = None
     self.script_name = script_name
     config_dict = {}
     config_dict['INCAR'] = self.incar.as_dict()
     config_dict['POSCAR'] = self.poscar.as_dict()
     # caution the key and the value are not always the same
     config_dict['POTCAR'] = self.potcar.as_dict()
     # dict(zip(self.potcar.as_dict()['symbols'],
     # self.potcar.as_dict()['symbols']))
     config_dict['KPOINTS'] = self.kpoints.as_dict()
     # self.user_incar_settings = self.incar.as_dict()
     DictVaspInputSet.__init__(self, name, config_dict,
                               ediff_per_atom=False, **kwargs)
     if vis_logger:
         self.logger = vis_logger
     else:
         self.logger = logger
Esempio n. 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
Esempio n. 4
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 (str): 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=MPDecoder)
                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))
Esempio n. 5
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})
Esempio n. 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 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()