使用VASP relax 晶格优化计算 (以MoS2计算为例)¶
输入文件准备:¶
INCAR¶
Special task: Structural relaxation
NELM = 50 # 电子步参数,控制单个离子步内的电子密度迭代次数。
IBRION = 2 # 共轭梯度法优化原子位置
NSW = 999 # 最大离子步数,控制体系结构优化的总步数。进行结构优化计算时,此参数不能为0
EDIFFG = -0.001 # 离子弛豫收敛标准,控制结构优化或分子动力学的离子步收敛条件。
ISIF = 3 # 同时优化晶格形状、体积及原子位置
# ISYM = 0
General:
SYSTEM = SrSnAs_mono # 体系名称(注释作用)
GGA = PE # 使用GGA-PE算法计算
ENCUT = 500 # 平面波截断能,建议取POTCAR中最大ENMAX的1.3倍
ISMEAR = 0 # 高斯展宽(适用于半导体/绝缘体);金属优先 ISMEAR=1,非金属优先 ISMEAR=0
SIGMA = 0.02 # 展宽宽度,需结合K点密度调整
Precision and convergence:
EDIFF = 1E-7 # 电子自洽收敛标准,当相邻两次电子迭代的总能量变化(ΔE)和能带能量变化均小于 EDIFF 时,电子步停止。
PREC = Accurate # 高精度模式,优化晶格时推荐
ALGO = Normal # 计算精度
LREAL = .FALSE. # 是否在实空间内计算,
AMIN = 0.01
Output options:
NWRITE = 2 # 控制OUTCAR输出丰富程度
LWAVE = .FALSE. # 不输出波函数文件WAVECAR,节省内存
LCHARG = .FALSE. # 不输出电荷密度文件CHGCAR、CHG,节省内存
POSCAR¶
即包含了体系位置信息的文件
- 在 Material projector 网站中,下载MoS2的 cif文件 ,导入到DS中(以Device studio为例,Material studio同理)。
- 删除多余原子,通过
Build -> Surface/Slab
,添加 25埃 的真空层。File -> Export
,将.hzw格式的文件导出成.cif文件,选择symmetry
,保留对称性。 - 将.cif文件拖入VESTA中,通过VESTA的File-Export Data功能,将文件导出为POSCAR文件。
如:
MoS2
1.00000000000000
5.4930889458935059 0.0000000000000000 0.0000000000000000
0.0000000000000000 3.1714081098437417 0.0000000000000000
0.0000000000000000 0.0000000000000000 30.0000000000000000
Mo S
2 4
Direct
0.3333315405419680 -0.0000000000000000 0.5000000000000000
0.8333315008753017 0.5000000000000000 0.5000000000000000
0.0000009162290170 0.0000000000000000 0.4476965326780513
0.0000009162290170 -0.0000000000000000 0.5523034673219487
0.5000009162290170 0.5000000000000000 0.4476965326780513
0.5000009162290170 0.5000000000000000 0.5523034673219487
MoS2 # 不读取
1.00000000000000 # 放大参数,一般设置为1
5.4930889458935059 0.0000000000000000 0.0000000000000000 # 晶格矢量a(平面内)
0.0000000000000000 3.1714081098437417 0.0000000000000000 # 晶格矢量b(平面内)
0.0000000000000000 0.0000000000000000 30.0000000000000000 # 晶格矢量c(平面内)
Mo S # 元素种类,包含Mo和S
2 4 # 各元素原子数,这里表示晶胞内包含2个Mo,4个S
Direct # 分数坐标
0.3333315405419680 -0.0000000000000000 0.5000000000000000 # 第1个Mo原子的坐标
0.8333315008753017 0.5000000000000000 0.5000000000000000 # 第2个Mo原子的坐标
0.0000009162290170 0.0000000000000000 0.4476965326780513 # 第1个S原子的坐标
0.0000009162290170 -0.0000000000000000 0.5523034673219487 # 第2个S原子的坐标
0.5000009162290170 0.5000000000000000 0.4476965326780513 # 第3个S原子的坐标
0.5000009162290170 0.5000000000000000 0.5523034673219487 # 第4个S原子的坐标
KPOINTS¶
使用vaspkit软件,调用vaspkit的命令如下:
vaspkit
正常情况下,出现如下界面:
[294690@fm1-login1 ~]$ vaspkit
\\\///
/ _ _ \ Hey, you must know what you are doing.
(| (o)(o) |) Otherwise you might get wrong results.
o-----.OOOo--()--oOOO.------------------------------------------o
| VASPKIT Standard Edition 1.5.1 (27 Jan. 2024) |
| Lead Developer: Vei WANG (wangvei@icloud.com) |
| Main Contributors: Gang TANG, Nan XU & Jin-Cheng LIU |
| Online Tutorials Available on Website: https://vaspkit.com |
o-----.oooO-----------------------------------------------------o
( ) Oooo. VASPKIT Made Simple
\ ( ( )
\_) ) /
(_/
===================== Structural Utilities ======================
01) VASP Input-Files Generator 02) Mechanical Properties
03) K-Path for Band-Structure 04) Structure Editor
05) Catalysis-ElectroChem Kit 06) Symmetry Analysis
07) Materials Databases 08) Advanced Structure Models
===================== Electronic Utilities ======================
11) Density-of-States 21) Band-Structure
23) 3D Band-Structure 25) Hybrid-DFT Band-Structure
26) Fermi-Surface 28) Band-Structure Unfolding
31) Charge-Density Analysis 42) Potential Analysis
44) Piezoelectric Properties 51) Wave-Function Analysis
62) Magnetic Analysis 65) Spin-Texture
68) Transport Properties
======================== Misc Utilities =========================
71) Optical Properties 72) Molecular-Dynamics Kit
74) User Interface 78) VASP2other Interface
84) ABACUS Interface 91) Semiconductor Kit
92) 2D-Material Kit 95) Phonon Analysis
0) Quit
------------>>
[294690@fm1-login1 te]$ vaspkit
\\\///
/ _ _ \ Hey, you must know what you are doing.
(| (o)(o) |) Otherwise you might get wrong results.
o-----.OOOo--()--oOOO.------------------------------------------o
| VASPKIT Standard Edition 1.5.1 (27 Jan. 2024) |
| Lead Developer: Vei WANG (wangvei@icloud.com) |
| Main Contributors: Gang TANG, Nan XU & Jin-Cheng LIU |
| Online Tutorials Available on Website: https://vaspkit.com |
o-----.oooO-----------------------------------------------------o
( ) Oooo. VASPKIT Made Simple
\ ( ( )
\_) ) /
(_/
===================== Structural Utilities ======================
01) VASP Input-Files Generator 02) Mechanical Properties
03) K-Path for Band-Structure 04) Structure Editor
05) Catalysis-ElectroChem Kit 06) Symmetry Analysis
07) Materials Databases 08) Advanced Structure Models
===================== Electronic Utilities ======================
11) Density-of-States 21) Band-Structure
23) 3D Band-Structure 25) Hybrid-DFT Band-Structure
26) Fermi-Surface 28) Band-Structure Unfolding
31) Charge-Density Analysis 42) Potential Analysis
44) Piezoelectric Properties 51) Wave-Function Analysis
62) Magnetic Analysis 65) Spin-Texture
68) Transport Properties
======================== Misc Utilities =========================
71) Optical Properties 72) Molecular-Dynamics Kit
74) User Interface 78) VASP2other Interface
84) ABACUS Interface 91) Semiconductor Kit
92) 2D-Material Kit 95) Phonon Analysis
0) Quit
------------>>
102
======================== K-Mesh Scheme ==========================
1) Monkhorst-Pack Scheme
2) Gamma Scheme
3) Irreducible K-Points with Gamma Scheme
0) Quit
9) Back
------------->>
2
+---------------------------- Tip ------------------------------+
* 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 the K-spacing value (in unit of 2*pi/Angstrom):
------------>>
0.04
+-------------------------- Summary ----------------------------+
Reciprocal Lattice Vectors (in Units of 1/Angstrom):
0.9213378663 -0.0000000000 -0.0000000000
0.0000000000 0.5319346651 -0.0000000000
0.0000000000 0.0000000000 0.2735823334
Reciprocal Lattice Constants: 0.9213 0.5319 0.2736
Real-Space Lattice Constants: 6.8196 11.8119 22.9663
Size of K-Mesh: 4 2 1
+---------------------------------------------------------------+
-->> (01) Written KPOINTS File.
o---------------------------------------------------------------o
| * ACKNOWLEDGMENTS * |
| Other Contributors (in no particular order): Peng-Fei LIU, |
| Xue-Fei LIU, Dao-Xiong WU, Zhao-Fu ZHANG, Tian WANG, Qiang LI,|
| Ya-Chao LIU, Jiang-Shan ZHAO, Qi-Jing ZHENG, Yue QIU and You! |
| Advisors: Wen-Tong GENG, Yoshiyuki KAWAZOE |
:) Any Suggestions for Improvement are Welcome and Appreciated (:
|---------------------------------------------------------------|
| * CITATIONS * |
| When using VASPKIT in your research PLEASE cite the paper: |
| [1] 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), DOI: 10.1016/j.cpc.2021.108033 |
o---------------------------------------------------------------o
即可使用vaspkit
读取POSCAR
,自动生成KPOINTS
文件。
若当前文件夹内不存在
POTCAR
文件,则同时会读取POSCAR
中的原子元素种类,生成赝势文件POTCAR
POTCAR¶
同KPOINTS
,使用vaspkit
的103
功能或102
功能自动读取POSCAR
,生成赝势文件POTCAR
。
提交任务¶
使用提交任务的脚本文件vasp.sh,使用sbatch命令将任务提交至slurm:
sbatch vasp.sh
提交任务的脚本文件示例:
#!/bin/bash
#SBATCH -p C064M0256G
#SBATCH -N 1
#SBATCH -n 64
module load VASP/6.2.1
module load mkl/2022.1.0
module load mpi/2021.6.0
ulimit -s unlimited
echo "This job started on \""$(hostname)"\" at" $(date) > log.txt
mpirun vasp_std >> log.txt
echo "This job finished on \""$(hostname)"\" at" $(date) >> log.txt
主要输出文件¶
OUTCAR¶
-
作用:记录所有计算细节,包括能量、原子受力、应力、收敛状态等关键信息。
-
核心内容:
TOTEN
:体系总能量(包含熵修正的自由能)FORCES on atoms
:原子受力(单位eV/Å)Stress tensor
:晶格应力张量(单位kBar)
-
监测命令:
grep 'TOTEN' OUTCAR # 提取总能量变化 grep 'forces' OUTCAR # 查看原子受力
CONTCAR¶
- 作用:保存优化后的晶格参数和原子坐标,是下一次计算的初始结构输入。
- 格式:与POSCAR相同
晶格缩放因子 晶格矢量(3行) 元素种类及原子数 坐标类型(Direct/Cartesian) 原子坐标
- 典型操作:
cp CONTCAR POSCAR # 用优化结果覆盖初始结构
OSZICAR¶
- 作用:记录每个离子步(几何优化)和电子步(波函数优化)的收敛过程。
-
关键字段:
字段 含义 N
电子步序号(每次离子步内的自洽迭代次数) E
当前电子步的自由能(单位eV) dE
相邻电子步能量差(判断电子自洽收敛) ncg
哈密顿量作用于波函数的次数(反映计算复杂度) rms(c)
输入与输出电荷密度差的均方根(收敛判据之一) F=...
离子步总能量(含所有电子步贡献) -
典型输出片段:
N E dE d eps ncg rms rms(c)
DAV: 1 -134.015E+03 -134E+03 -0.98E+02 56 0.28E+02
DAV: 2 -134.892E+03 -0.88E+00 -0.12E+00 72 0.15E+01
...
1 F=-134015.22 E0=-133973.40 dE=0.134E+04 mag=0.00μB
XDATCAR¶
- 作用:记录每个离子步的晶格矢量和原子坐标演化轨迹,用于分析优化路径。
-
应用场景:
- 可视化晶格形变过程
- 调试震荡收敛问题(如原子位置反复调整)