材料的平衡晶格常数是比较常见和基础的性质,在开始入门计算材料时一般都会接触到。
一般的方法是计算晶体在不同晶格常数下的结合能,然后通过对结合能进行拟合,找到能量的最小值,对应的就是平衡晶格常数。
这里忽略具体如何获取这些“晶格常数——结合能”数值对,而介绍如何对这些数值对进行处理,获取平衡晶格常数。
比较常见的方法是使用origin的多项式拟合功能,获得多项式系数;然后再对对多项式进行处理,获得多项式的极值点对应的晶格常数就是平衡晶格常数。我个人感觉,还是有点小麻烦,所以就写了下面的代码,可以直接处理得到平衡晶格常数和相应的结合能。具体代码如下:function cal_lat_const(N,inFileName)
% calcuate the lattice constant according to "lat_const cohesive_energy"
% Input:
% N: order of the polynomial fitting.
% inFileNmae: name of the file storing "lat_const cohesive_energy"
% Example:
% cal_lat_const(8,'Au')
%Here, 'Au' is a file stores "lat_const cohesive_energy"
% Powered by Xianbao Duan
% Email: xianbao.d@gmail.com
% Website: http://www.52souji.net/
% read in data from th