MD計算の際に、水やエタノール等の溶媒ボックスの初期構造を作成するにはpackmolが便利です。
packmolはブラジルのJosé Mario Martínezらが作成した分子構造作成ソフトウェアです。Fortranで作られています。小さな分子をランダムに生成して均一溶媒のMD計算に使用するための初期構造を簡単に作成することができます。学部で研究室に入ってから自作でプログラムさせられることも多い基本的な作業ですが、便利なソフトが公開されているならそれを使わない手は無いでしょう。
packmol公式ページ http://www.ime.unicamp.br/~martinez/packmol/
Google Code https://code.google.com/p/packmol/
ソースコードは公式ページからもダウンロードできますが、Google Codeからも利用できます。ライセンスはGNU GPL v3です。
ダウンロードしたらこれを展開します。
[root@localhost ~]# cd /usr/local/src [root@localhost src]# wget https://packmol.googlecode.com/files/packmol-1.1.2.272.tar.gz [root@localhost src]# tar xvzf packmol-1.1.2.272.tar.gz ./packmol/ ./packmol/sizes.i ./packmol/initial.f ./packmol/solvate.tcl ./packmol/header ./packmol/molpa.i ./packmol/heuristics.f ./packmol/cenmass.f ./packmol/gencan.i ./packmol/packmolnew.f ./packmol/Makefile ./packmol/configure ./packmol/COPYING ./packmol/Makefile.default ./packmol/LICENSE ./packmol/io.f ./packmol/feasy.f ./packmol/fgcommon.f ./packmol/gencan.f ./packmol/geasy.f ./packmol/feasyparallel.f ./packmol/ppackmol ./packmol/compile.bat ./packmol/compindexes.f ./packmol/AUTHORS ./packmol/geasyparallel.f ./packmol/polartocart.f [root@localhost src]# cd packmol [root@localhost packmol]# make ------------------------------------------------------ Compiling packmol with /usr/bin/gfortran Flags: -O3 -ffast-math ------------------------------------------------------ Packmol succesfully built. ------------------------------------------------------ [root@localhost packmol]#
これで、フォルダ内にpackmolという実行ファイルができるのでそれにaliasまたはPATHを通せば完了です。
使い方はExample http://www.ime.unicamp.br/~martinez/packmol/ が便利です。
これでこの記事のメインは終わりなのですが、デフォルトではgfortranでコンパイルしているようなので、試しにifortでコンパイルしてみます。
[root@localhost packmol]# ./configure ifort Setting compiler to /opt/intel/composer_xe_2011_sp1.6.233/bin/intel64/ifort [root@localhost packmol]# make ------------------------------------------------------ Compiling packmol with /opt/intel/composer_xe_2011_sp1.6.233/bin/intel64/ifort Flags: -O3 -ffast-math ------------------------------------------------------ ifort: command line warning #10006: ignoring unknown option '-ffast-math' fgcommon.f(563): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'. 20 format(i10,4(tr2,d13.7)) --------------------------^ packmolnew.f(624): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'. + t10, ' Final objective function value: ', e10.5, /, ---------------------------------------------------------^ packmolnew.f(626): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'. + t10, ' Maximum violation of the constraints: ', e10.5,/, ---------------------------------------------------------------^ packmolnew.f(549): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'. * ' Function value from last GENCAN loop: f = ', e10.5, / ----------------------------------------------------------------^ packmolnew.f(550): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'. * ' Best function value before: f = ', e10.5, / ------------------------------------------------------^ packmolnew.f(554): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'. * ' Maximum violation of the constraints: ', e10.5, / ------------------------------------------------------------^ Packmol succesfully built. ------------------------------------------------------
-ffast-mathとremark #8291という表示。調べてみるとintel compilerはffast-mathには対応していないらしい。しかも、GCCでも高速化の半面、精度が落ちることもあるそうだ。packmolにかんしては別に精度は求められていないのだが、落としても問題無さそう。
http://www.radiumsoftware.com/0403.html
それから、remarkの意味は、指数の場合はEw.dだと、W>=D+7でなければならない。つまり、E10.5はダメで、E12.5である必要があるらしい。なぜgfortranの場合にエラーが出なかったのかは分からないが、記述ミスのよう。
直してもいいのだけど、面倒なので放置しても実行ファイルは作成される。ちなみに、こういうエラーを出さないようにコンパイルオプションを指定できるらしい。あまり健康的じゃないけど。
http://software.intel.com/en-us/forums/topic/271338
Makefile 42行目
SERIALFLAGS = -O3 -diag-disable 8291
こういう溶媒ボックス作成の便利なツールは他にCharmm-GUI( http://www.charmm-gui.org/ )が有名ですね。Charmmを使っていれば入力ファイル丸ごと作成されるのでそっちが便利かも。