标题: 提供一个借助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