yx_wh's Blog

Happy coding

vim命令备忘

先在shell中 gvim *.txt再

:silent! argdo! set fileencoding=utf-8 | update

但是反过来都转cp936,可能就不行。

在未删奇数行的前提下批量替换偶数行的内容。


execute "normal G"
let total_line=line(".")
"get the last line number
execute "normal gg"
        for a in range(total_line/2)
        normal j
        "s/、/,/ge
        s/みっちゃん/小美/ge
        s/みっちゃん/小美/ge
        s/美絵ちゃん/小美绘/ge
        s/美絵/美绘/ge
        s/\(.*\)」/\1/ge
        s/\(「.*\)/\1」/ge
        "first delete the last 」 if there exists one, then add 」 at the end if there is         a 「 at first.
        "this is OK for most lines except those like this
        "「XXXXX
        "XXXXX
        "XXXXXX」
        
        normal j
endfor
"back to the 1st line and replace even lines(which contain chinese)
 

编译GAMESS(US)

配置gamess
GAMESS(不是GAMES)的简介:
https://en.wikipedia.org/wiki/GAMESS_(US)
GAMESS的source
code是可以免费取得的,不过在distribution上有限制,所以不叫自由开源。在以下页面填入自己的邮件地址取得下载密码
http://www.msg.chem.iastate.edu/GAMESS/download/register/
这里有一个说明:
http://www.msg.chem.iastate.edu/GAMESS/download/dist.source.shtml
需要安装

  1. sudo aptitude install tcsh gfortran
  2. sudo aptitude install libatlas-base-dev

解压缩

  1. tar -xzvf gamess-current.tar.gz

遵循gamess/machines/readme.unix的指示。不过注意:有个选择gfortran版本的地方,即使是4.7的gfortran也请选择输入4.6。看./config的代码可知:

  1.       switch ($GMS_GFORTRAN_VERNO)
  2.          case 4.1:
  3.          case 4.2:
  4.          case 4.3:
  5.          case 4.4:
  6.          case 4.5:
  7.             echo "   Alas, your version of gfortran does not support REAL*16,"
  8.             echo "   so relativistic integrals cannot use quadruple precision."
  9.             echo "   Other than this, everything will work properly."
  10.             breaksw
  11.          case 4.6:
  12.             echo "   Good, the newest gfortran can compile REAL*16 data type."
  13.             breaksw
  14.          default:
  15.             echo "The gfortran version number is not recognized."
  16.             echo "It should only have one decimal place, such as 4.x"
  17.             exit 4
  18.             breaksw

之后有个选择math library的地方,选择atlas。填入libatlas.so所在地(/usr/lib/atlas-base)。
编译DDI

  1. cd ddi
  2. ./compddi >& compddi.log
  3. mv ddikick.x ..

编译

  1. cd ..
  2. ./compall >& compall.log

链接

  1. ./lked gamess 01 >& lked.log

这个时候要改一下内核shmget的数值:

  1.     sudo vim /etc/sysctl.conf

加入:

  1.     kernel.shmmax = 3064372224
  2.     kernel.shmall = 748137

For example, on a machine with 4GB of memory, you might add these to /etc/sysctl.conf:

  1.     # cat /etc/sysctl.conf | grep shm  
  2.     kernel.shmmax = 3064372224
  3.     kernel.shmall = 748137

Then set the new settings like so:

  1.     # sudo sysctl -p

Since they are in /etc/sysctl.conf, they will automatically be set each time the system is booted.

rungms开头部分改为

  1. mkdir /tmp/$USER
  2. set TARGET=sockets
  3. set SCR=/tmp/$USER
  4. set USERSCR=~$USER/scr
  5. set GMSPATH=~$USER/git/gamess

另外
NCPUS
改成你计算机有的核心数目。

  1. if (null$NCPUS == null) set NCPUS=2

并在

  1.    if ($NCPUS > 1) then
  2.       switch (`hostname`)

一段后加入你的hostname作为case选择支之一。

  1.          case athlonX2:
  2.             if ($NCPUS > 2) set NCPUS=2
  3.             set NNODES=1
  4.             set HOSTLIST=(`hostname`:cpus=$NCPUS)
  5.             breaksw
复制代码

然后测试。

  1. ./runall 01 >& runall.log &

之后

  1. gvim exam*

查看运行成果。
可以使用avogadro生成GAMESS的输入文件。

  1. sudo aptitude install avogadro

执行使用:

  1. ~/git/gamess/rungms  SF6.inp  01 2 > SF6.log
  1. yx@athlonX2 ~/git/gamess % cd ~/gamess
  2. yx@athlonX2 ~/gamess % ~/git/gamess/rungms  SF6.inp  01 2 > SF6.log         
  3. mkdir: cannot create directory `/tmp/yx': File exists
  4. cp SF6.inp /tmp/yx/SF6.F05
  5. unset echo
  6. /home/yx/git/gamess/ddikick.x /home/yx/git/gamess/gamess.01.x SF6 -ddi 1 2 athlonX2:cpus=2 -scr /tmp/yx