跳至主要內容

准备 VASP 的输入文件

Northword大约 7 分钟VASP

准备 VASP 的输入文件

输入文件包括 POSCAR、INCAR、KPOINTS、POTCAR。注意大小写,因为 linux 是严格区分大小写的系统。

该页以对 O2 分子进行结构优化为例,说明 VASP 输入文件的生成步骤。


VASPKIT 生成输入文件的选项

VASPKIT 可以帮助我们简化准备输入文件的步骤,可以先看下 VASPKIT 提供了哪些可以生成输入文件的工具:

[zjb@op O2_opt]$ vaspkit
 
            \\\///         
           / _  _ \       Hey, you must know what you are doing.  
         (| (.)(.) |)     Otherwise you might get wrong results!  
 +-----.OOOo--()--oOOO.------------------------------------------+
 |             VASPKIT Version: 1.12 (01 Mar. 2020)              |
 |        Core Developer: Vei WANG (wangvei@icloud.com)          |
 |     Main Contributors: Nan XU, Jin-Cheng LIU & Gang TANG      |
 |    Please send Bugs and Suggestions to vaspkit@gmail.com      |
 +-----.oooO-----------------------------------------------------+
        (   )   Oooo.     
         \ (    (   )     
          \_)    ) /      
                (_/       
 ===================== Structural Options ========================
 1)  VASP Input Files Generator    2)  Elastic-Properties         
 3)  K-Path Generator              4)  Structure Editor           
 5)  Catalysis-ElectroChem Kit     6)  Symmetry Search            
 
 ===================== Electronic Options ========================
 11) Density-of-States             21) DFT Band-Structure         
 23) 3D Band-Structure             25) Hybrid-DFT Band-Structure  
 26) Fermi-Surface                 28) Band-Structure Unfolding   
 
 =========== Charge & Potential & Wavefunction Options ===========
 31) Charge & Spin Density         42) Potential-Related          
 51) Wave-Function Analysis  
 ====================== Misc Utilities ===========================
 71) Optical-Properties            72) Molecular-Dynamics Kit 
 73) VASP2other Interface          74) USER interface
 91) Semiconductor Calculator      92) 2D-Materials Kit       
                                                                  
 0)  Quit                                                         
 ------------>>

选择 1) VASP Input Files Generator

------------>>
1
 ==================== 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) Check All VASP Files                                        
                                                                  
 0)   Quit                                                        
 9)   Back                                                        
 ------------>>

上面 101-106 都可以生成输入文件,然后就可以根据需求去选择了。


POSCAR

POSCAR 文件可以自己写入,也可以通过 Materials Studio 建模后转换格式,还可以从一些结构网站获取结构。

方法 1:通过新建 POSCAR 文件并手动写入内容

vi POSCAR

方法 2:通过 Materials Studio 建模以生成 POSCAR

在 MS 中建模完成后,有如下几种方式将其转换为 POSCAR

2.1. 使用 VASPKIT 的 cif2pos.py

从 MS 建模完成后导出为 cif 文件:file-exportsave as type : .cif,上传到集群上,使用 vaspkit-1-105) Generate POSCAR File from cif (no fractional occupations)

  ------------>>
 105
  Please type in the filename of cif->
 NaCl_import.cif           # 在这里输入了.cif文件的文件名
 Pleas input the order of element, `ENTER` for default!
 Example: 'NA CL' in this CIF
                           #在这里需要输入元素的顺序,通常可以按回车使用默认值
   -->> (01) POSCAR has been generated...
  +---------------------------------------------------------------+
  |                       * ACKNOWLEDGMENTS *                     |
  | Other Contributors: Xue-Fei LIU, Peng-Fei LIU, Dao-Xiong WU,  |
  | Zhao-Fu ZHANG, Tian WANG, Ya-Chao LIU, Qiang LI, iGo and You! |
  +---------------------------------------------------------------+
  |                          * CITATIONS *                        |
  | We Would Appreciate if You Cite in Your Research with VASPKIT.|
  | [1] V. Wang, N. Xu, J.C. LIU, G. Tang, et al, VASPKIT: A Pre- |
  | and Post-Processing Program for VASP Code, arXiv:1908.08269.  |
  +---------------------------------------------------------------+
 [zjb@op NaCl]$ 
 



 


 













在第 4 行,会要求你输入 .cif 文件的文件名。在第 7 行,会要求你输入 元素的种类,如果第 6 行提示的正确,可以回车使用默认。

