VASP频率计算完成后,每次都需要调用vaspkit,依次输入命令代码来产生零点能校正、焓变与熵变校正,较为繁琐。本文基于shell脚本语法编写了批处理频率分析脚本。
提取VASP频率计算结果 运行命令:脚本+温度参数
1 ./freq_vaspkit0.73.sh 298.15
freq_vaspkit0.73.sh脚本内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 #!/bin/sh touch run.sh chmod +x run.sh for dir in `find ./ -type d | grep 'freq' `; do if [ ! -f "$dir /OUTCAR" ];then continue else cat > run.sh <<EOR #!/bin/sh cd $dir vaspkit <<! 5 501 $1 ! EOR echo $dir ./run.sh | tee out.log echo $dir | sed 's/freq//' | sed 's/^..//' | awk '{printf "%-30s\n",$1}' >> namegrep entropy $dir /OUTCAR | tail -1 | awk '{printf "%.6f\n",$7}' >> E0 grep "Zero-point energy E_ZPE" out.log | awk '{printf "%.6f\n",$5}' >> Ezpe grep "Enthalpy contribution E_H" out.log | awk '{printf "%.6f\n",$5}' >> H grep "Entropy contribution T*S" out.log | awk '{printf "%.6f\n",$5}' >> TS grep "Thermal correction to G(T)" out.log | awk '{printf "%.6f\n",$6}' >> G fi done index="name\t\t\t\tE0\t\tEzpe\t\tH(T)\t\tG(T)" paste name E0 Ezpe H TS G | sed -r "1i$index " > energy.out rm name E0 Ezpe H TS G out.log run.sh
energy.out输出文件格式示例如下:
点击下载代码freq_vaspkit0.73.sh
因新版vaspkit对输出做了修改,使用vaspkit1.00的用户可下载下面的脚本:点击下载代码freq_vaspkit1.00.sh
提取Gaussian频率计算结果 前提条件:频率计算的结果需放在freq目录下,不能有其他以log为后缀的文件
运行命令:
freq_Gaussian.sh脚本内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #!/bin/sh for dir in `find ./ -type d | grep 'freq' `; do if [ ! -f $dir /*.log ];then 判断freq目录下是否有*.log 文件continue else echo "file in $dir is processing" echo $dir | sed 's/freq//' | sed 's/^..//' | awk '{printf "%-30s\n",$1}' >> namecat $dir /*.log | grep "SCF Done" | awk '{printf "%.6f\n",$5}' >> E0 cat $dir /*.log | grep "Zero-point correction" | awk '{printf "%.6f\n",$3}' >> Ezpe cat $dir /*.log | grep "Thermal correction to Enthalpy" | awk '{printf "%.6f\n",$5}' >> Hcorr cat $dir /*.log | grep "Thermal correction to Gibbs Free Energy" | awk '{printf "%.6f\n",$7}' >> Gcorr fi done index="name\t\t\t\tE0\t\tEzpe\t\tHcorr\t\tGcorr" paste name E0 Ezpe Hcorr Gcorr | sed -r "1i$index " > energy.out rm name E0 Ezpe Hcorr Gcorr
点击下载代码freq_Gaussian.sh