VASP Machine Learning Force Field Calculates Silicon Phonon Spectrum
Vienna Ab initio Simulation Package (VASP:The VASP Manual – VASP Wiki ) is a computer program for atomic-scale material modeling from first principles, such as electronic structure calculations and quantum mechanical molecular dynamics.
PhonopyWelcome to phonopy — Phonopy v.2.37.1) is a Python toolkit for computing phonon band structures, thermal properties, group velocities, and other phonon-related quantities at the harmonic and quasi-harmonic levels.
Tutorial Content
In this tutorial, we will use an automated script to demonstrate the calculation process of the machine learning force field phonon spectrum. Through this tutorial, you will learn the basic process of using the machine learning force field phonon spectrum calculation:
- Prepare perturbation difference supercell structure
- Set the machine learning force field parameters and calculate the total energy of all structures
- Calculate the force constant matrix
- Calculate the phonon spectrum from the force constant matrix
Input File
The input file contains
├── POSCAR-unitcell
├── clean.sh
├── run.sh
└── run_vasp.sh
├── pt
│ ├── INCAR
│ ├── KPOINTS
│ ├── ML_FF
│ └── POTCAR(需自行上传)
POSCAR-unitcell
Si #硅结构
5.38930000000000
0.0000000000000000 0.5071343999939496 0.5071343999939496
0.5071343999939496 0.0000000000000000 0.5071343999939496
0.5071343999939496 0.5071343999939496 0.0000000000000000
2
Direct
0.8750000000000000 0.8750000000000000 0.8750000000000000
0.1250000000000000 0.1250000000000000 0.1250000000000000
clean.sh
#!/bin/bash
rm -r *.yaml band.pdf band.yaml FORCE_SETS vasp poscar *out SPOSCAR
# 删除不必要文件
run.sh
#!/bin/bash
rm -r vasp poscar
#准备微扰差分超胞结构
##########################
phonopy -d --dim 2 2 2 --pa auto -c POSCAR-unitcell
mkdir poscar
mv POSCAR-unitcell pp
mv POSCAR-* poscar/
##########################
#计算所有结构的总能
##########################
mkdir vasp
cd vasp
Pnum=$(ls -l ../poscar/ -IR | grep "^-" | wc | awk -F ' ' '{print $1}')
cp ../run_vasp.sh .
t_head="for i in {1.."
t_tail="}"
sed -i "3c ${t_head}${Pnum}${t_tail}" run_vasp.sh #生成vasp计算脚本
./run_vasp.sh
##########################
cd ../
mv pp POSCAR-unitcell
#计算力常数矩阵
##########################
phonopy -f vasp/*/vasprun.xml > pfcout
##########################
#根据力常数矩阵计算声子谱
##########################
phonopy-load --band "0.0 0.0 0.0 0.5 0.0 0.5 0.625 0.25 0.625, 0.375 0.375 0.75 0.0 0.0 0.0 0.5 0.5 0.5" --band-labels "Γ X K K Γ L" -p -s
##########################
run_vasp.sh
#!/bin/bash
#计算 vasp 流程自动脚本
for i in {1..8}
do
rm -r $i
mkdir $i
cd $i
ii=$(printf "%03d" $i)
cp ../../poscar/POSCAR-${ii} POSCAR
cp ../../pt/* .
mpirun -n 1 vasp_std
cd ../
done
Files in folder pt
INCAR standard static calculation
ISTART = 1 (若有波函数、读取波函数)
ISPIN = 1 (非极化计算)
Static Calculation
ISMEAR = 0 (高斯占据)
SIGMA = 0.05 (高斯展宽)
NELM = 60 (最大电子步)
EDIFF = 1E-08 (SCF 收敛精度)
Machine Learning Force Field Settings
ML_LMLFF = T (使用机器学习力场)
ML_ISTART = 2 (仅预测模式)
KPOINTS (not used when machine learning is enabled, just set one)
K-Spacing Value to Generate K-Mesh: 0.040
0
Gamma
4 4 4
0.0 0.0 0.0
POTCAR
The pseudopotential combination of the corresponding elements in the system, here is the pseudopotential of Si
ML_FF
The machine learning force field parameter file corresponding to the pre-trained system. For the specific training process, please refer to Si's Machine Learning Force FieldTutorial.
Getting Started
1. Clone the container
Find the tutorial working directory and clone the container
2. Set up the container
选择 4090 — 按量付费 — vasp 6.3.0-cuda11.8 — 工作空间

加载完毕后打开工作空间

打开终端

上传准备好的硅赝势,可以使用官网例子里的赝势 POTCAR 放到目录中

3. Install the phonopy environment
conda install -c conda-forge phonopy
Then enter y and press Enter to agree to the installation

4. Run the script
chmod 777 *.sh
./run.sh
5. View the phonon spectrum
View the file band.pdf