2.2. 使用 VESTA 转换

从 MS 建模完成后导出为 cif 文件:file-export-.cif,用 VESTA 打开该 cif 文件,选择 file-export datasave as : xxx.vasp。将 xxx.vasp 文件上传到服务器,将其重命名为 POSCARcp xxx.vasp POSCAR

2.3. 使用 vaspkit 的 xsd2pos.py

从 MS 建模完成后导出为 xsd 文件,上传,使用 vaspkit-1)VASP Input Files Generator-106) Generate POSCAR File from Material Studio xsd (retain fixes).

另外值得一提的是,通过 xsd2pos 可以保留原子的位置限制信息,而上面两种导出为 .cif 的方式会丢失原子固定。

Material Studio 是常用的构建模型和可视化结构的软件,MS 中的结构亦可借助其它工具转换成 POSCAR。目前常用的做法是在 MS 中导出 cif 文件,再通过功能 105 或者 vesta 转换成 POSCAR。但是转换颇为麻烦并且会丢失原子的位置限制信息。因此赵焱老师开发了固定原子坐标 perl 小脚本 xsd2pos.plopen in new window ,可以在MS中运行perl脚本将结构生成POSCAR,链接里有详细的操作流程,这里不再赘述。vaspkit开发者也开发了一款类似的后处理脚本,能够将含有位置固定信息的xsd批量转换成·POSCAR,并将此脚本集成到了vaspkit106功能中。xsd中可以包含Fix Fractional Position或者Fix Cartesian Position两种限制方式。

引自 VASPKIT 中文手册open in new window

方法 3:从结构网站获取

从诸如 Materials Projectopen in new window 等网站获取结构,通常获取到的是.vasp文件,将其上传,重命名为POSCAR即可。

值得一提的是 VASPKIT 官方文档提到,有时候下载到的 .vasp 文件,里面会有制表符与空格的问题,最好通过 109) Check All VASP Files 检查一下,以免计算失败。

INCAR

VASPKIT 选择 101,然后选择 INCAR 选项,就生成了 INCAR 文件

 ------------>>
101
 +-------------------------- 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 (STH6D3 means HSE06-D3 Static-Calcualtion)

根据计算需要,选择相应类型的选项,如结构优化标准弛豫:

SR
 INCAR parameters are from user-specified Global.
 INCAR parameters are from user-specified SR.
  -->> (01) Written INCAR file!
 +---------------------------------------------------------------+
 |                       * ACKNOWLEDGMENTS *                     |
 | Other Contributors: Xue-Fei LIU, Peng-Fei LIU, Dao-Xiong WU,  |
 | Zhao-Fu ZHANG, Tian WANG, Ya-Chao LIU, Qiang LI, iGo and You! |
 +---------------------------------------------------------------+
 |                          * CITATIONS *                        |
 | We Would Appreciate if You Cite in Your Research with VASPKIT.|
 | [1] V. Wang, N. Xu, J.C. LIU, G. Tang, et al, VASPKIT: A Pre- |
 | and Post-Processing Program for VASP Code, arXiv:1908.08269.  |
 +---------------------------------------------------------------+
[zjb@op O2_opt]$ 

上前 4 行提示可以知道 INCAR 已经生成,由于生成的 INCAR 与我们实际需要的 INCAR 仍有一些差别,所以之后我们打开 INCAR 进行进一步修改,

Global Parameters
ISTART =  1            (Read existing wavefunction; if there)
# ISPIN =  2           (Spin polarised DFT)
# ICHARG =  11         (Non-self-consistent: GGA/LDA band structures)
LREAL  = Auto          (Projection operators: automatic)
# ENCUT  =  400        (Cut-off energy for plane wave basis set, in eV)
PREC   =  Normal       (Precision level)
LWAVE  = .TRUE.        (Write WAVECAR or not;是否写入波函数)
LCHARG = .TRUE.        (Write CHGCAR or not)
ADDGRID= .TRUE.        (Increase grid; helps GGA convergence)
# LVTOT  = .TRUE.      (Write total electrostatic potential into LOCPOT or not)
# LVHAR  = .TRUE.      (Write ionic + Hartree electrostatic potential into LOCPOT or not)
# NELECT =             (No. of electrons: charged cells; be careful)
# LPLANE = .TRUE.      (Real space distribution; supercells)
# NPAR   = 4           (Max is no. nodes; don't set for hybrids)
# NWRITE = 2           (Medium-level output)
# KPAR   = 2           (Divides k-grid into separate groups)
# NGX    = 500         (FFT grid mesh density for nice charge/potential plots)
# NGY    = 500         (FFT grid mesh density for nice charge/potential plots)
# NGZ    = 500         (FFT grid mesh density for nice charge/potential plots)

