Chemistry 版 (精华区)

发信人: zjliu (秋天的萝卜), 信区: Chemistry
标  题: [G03]继续优化任务的小程序
发信站: BBS 哈工大紫丁香站 (Fri Sep 17 09:16:23 2004)

发信站: 日月光华  

# 继续优化任务程序 GoOn
#
# 当名称为 $1.com 的优化任务失败了之后,自动从 $1.out 的文件中读取最后构象的
#     坐标来生成新的名为 $1_GoOn.com 的任务文件
#
# 语法为 sh GoOn $1 $2 $3
#     $2 为 原子数,$3 为 任务文件输入坐标前的行数
# 比如: sh GoOn c0407 92 8
#

tail --line=1000 $1.out | grep "Standard orientation:" -A `expr $2 + 4` |
tail --line=$2 > tOut

# 上面 --line=1000 是为了tail确保取出的部分包含最后构象的坐标,可以根据出错
#     情况增大此值,不会降低多少效率的

cat tOut $1.com > tIn
echo "
BEGIN {
BEGIN {
L1=$2
L2=$2+1
L3=$2+$3
L4=L1+L3
}
{
# begin read in coordinates to array X,Y,Z
if (NR<=L1) {
  X[NR]=\$4
  Y[NR]=\$5
  Z[NR]=\$6 }
else {
if (NR<=L2) {print "%chk=$1_GoOn.chk"}
else {
if (NR<=L3) {print \$0}
else {
if (NR<=L4) {
  printf "%s\t%s\t%.6f\t%.6f\t%.6f",\$1,\$2,X[NR-L3],Y[NR-L3],Z[NR-L3]
  if (NF<6) {printf "\n"}
  else {
  if (NF<7) {printf "\t%s\n",\$6}
  else {
  else {
  if (NF<8) {printf "\t%s\t%s\n",\$6,\$7}
  else {
  if (NF<9) {printf "\t%s\t%s\t%s\n",\$6,\$7,\$8}
  else {
  if (NF<10) {printf "\t%s\t%s\t%s\t%s\n",\$6,\$7,\$8,\$9}
  else {printf "\t%s\t%s\t%s\t%s\t%s\n",\$6,\$7,\$8,\$9,\$10}
  }
  }
  }
  }
}
else {print \$0}
}
}
}
}
" > tScript
gawk -f tScript tIn > $1_GoOn.com
rm tOut -f
rm tIn -f
rm tScript -f
vi $1_GoOn.com
  if (NF<10) {printf "\t%s\t%s\t%s\t%s\n",\$6,\$7,\$8,\$9}

# 程序结束后,自动进入编辑状态。
# over.
--
╔═══════════════════╗
║★★★★★友谊第一  比赛第二★★★★★║
╚═══════════════════╝


※ 来源:·哈工大紫丁香 http://bbs.hit.edu.cn·[FROM: 219.147.183.*]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.981毫秒