!! *** Note that some INCAR tags (ISMEAR, ISTART, ICHARG, etc.) are duplicated in the following example *** !! !-- always necessary --! ENCUT = 550.0 ! eV, ENMAX*1.3 for structural opt. ISMEAR = -5 ! 0: Gaussian, 1: MP, -5: tetrahedron ! SIGMA = 0.1 ! eV, specify this for ISMEAR=0,1. 0.1--0.2 eV. !-- calculation modes --! !! structural opt. ! NSW = 50 ! IBRION = 2 ! ISIF = 3 ! 2: fixed lattice & relax ions, 3: all opt ! EDIFFG = 0 ! +:Energy diff, -:Force, 0:stop after NSW iterations ! PSTRESS = 10.0 ! pressure in kB !! band calc. ! ISTART = 0 ! SCF orbitals are not used ! ICHARG = 11 ! SCF charge density is used (fixed) ! ISMEAR = 0 ! tetrahedron does not work for band calc. ! SIGMA = 0.1 !! input tags for LDOS calc. are shown later !-- functionals --! GGA = PE ! VOSKOWN = 1 ! when using PW91 !! HSE06. initial GGA (PBE) run is recommended before HSE calc. ! LHFCALC = .TRUE. ! HFSCREEN = 0.2 ! ICHARG = 0 ! restart from PBE orbitals ! ISTART = 1 ! restart from PBE orbitals ! PRECFOCK = Fast ! (optional) accuracy and speed control. For old versions, ENCUTFOCK = 0. ! NKRED = 2 ! (optional) lower accuracy but fast. Instead, NKREDX,NKREDY,NKREDZ can be used. !! +U parameter ! LDAU = .TRUE. ! LDAUTYPE = 2 ! LDAUL = -1 2 -1 ! l-quantum number (-1:noU, 2:d, 3:f) ! LDAUU = 0.0 5.0 0.0 ! U values (eV) ! LDAUJ = 0.0 0.0 0.0 ! J values (For LDAUTYPE=2, Ueff=U-J) ! LMAXMIX = 4 ! 4 for d-electrons, 6 for f-electrons. ! LDAUPRINT = 2 !-- spin (incl. spin-orbit coupling) --! !! no spin pol. & no SOC ISPIN = 1 !! spin pol. & no SOC ! ISPIN = 2 ! ISYM = -1 ! LSORBIT = .FALSE. ! LNONCOLLINEAR = .FALSE. ! ICHARG = 2 ! set ICHARG=2 to use MAGMOM ! MAGMOM = 5*0.0 ! scalar, 5 atoms !! SOC calc (vasp_ncl) ! ISPIN = 2 ! ISYM = -1 ! LSORBIT = .TRUE. ! LNONCOLLINEAR = .TRUE. ! SAXIS = 0 0 1 ! quantization axis ! LORBMOM = .TRUE. !! (case 1) SOC calc using vasp_ncl after non-SOC (but spin-polarized) calc using vasp_std (i.e. use non-SOC orbitals as initial guess) ! ISTART = 1 ! NBANDS = 100 ! (NBANDS in non-SOC run) x 2. see OUTCAR in non-SOC run. (not INCAR because NBANDS can be changed by vasp run) !! (case 2) SOC calc without initial orbitals ! ICHARG = 2 ! set ICHARG=2 to use MAGMOM ! MAGMOM = 15*0.0 ! spinor, 5 atoms. !-- accuracy settings (usually no need to change) --! EDIFF = 1E-8 ! can be a larger value LREAL = .FALSE. ! LREAL = Auto is recommended for a large system (to reduce cost) ADDGRID = .TRUE. ! improves accuracy but can result in (small) negative density in real space. ADDGRID = .FALSE. is default GGA_COMPAT = .FALSE. PREC = Accurate LASPH = .TRUE. !! *** other tags *** !! !! output: ldos, band weight, local magnetic moment, etc. LORBIT = 11 ! optional but recommended !! parallelization control (optional) ! NPAR = 32 ! (default: no. of cores) band parallelization ! NCORE = 32 ! (default: 1) plane-wave parallelization ! KPAR = 1 ! (default: 1) k-point parallelization, not available in old versions !! to improve convergence (e.g. for magnetic systems, SOCcalc,...) ! ALGO = A ! CG method (default: blocked Davidson). For metal: ALGO=D with an appropriate TIME is recommended. ! AMIX = 0.1 ! BMIX = 0.00001 ! AMIX_MAG = 0.2 ! BMIX_MAG = 0.00001 !! wannier !! First run: get orbitals with parallelization, Second run: restart with ISTART=1 and NPAR=N (NCORE should be 1) !! First & Second runs ! ISYM = -1 ! NBANDS = 200 ! sufficiently large value to get unoccupied bands for wannierization !! Second run ! ISTART = 1 ! NELMIN = 6 ! set a large value (5--10) to get well-converged unoccupied bands ! LWANNIER90 = .TRUE. ! LWANNIER90_RUN = .TRUE. ! LWRITE_MMN_AMN = .TRUE. !! LDOS (LORBIT=11 necessary) !! assuming LDOS calc using a fine k-mesh after an SCF run ! ISYM = -1 ! NPAR = 1 ! version-dependent. see VASPwiki. ! ISTART = 0 ! ICHARG = 11 ! use an SCF charge density ! ISMEAR = -5 ! tetrahedron recommended ! SIGMA = 0.05 ! NEDOS = 3000 ! EMIN = -0.5 ! EMAX = 14.5 !! charged-state calc. ! NELECT = 1224 !! static dielectric properties ! ISMEAR = 0 ! SIGMA = 0.01 ! LEPSILON = .TRUE. !! alternatively LCALCEPS=.TRUE. can be used (e.g. for hybrid functionals) ! LPEAD = .TRUE. ! IBRION = 8 ! LRPA = .FALSE. !! .TRUE.: the local field effect is calculated at the Hartree level only
为了成功运行VASP计算任务，我们至少需要4个文件：INCAR、POSCAR、POTCAR及KPOINTS，INCAR是告诉 VASP算什么任务，怎么算的控制文件；POSCAR是包含晶格信息，原子坐标信息和原子速度信息（MD用）的文件；POTCAR是赝势文件，也就是将内层电子用势函数表示；KPOINTS（可包含在INCAR内，不推荐省略）包含了倒易空间内K点信息，波函数会在这些点上积分得到电荷密度。 vaspkit将KPOINTS、POTCAR和INCAR文件生成整合到了功能1：VASP Input Files Generator中。 ==================== VASP Input Files Options =================== 101) Customize INCAR File 102) Generate KPOINTS File for SCF Calculation 103) Generate POTCAR File with Default Setting 104) Generate POTCAR File with User Specified Potential 105) Generate POSCAR File from cif (no fractional occupations) 106) Generate POSCAR File from Material Studio xsd (retain fixes) 107) Reformat POSCAR File in Specified Order of Elements 108) Successive Procedure to Generate VASP Files and Check 109) Submit Job Queue 下面展示怎么使用vaspkit进行一个VASP计算任务。 POSCAR一般由软件生成或者从数据库中获得，简单体系可自己搭建。本例中从数据库（http://www.catalysthub.net/）中获得**纤锌矿ZnO**的POSCAR文件（也可以下载CIF文件，然后通过`VTST`脚本`cif2pos.pl`或者`VESTA`转化成POSCAR文件，只是原子位置分数占据的问题需要注意）。在`catalysthub`中检索`ZnO`，检索结果如下所示。纤锌矿ZnO的为六方晶系，空间群为`P63mc`。因此下载第二行的POSCAR，下载的文件名为`ZnO-1811117.vasp`。置于`vaspkit.0.72/examples/ZnO_optimization`目录下。 The following shows the results (4) for: ZnO Full formula Space group HM HALL Lattice system Band gap Structure file Zn1O1 216 F-43m F -4 2 3 Cubic 0.63110 eV CIF | POSCAR | LAMMPS Zn2O2 186 P63mc P 6c -2c Hexagonal 0.73170 eV CIF | POSCAR | LAMMPS Zn1O1 225 Fm-3m -F 4 2 3 Cubic 0.71940 eV CIF | POSCAR | LAMMPS Zn1O1 221 Pm-3m -P 4 2 3 Cubic 0.00000 eV CIF | POSCAR | LAMMPS 接下来进行晶格优化得到合理的结构。将其改名为POSCAR文件。 cp -f ZnO-1811117.vasp POSCAR 我们采用vaspkit预设的INCAR组合生成所需的INCAR文件。在有POSCAR的目录下运行vaspkit,输入1选择功能VASP Input Files Generator，然后输入101选择Customize INCAR File，会得到以下的显示信息： +-------------------------- Warm Tips --------------------------+ You MUST Know What You Are Doing Some Parameters in INCAR File Neet To Be Set/Adjusted Manually +---------------------------------------------------------------+ ======================== INCAR Options ========================== ST) Static-Calculation SR) Standard Relaxation MG) Magnetic Properties SO) Spin-Orbit Coupling D3) DFT-D3 no-damping Correction H6) HSE06 Calculation PU) DFT+U Calculation MD) Molecular Dynamics GW) GW0 Calculation BS) BSE Calculation DC) Elastic Constant EL) ELF Calculation BD) Bader Charge Analysis OP) Optical Properties EC) Static Dielectric Constant PC) Decomposed Charge Density FD) Phonon-Finite-Displacement DT) Phonon-DFPT NE) Nudged Elastic Band (NEB) DM) The Dimer Method FQ) Frequence Calculations LR) Lattice Relaxation 0) Quit 9) Back ------------>> Input Key-Parameters (STH6D2 means HSE06-D2 Static-Calcualtion) LR 输入LR，就会得到一个预设好的用于做晶格弛豫任务的INCAR（有些模板需要手动修改。比如DFT+U的U值设定，NEB的IMAGES数目等）。如果已经有INCAR文件，则原来的INCAR文件会被覆盖。你可以编辑~/.vaspkit更改INCAR的输出设置。只需将最后一行的SET_INCAR_WRITE_MODE由默认的OVERRIDE更改为 APPEND,BACK-UP-OLD,BACK-UP-NEW中的一个，分别对应于新的内容增加到原有的INCAR后面，备份原有的INCAR再写入新的INCAR和写入到新的INCAR.new里面。 接下来生成KPOINTS文件。对于非能带计算，只需用程序自动撒点的方式，但是需要用户选择撒点方式和K点密度。具体内容可以参考李强的教程Learn VASP The Hard Way （Ex1）: VASP基本输入文件的准备。启动vaspkit,输入1选择功能VASP Input Files Generator，然后输入102选择功能Generate KPOINTS File for SCF Calculation，接下来输入2选择Gamma Scheme撒点方式（稳妥的选择），会得到以下的显示信息： -->> (1) Reading Lattices & Atomic-Positions from POSCAR File... +-------------------------- Warm Tips --------------------------+ * Accuracy Levels: (1) Low: 0.06~0.04; (2) Medium: 0.04~0.03; (3) Fine: 0.02-0.01. (4) Gamma-Only: 0. * 0.04 is Generally Precise Enough! +---------------------------------------------------------------+ Input KP-Resolved Value (unit: 2*PI/Angstrom): ------------>> 根据提示0.04已经足够精确了，因此输入0.04，将会得在当前目录下得到KPOINTS和POTCAR(自动生成)文件。 -->> (2) Written KPOINTS File! -->> (3) Written POTCAR File with the Recommended Potential! KPOINTS内容如下： K-Mesh Generated with KP-Resolved Value : 0.040 0 Gamma 9 9 5 0.0 0.0 0.0 Learn VASP The Hard Way Ex19 谁偷走的我的机时？（三）提到了一个简单的K点数目判断准则，对于半导体k点数目乘实空间对应晶矢量大于20Å（参考下图），本例中ka=29.62Å已经符合经验规律。刘锦程提到对于非正交体系 ，倒格矢长度和晶常数不满足反比关系，所以采用ka≈kb≈kc的经验准则并不能保证 K点密度在各个方向长相等。而vaspkit严格计算了倒空间晶格矢量比例，选用经验“步长”（倒空间长度除以K点数目）0.03~0.04，vaspkit就能根据所选的K点密度自动生成各个方向的K点数，此时倒空间K点的resolution 为2\pi\cdot0.04 \AA^{-1}. 生成KPOINTS的同时，会根据POSCAR中的元素类型从赝势库中提取并组合生成POTCAR，前提是你在~/.vaspkit里正确设置了PBE_PATH的路径，并根据POTCAR_TYPE选择是生成GGA-PW91、LDA还是PBE的赝势。值得注意的是提示信息Written POTCAR File with the Recommended Potential!，意味着vaspkit根据VASP官网的推荐从PBE的赝势库中选择赝势。 PBE的赝势分为几种，无后缀、_pv,_sv,_d 和数字后缀，_pv,_sv,_d 就是说semi-core的p,s或者d也当做价态处理了。因为有些情况下，次外层电子也参与了成键。刘锦程提到进行Bader电荷分析，需要采用带_pv,_sv的赝势。特别地，官网提到Important Note: If dimers with short bonds are present in the compound (O2 , CO, N2 , F2 , P2 , S2 , Cl2 ), we recommend to use the _h potentials. Specifically, C_h, O_h, N_h, F_h, P_h, S_h, Cl_h.常用的做法是：用两种赝势测试一下对自己所关心的问题的影响情况。在影响不大的情况下，选用不含后缀的赝势，毕竟包含更多的价电子，截断能上升很多，计算量明显增大。 如果需要手动生成POTCAR，可以通过功能104手动选择每个元素的赝势类型。本例中演示给Zn选择Zn_pv的PBE赝势。选择功能104，依次输入需要设定的赝势类型O和Zn_pv，如果设定的赝势目录下没有你选择的赝势类型，将会提示你重新输入。 -->> (1) Reading Structural Parameters from POSCAR File... Auto detected POTCAR_TYPE is O, please type the one you want! O Auto detected POTCAR_TYPE is Zn, please type the one you want! Zn_pv -->> (2) Written POTCAR File with user specified Potential! 通过命令grep TIT POTCAR可以看到POTCAR中的赝势为O和Zn_pv，满足我们的需求。 为了取得有意义的结果，需要满足INCAR中的ENCUT大于POTCAR中的所有元素的ENMAX。通过以下命令可以查看所有元素的ENMAX： grep ENMAX POTCAR 可以看到默认的INCAR参数中ENCUT=400eV被注释掉了，但是保留了PREC = Normal，程序会自动将ENCUT设为max(ENMAX)。当然也可以自行设置ENCUT参数，只要参数大于所有元素的ENMAX，这时候以自己设定的ENCUT参数为准。注意在优化晶胞常数时，需要用较高的ENCUT（Learn VASP The Hard Way （Ex36）：直接优化晶格常数），因此LR任务（优化晶格常数）模板生成的INCAR中默认设置了PREC=High，VASP程序会自动将ENCUT设为max(ENMAX)*1.3。乐平老师提到，为了确保相同体系的ENCUT一致，VASP最新的官方手册已经不推荐使用PREC=High了，它推荐设置为PREC=Accurate并手动设置ENCUT的值。 提交VASP计算任务，可以发现任务很快就失败了。错误日志如下： running on 16 total cores distrk: each k-point on 16 cores, 1 groups distr: one band on 1 cores, 16 groups using from now: INCAR vasp.5.4.4.18Apr17-6-g9f103f2a35 (build Apr 07 2018 02:38:49) complex POSCAR found type information on POSCAR O ERROR: the type information is not consistent with the number of types 通过分析发现，VASP只读出了O的元素和赝势，Zn没有从POSCAR中读出，因此报错。原因在于，从数据库下载的POSCAR中空格的分隔符是制表符\t，VASP不能正确读出以\t为分隔符的字符串。同样的问题也会在INCAR中出现。另外在WINDOWS系统下生成的POSCAR或INCAR在VASP中可能会出现非常奇怪的错误。最致命的是VASP不会自动检查POSCAR中的元素类型是否与POTCAR元素类型是否一致，也就是你算石墨烯也可以用H的赝势，并不会报错，但是结果一定是错的！因此vaspkit 0.71以后的版本加入了格式纠正和赝势元素检查的功能109。 输入109,vaspkit会自动进行INCAR和POSCAR的格式纠正，并检查赝势元素是否一致。 -->> (1) Reading Structural Parameters from POSCAR File... All Files Needed Exist. Element type in POSCAR may be not corresponding to POTCAR POTCAR:Zn_pv POSCAR:Zn 执行检查之后，再次提交任务。此时任务已经能正确运行。 为了方便用户，在乐平老师的建议下，我们设置了功能108：Successive procedure to generate VASP files and check。先设置INCAR，再设置K点密度，生成KPOINTS和POTCAR，最后再调用功能109自动检查所有的文件是否存在问题。我们的目标是，VASP之前，先KIT一下。 如果您使用VASPKIT，请记得引用哦。 V. Wang, N. Xu, J.-C. Liu, G. Tang, W.-T. Geng, VASPKIT: A User-Friendly Interface Facilitating High-Throughput Computing and Analysis Using VASP Code, Computer Physics Communications 267, 108033, (2021), https://doi.org/10.1016/j.cpc.2021.108033