ISIF   =  2            (Stress/relaxation: 2-Ions, 3-Shape/Ions/V, 4-Shape/Ions)
Electronic Relaxation
ISMEAR =  0            (Gaussian smearing; metals:1)
SIGMA  =  0.05         (Smearing value in eV; metals:0.2)
NELM   =  60           (Max electronic SCF steps)
NELMIN =  6            (Min electronic SCF steps)
EDIFF  =  1E-08        (SCF energy convergence; in eV)
# GGA  =  PS           (PBEsol exchange-correlation)

Ionic Relaxation
NSW    =  100          (Max electronic SCF steps)
IBRION =  2            (Algorithm: 0-MD; 1-Quasi-New; 2-CG)
#ISIF   =  2            (Stress/relaxation: 2-Ions, 3-Shape/Ions/V, 4-Shape/Ions)
EDIFFG = -2E-02        (Ionic convergence; eV/AA)
# ISM =  2            (Symmetry: 0=none; 2=GGA; 3=hybrids)

~ 
~
~

标签和值如何选择可以查 VASP 手册 呢。

KPOINTS

vaspkit-1,然后,102) Generate KPOINTS File for SCF Calculation,然后选择需要的撒点方法和精度,

------------>>
102
 ======================= K-Mesh Scheme ==========================
 1) Monkhorst-Pack Scheme                            
 2) Gamma Scheme                                     
                                                     
 0)   Quit                                             
 9)   Back                                             
 ------------->>
1                # 在这里选择方法
  -->> (01) Reading Structural Parameters from POSCAR File...
 +---------------------------------------------------------------+
 |               Selective Dynamics is Activated!                |
 +---------------------------------------------------------------+
 +-------------------------- Warm Tips --------------------------+
   * Accuracy Levels: Gamma-Only: 0;              
                      Low: 0.06~0.04;             
                      Medium: 0.04~0.03;          
                      Fine: 0.02-0.01.            
   * 0.03-0.04 is Generally Precise Enough!                
 +---------------------------------------------------------------+
 Input Kmesh-Resolved Value (in unit of 2*PI/Angstrom): 
 ------------>>
0.04            # 在这里输入精度
 +-------------------------- Summary ----------------------------+
 Reciprocal Lattice Vectors (in unit of 1/angstrom):
       0.6283185307       0.0000000000       0.0000000000
       0.0000000000       0.5235987756       0.0000000000
       0.0000000000       0.0000000000       0.4188790205
 Reciprocal Lattice Constants:   0.6283   0.5236   0.4189
 Real-Space Lattice Constants:  10.0000  12.0000  15.0000
 Size of K-Mesh:    1    1    1
 +---------------------------------------------------------------+
  -->> (02) Written KPOINTS File!
  -->> (03) Written POTCAR File with the Recommended Potential!
 +---------------------------------------------------------------+
 |                       * ACKNOWLEDGMENTS *                     |
 | Other Contributors: Xue-Fei LIU, Peng-Fei LIU, Dao-Xiong WU,  |
 | Zhao-Fu ZHANG, Tian WANG, Ya-Chao LIU, Qiang LI, iGo and You! |
 +---------------------------------------------------------------+
 |                          * CITATIONS *                        |
 | We Would Appreciate if You Cite in Your Research with VASPKIT.|
 | [1] V. Wang, N. Xu, J.C. LIU, G. Tang, et al, VASPKIT: A Pre- |
 | and Post-Processing Program for VASP Code, arXiv:1908.08269.  |
 +---------------------------------------------------------------+

 







 













 





















通常情况下,生成 KPOINTS 的同时,会根据推荐赝势生成 POTCAR。如果你的没有生成,则进入下一步。

POTCAR

vaspkit-1-103) Generate POTCAR File with Default Setting

当然也可以选择 104) Generate POTCAR File with User Specified Potential 选择自己想要的赝势类型。

如果没有 VASPKIT,就可以 cat <元素 1 的赝势文件> <元素 2 的赝势文件> >> POTCAR


到此为止 VASP 运行所需要的四个输入文件就全都准备好了,我们就可以提交这个作业了。

PBS 脚本 复制到当前目录,然后使用 qsub 命令提交作业。

qsub -N JobName vasp.pbs