def setUp(self): if "VASP_PSP_DIR" not in os.environ: os.environ["VASP_PSP_DIR"] = test_dir filepath = os.path.join(test_dir, 'POSCAR') poscar = Poscar.from_file(filepath) self.struct = poscar.structure self.mitparamset = MITVaspInputSet() self.mitparamset_unsorted = MITVaspInputSet(sort_structure=False) self.mithseparamset = MITHSEVaspInputSet() self.paramset = MPVaspInputSet() self.userparamset = MPVaspInputSet( user_incar_settings={'MAGMOM': { "Fe": 10, "S": -5, "Mn3+": 100 }}) self.mitggaparam = MITGGAVaspInputSet() self.mpstaticparamset = MPStaticVaspInputSet() self.mpnscfparamsetu = MPNonSCFVaspInputSet({"NBANDS": 50}, mode="Uniform") self.mpnscfparamsetl = MPNonSCFVaspInputSet({"NBANDS": 60}, mode="Line") self.mphseparamset = MPHSEVaspInputSet() self.mpbshseparamsetl = MPBSHSEVaspInputSet(mode="Line") self.mpbshseparamsetu = MPBSHSEVaspInputSet( mode="Uniform", added_kpoints=[[0.5, 0.5, 0.0]]) self.mpdielparamset = MPStaticDielectricDFPTVaspInputSet()
def get_INCARs(comp_name, mp_api_key, SOC): from pymatgen.matproj.rest import MPRester matproj = MPRester(mp_api_key) structure = matproj.get_structure_by_material_id(comp_name) from pymatgen.io.vasp.sets import MPVaspInputSet from pymatgen.io.vasp.sets import MPGGAVaspInputSet # +U is turned off (if any) from pymatgen.io.vasp.sets import MPHSEVaspInputSet from pymatgen.io.vasp.sets import MPStaticVaspInputSet from pymatgen.io.vasp.sets import MPNonSCFVaspInputSet from pymatgen.io.vasp.sets import MPStaticDielectricDFPTVaspInputSet from pymatgen.io.vasp.sets import MPBSHSEVaspInputSet from pymatgen.io.vasp.sets import MPOpticsNonSCFVaspInputSet v = MPVaspInputSet() indic = v.get_incar(structure) k = v.get_all_vasp_input(structure, generate_potcar=False) incar_file = open('INCAR', 'w') # if SOC in ['TRUE', 'True', 'true']: # indic['LMAXMIX'] = 4 # indic['NBANDS'] = soc_NBANDS # indic['LSORBIT'] = '.TRUE.' # indic.pop('MAGMOM', None) incar_file.write(str(indic)) self = MPStaticVaspInputSet() indic = self.get_incar(structure) indic['NEDOS'] = 9001 incar_file = open('INCAR_SELF', 'w') if SOC in ['TRUE', 'True', 'true']: indic['LMAXMIX'] = 4 indic['NBANDS'] = soc_NBANDS indic['LSORBIT'] = '.TRUE.' indic.pop('MAGMOM', None) incar_file.write(str(indic)) user_incar_settings = {"NBANDS": 100} nself = MPNonSCFVaspInputSet(user_incar_settings) indic = nself.get_incar(structure) incar_file = open('INCAR_NSELF', 'w') if SOC in ['TRUE', 'True', 'true']: indic['LMAXMIX'] = 4 indic['NBANDS'] = soc_NBANDS indic['LSORBIT'] = '.TRUE.' indic.pop('MAGMOM', None) incar_file.write(str(indic)) HSE = MPHSEVaspInputSet() indic = HSE.get_incar(structure) incar_file = open('INCAR_HSE', 'w') if SOC in ['TRUE', 'True', 'true']: indic['LMAXMIX'] = 4 indic['NBANDS'] = soc_NBANDS indic['LSORBIT'] = '.TRUE.' indic.pop('MAGMOM', None) incar_file.write(str(indic))