24小时热门版块排行榜    

CyRhmU.jpeg
查看: 1932  |  回复: 6

ChemiAndy

木虫 (正式写手)


[求助] DFT Scan之后使用MP2计算能量,如何建立批量输入文件?

如题,使用B3LYP Scan优化了很多构型,然后需要使用MP2依次计算所有构型的结合能。由于点很多,一个一个构型建立输入文件并运行太麻烦。请问有没有简单的办法建立一个输入文件实现上述功能?谢谢。
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ZDBWHZ

金虫 (正式写手)

去学学shell吧
2楼2011-12-30 00:02:54
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ChemiAndy

木虫 (正式写手)


谢谢,正在搞Shell
3楼2011-12-31 01:28:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zeozhou

木虫 (小有名气)

【答案】应助回帖

感谢参与,应助指数 +1
ChemiAndy(金币+20): ★★★很有帮助 好主意,我试试 2012-01-02 14:04:16
可以尝试在输入中使用
----link1---
将构型隔开。然后,可以把所有构型都放到一个Input中
注意mp2通常chk文件比较大,如果担心输出文件太大的话,可以均分为几个输入文件完成

不知道这个方法适不适合你?
4楼2011-12-31 17:27:31
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ChemiAndy

木虫 (正式写手)


★ ★ ★ ★ ★
小红豆(金币+5): 感谢分享 2012-01-16 21:43:23
写了一个bash脚本(只能在linux, bash类型的shell下运行),供参考:

下面的脚本把高斯MP2单点Scan(注意不是Scan优化)生成的输出文件中的结构全部读出,生成DFTB所需的输入文件。你可以修改它实现其它目的。
引用回帖:

#!/bin/bash

#

# 1. Extract 21 configurations from scan-calculation of gaussian

# 2. Create 21 DFTB 'gen' files

# 3. Create 21 tinker 'xyz' files (TBA)

#

# Xijun Wang, Jan. 5, 2012

# xijun(at)cermm.concordia.ca

# Ref:1.Cu G. Phung, Gaustool, http://www.ccl.net/cca/software/UNIX/gaussian-utilities/README



MOL='g-w'   // here you name your system

NATOM=13    // here you control how many atoms in the system

NMOL=21    //  here you control how many configurations will be read from the gaussian file

echo "MOL name is $MOL, NMOL is $MOL, NATOM is $NATOM"



rm $MOL*   // delete residue files of previous running



# Extract configurations from gaussian output file;

# Only Z-matrix orientation coordinates will be extracted;

sed '/Z-Matrix orientation/,/Distance/!d' $1 >> temp1

echo "Gaussian structure has been extracted ..."



# Delete un-useful lines

grep -v 'Num' temp1|grep -v 'Dis'|grep -v '\-\-\-'|grep -v 'Z'|grep -v 'Center' >> temp2

echo "Some lines have been deleted ..."



# Replace element number with their types: 6-C; 7-N; 1-H; 8-O;

# Examine the gaussian file for details of the replace below:

sed -i -e 's/6           0 /C /g' -e 's/7           0 /N /g' \

       -e 's/1           0 /H /g' -e 's/8           0 /O /g'  temp2

echo "Element number has been replaced by element name ..."



# change element type: C-1; N-2; H-3; O-4;

sed -i -e 's/C/1/g' -e 's/N/2/g' -e 's/H/3/g' -e 's/O/4/g' temp2

echo "Element name have been replaced by number in order of C, N, H, O ..."



# Separate temp2 into 21 files with name g-w.xx.gen

for ((IMOL=0;IMOL<$NMOL;IMOL++)); do

  let  m=13*$IMOL+1

  let  n=$m+$NATOM-1

  let  fn=$IMOL+1

# Add the first two lines to the gen file

  echo "  $NATOM C" > $MOL.$fn.gen   

  echo "  C N H O" >> $MOL.$fn.gen

  echo "Print from lines $m to line $n into file $MOL.$fn.gen..."

  sed -n''"$m"','"$n"'p' temp2 >> $MOL.$fn.gen

done

rm temp*

exit



