24小时热门版块排行榜    

查看: 424  |  回复: 4
当前主题已经存档。

bshliu

铁虫 (小有名气)

[交流] 传一个PWscf构建超晶胞到脚本程序

#!/bin/bash
echo -e "establish a supercell from a unit cell"
echo -e "Please input the number of the atoms:\c"
read atomnumber
echo -e "Please input the types of the atoms:\c"
read atomtypes
echo -e "Please in put the lattice paremeters\na   b  c  cos(ab)  cos(bc) cos(ac)"
read a b c Calpha Cbeta Cgamma
echo -e "please input the rule for supercell\n x1  y2  z3 "
read x1 y2 z3
if [ -f input.txt ];then
echo "exist"
rm -f input.txt
fi
let kcount=0
let increase=1
while [ $kcount -ne $atomnumber ]; do

echo -e "please input the $kcount atom x, y, z coordinates...\n atom type   x     y  z"
read atomtype x y z
echo -e "$x  $y  $z\n"
xx=$x; yy=$y; zz=$z
kcountx=0

   while [ $kcountx -lt $x1 ]; do
        kcounty=0
        while [ $kcounty -lt $y2 ]; do
              kcountz=0
              while [ $kcountz -lt $z3 ]; do
              x=`echo $x1 $kcountx $xx|awk '{printf "%0.8f\n", 1/$1*$2+$3/$1}'`
              y=`echo $y2 $kcounty $a $b $yy|awk '{printf "%0.8f\n", 1/$1*$2*$4/$3+$5/$1}'`
              z=`echo $z3 $kcountz $a $c $zz|awk '{printf "%0.8f\n", 1/$1*$2*$4/$3+$5/$1}'`
              echo "$x   $y   $z"
              kcountz=$((kcountz+1));
              echo $atomtype $x $y $z >>input.txt
              done
        kcounty=$((kcounty+1));
        done
   kcountx=$((kcountx+1));
  done
let kcount=kcount+1
done

直接cp在成.sh文件,按赵提示运行就可以构造任意大小到超晶报
有喜欢PWscf计算的虫子可以 交流交流
本人的
E-mail: liubaoshun@126.com
回复此楼
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

wangqj1

铁杆木虫 (著名写手)

watermall

金虫 (小有名气)

haiw201

木虫 (正式写手)

bshliu

铁虫 (小有名气)

回复

相关版块跳转 我要订阅楼主 bshliu 的主题更新
普通表情 高级回复(可上传附件)
信息提示
请填处理意见