计算化学公社

标题: 提供一个借助Multiwfn将.fchk批量转为.gjf的小脚本 [打印本页]

作者
Author:
小强    时间: 2019-5-17 10:26
标题: 提供一个借助Multiwfn将.fchk批量转为.gjf的小脚本
提供一个借助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:代码可能不完善,在此仅为抛砖引玉;#后为注释内容;
另学习写脚本真的不难,静下心来琢磨一两天就能写了,千万别抵触,一旦入门了,那种感觉爽到爆!


作者
Author:
柒月小鱼    时间: 2019-5-17 15:14
好物 学习了




欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3