This script only works for gausian output of single-point scan calculations. PAY ATTENTION that it does not work for optimization calc. since all structures during the optimization will be output.

Use of the script: Save it with name like g2gen.sh

$ chmod +x g2gen.sh           // make it executable

$ g2gen.sh gaussianfile.out      // replace "gaussianfile.out" with your gaussian output file

Send me email if you have problem.
[/FONT]

http://hi.baidu.com/xijunw/blog/ ... 6efb5dfbf2c01f.html
5楼2012-01-16 10:21:54
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ChemiAndy

木虫 (正式写手)


★ ★ ★ ★ ★
小红豆(金币+5): 感谢参与应助 2012-01-16 21:43:36
另外一个更加通用点的脚本

该脚本能够读取Gaussian03/09输出文件中的最后一个结构,生成xyz坐标文件,然后利用openBabel转换成Gaussian输入文件。因此使用前请确保安装OpenBabel先。

1. 生成的gaussian输入文件为Cartessian坐标。欲得到Z-Matrix坐标的输入文件,可修改Babel行为“babel -ixyz $name.xyz -ogzmat $name.gjf”

2. 由于需要替换原子序数为原子元素名称,而这里只转换C,H,N,O,Cl等5个元素,因此,你的体系如果包含其它元素,请仿照原格式修改其中的“# Change the numbers into elements names”部分,其实就是在那一句中添加gsub(元素序号,"元素名称",$2);即可(顺序无关),别忘了;号。其实元素序号/名称转换也可以从输出文件中提取。只是暂没时间完成这一步。
引用回帖:


#!/bin/bash
#
# Xijun wang, 2012.01.14
# xijun(at)gmail.com

# get the prefix of the gaussian output file
name=`echo $1|sed "s/\..*$//"`

# Find charge and multiplicity, get the first value in case multiple results found
charge=`awk '/Charge =/{print $3}' $1|awk 'NR==1'`
multip=`awk '/Charge =/{print $6}' $1|awk 'NR==1'`

# Find the block of the coordination, delete extra lines
sed '/Input orientation/,/Distance/!d' $1| grep -v -E 'I|C|N|D|\-\-\-' > $name.temp.01

# Find how many atoms by reading the first string of the last line
NN=`awk 'END{print $1}' $name.temp.01`

# Output the last structure from all structures found in the output file
tail -$NN $name.temp.01 > $name.temp.02

# Change the numbers into elements names, to be inproved
awk '{gsub(1,"H",$2); gsub(6,"C",$2); gsub(7,"N",$2); gsub(8,"O",$2); gsub(17,"Cl",$2); \
      printf "%5s %10.6f %10.6f %10.6f\n", $2, $4, $5, $6}' $name.temp.02 > $name.temp.03

# Delete previous resulting file
rm $name.xyz $name.gjf

# Create xyz file
echo $NN >> $name.xyz
echo $name >> $name.xyz
cat $name.temp.03 >> $name.xyz

# Transform xyz file into gaussian input file using openBabel
babel -ixyz $name.xyz -ogjf $name.gjf

# Replace some content of the input files
sed '1 i %chk='"$name.chk"'\n%mem=1024MB' $name.gjf > $name.temp.gjf
sed -i 's/#Put Keywords Here, check Charge and Multiplicity./#MP2\/6-311++g** SCRF=(PCM, solvent=water, DoVacuum, ExternalIteration, SMD)/' $name.temp.gjf
sed -i "s/0  1/$charge $multip/" $name.temp.gjf

# Rename to get the final file and delete temp files
mv $name.temp.gjf $name.gjf
rm $name.temp.*

Use of the script:

save it as g2g.sh; add excutable: chmod +x g2g.sh

then: ./g2g gauss.out // replace gauss.out with your output file name.
6楼2012-01-16 10:24:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

ChemiAndy

木虫 (正式写手)


上面第二个脚本生成的gaussian输入文件所带的预设关键词是用PCM模型计算溶剂化自由能的。计算后直接读G(Sol)那一行的数值。
7楼2012-01-16 10:30:20
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 ChemiAndy 的主题更新
信息提示
请填处理意见