|
|
本帖最后由 qqzhang 于 2026-4-2 15:27 编辑
vasp slow growth的后数据处理一直都是自己写的代码进行后数据处理,例如J. Am.Chem. Soc. 2020, 142, 5773-5777.“we have home-made codes/scripts to post-process the output data”。我看网上也有一部分人问怎么进行后处理。这里我给出我的代码(之前我也是自己琢磨了很久的代码,最终全部整合在一起并缩短才得到这一串看似简单的代码),计算完之后怎么进行数据后处理:
- #!/bin/sh
- grep cc REPORT | awk '{print $3}' > cc.dat
- grep b_m REPORT | awk '{print $2}' > bm.dat
- read -p "ICONST设置的键数: " period
- read -p "需要查看的键的排名: " index
- sed -n "${index}~${period}p" bm.dat > bm.txt
- sed -n "${index}~${period}p" cc.dat > cc.txt
- first=$(head -n1 cc.txt)
- last=$(tail -n1 cc.txt)
- echo -e "\n"
- echo "积分完成,结果已保存到 integral.dat"
- echo "从 $first Å 迭代到 $last Å"
- paste cc.txt bm.txt | awk 'NR==1 {x_prev=$1;y_prev=$2;sum=0;max=0;max_x=$1;print $1,$2,0;next} {dx=$1-x_prev;sum+=dx*($2+y_prev)/2;if(NR==2||sum>max){max=sum;max_x=$1} print $1,$2,sum;x_prev=$1;y_prev=$2} END {printf "Max Integral: %.6f eV at x = %.6f Å\n",max,max_x>"/dev/stderr"}' > integral.dat
复制代码 运行之后需要输入x和y“ICONST设置的键数: x;需要查看的键的排名: y”,就是输入在ICONST文件里面总共有限制几个键x,以及你所需要的键在ICONST里面排第几。即可运行,运行结果见示例图片。会输出integral.dat和打印最大值,使用integral.dat画图即可,第一列是cc,第二列是bm,第三列是积分值,导入到origin即可直接画图。
|
评分 Rate
-
查看全部评分 View all ratings
|