计算化学公社

 找回密码 Forget password
 注册 Register
Views: 7593|回复 Reply: 1
打印 Print 上一主题 Last thread 下一主题 Next thread

[Gaussian/gview] 提供一个借助Multiwfn将.fchk批量转为.gjf的小脚本

[复制链接 Copy URL]

66

帖子

0

威望

1786

eV
积分
1852

Level 5 (御坂)

跳转到指定楼层 Go to specific reply
楼主
提供一个借助Multiwfn将.fchk批量转为.gjf的小脚本,以回馈论坛,希望能够帮助到大家。该脚本需要涉及文档,分别为fch2inp.sh, gsopt.txt, inp.txt;
其中fch2inp.sh为代码,内容如下:
***********************************************************************  #! /bin/bashfor f in *.fchk
do
./Multiwfn $f < inp.txt  
mv 1.gjf ${f//fchk/gjf}
# Change name of the file generated by Multiwfn to same as that of input file!!   
done
for inf in *.gjf
do
sed -i '1c'%chk=${inf//gjf/chk}'' $inf
# Replace the first line by '%chk=${inf//gjf/chk}'
# The variable behind sed script('1c') must(!!!!!) be quoted by single quote mark(');
# A space must(!!!!) be presented before input file.
sed -i '/chk/r 'gsopt.txt'' $inf
# Add lines from an external file(temp.txt) below the line that has the string 'chk'.
# A single slish(/) must(!!!!!!!!) be presented before the string that needing be found.
done
*********************************************************************
gsopt.txt为gaussian输入模板文件,内容如下(该文件内容可根据自己实际情况编辑):
*******************************************
%mem=6GB
%nprocshared=8
#p opt b3lyp tzvp em=gd3 scrf=solvent=methanol

********************************************
inp.txt为需在Multiwfn中输入的信息,内容如下:
********************************************


100
2
10
1.gjf
exit

***********************************************

ps:代码可能不完善,在此仅为抛砖引玉;#后为注释内容;
另学习写脚本真的不难,静下心来琢磨一两天就能写了,千万别抵触,一旦入门了,那种感觉爽到爆!

评分 Rate

参与人数
Participants 1
eV +8 收起 理由
Reason
sobereva + 8

查看全部评分 View all ratings

239

帖子

0

威望

2291

eV
积分
2530

Level 5 (御坂)

2#
发表于 Post on 2019-5-17 15:14:37 | 只看该作者 Only view this author
好物 学习了

本版积分规则 Credits rule

手机版 Mobile version|北京科音自然科学研究中心 Beijing Kein Research Center for Natural Sciences|京公网安备 11010502035419号|计算化学公社 — 北京科音旗下高水平计算化学交流论坛 ( 京ICP备14038949号-1 )|网站地图

GMT+8, 2025-8-16 17:59 , Processed in 0.926597 second(s), 21 queries , Gzip On.

快速回复 返回顶部 返回列表 Return to list