def generate(q=0,runtype='relax',functional='PBE',soc=False,relaxcell=False): """ Generate INCAR file. Parameters ---------- [optional] q (int): net charge of system. Default=0. [optional] runtype (str): type of calculation: relax(default)/dos/bands/dielectric [optional] functional (str): type of functional: PBE(default)/SCAN+rVV10 [optional] soc (bool): to include spin-orbit coupling? Default=False. [optional] relaxcell (bool): to relax cell lattice parameters? Default=Fase. """ dir_sub = os.getcwd() poscar = Poscar.from_file(os.path.join(dir_sub,"POSCAR")) potcar = Potcar.from_file(os.path.join(dir_sub,"POTCAR")) wavecar = os.path.exists(os.path.join(dir_sub,"WAVECAR")) ## just a boolean (does file exist) chgcar = os.path.exists(os.path.join(dir_sub,"CHGCAR")) ## just a boolean (does file exist) inc = IncarSettings(functional.split("+"),runtype,int(q),poscar,potcar,wavecar,chgcar) inc.setparams() if soc: inc.mag(ncl=True) inc.soc() if relaxcell: inc.ionicrelax(isif=3) inc.parallel(ncore=1) inc.output(lcharg=True) if runtype == 'dielectric': inc.dielectric() inc.startup(isym=None) inc.parallel(ncore=None) inc.output(lvtot=None,lvhar=None) inc.stripNone() with open(os.path.join(dir_sub,"INCAR"),'w') as f: f.write(Incar.get_string(inc.params,sort_keys=False))
# dir_sub = dir_sub+"dos/" poscar = Poscar.from_file(os.path.join(dir_sub,"POSCAR")) potcar = Potcar.from_file(os.path.join(dir_sub,"POTCAR")) wavecar = os.path.exists(os.path.join(dir_sub,"WAVECAR")) ## just a boolean (does file exist) chgcar = os.path.exists(os.path.join(dir_sub,"CHGCAR")) ## just a boolean (does file exist) inc = IncarSettings(args.functional.split("+"),args.runtype,args.q,poscar,potcar,wavecar,chgcar) inc.setparams() if args.soc: inc.mag(ncl=True) inc.soc() inc.stripNone() with open(os.path.join(dir_sub,"INCAR"),'w') as f: f.write(Incar.get_string(inc.params,sort_keys=False)) # func = "PBE" ## func = ["SCAN","rVV10"] # if type(func) is not list: # func = [func] ## runtype = "relax" ## runtype = "dos" # runtype = "bands" # ## dir_main = "mp-2815_MoS2/" ## dir_main = "Y:/MoS2/monolayer_Nbsub/SCAN_vdW/mag/" # dir_main = "Y:/WSe2/monolayer/GGA/mag/" # # for q in [-2]: