好主意,先支持一个
官方ftp上的interpolatePOSCAR
script功能简介:将两个POSCAR线性插值得到n个POSCAR用于NEB计算
script:
#
# interpolate two POSCAR files
# POSCAR files must be concated before passing them to
# this awk script
# first line of the first POSCAR file should be
# rep number_of_replicase
# if there is any line containing the term center
# differences in the center of mass will be removed
#
file=$1
if [ ! -x $file ]
then
usage: interpolatePOS POSCAR1_POSCAR2
fi
awk <$file '
BEGIN { rep=10; center=0 }
/center/ { center=1}
/rep/ { rep=$2 }
{ line=line+1
if ( second != 1 ) {
if ( line == 6 ) {
lines = $1 + $2 + $3 + 7
print "found ",lines," ions"
head[line] = $0
} else if ( line < 8 )
head[line] = $0
else
{
x[line-7] = $1 ; y[line-7] = $2 ; z[line-7] = $3
if (line==lines) {
line=0; second=1;
print "first set read"
}
}
} else {
if ( line >= 8 )
{
x2[line-7] = $1; y2[line-7] = $2 ; z2[line-7] = $3 }
if (line==lines) {
print "second set read"
}
}
}
END {
lines=lines-7
for ( line=1; line<=lines ; line ++ ) {
cx1=cx1+ x[line] ; cy1=cy1+ y[line] ; cz1=cz1+ z[line]
cx2=cx2+ x2[line]; cy2=cy2+ y2[line]; cz2=cz2+ z2[line]
}
if (center) {
cx=(cx2-cx1)/lines
cy=(cy2-cy1)/lines
cz=(cz2-cz1)/lines
print "center of mass for second cell will be shifted by",cx,cy,cz
}
for ( i=0; i file="0" i "/POSCAR"
print "writing to " file
for (line=1; line<=7 ; line++ )
print head[line] >file
for ( line=1; line<=lines ; line ++ ) {
b=i/(rep-1)
a=(rep-1-i)/(rep-1)
dx=a*x[line] + b*(x2[line]-cx)
dy=a*y[line] + b*(y2[line]-cy)
dz=a*z[line] + b*(z2[line]-cz)
printf " %10.6f %10.6f %10.6f\n",dx,dy,dz >file
}
}
}'
script用法:./interpolatePOSCAR [file]
interpolatePOSCAR 为script的文件名,file为要处理的POSCAR
第一行写成rep n的格式,把要插值的两个POSCAR文件写到一个file里面
注意要建一些目录00 01 02 ...0n,否则会出错
PS:我的fedroa5.0运行不成功,不过我的ubuntu9。04运行成功了。开心阿。
阅读(1963) | 评论(1) | 转发(0) |