本帖最后由 ORCA_in_TCC 于 2015-1-28 15:14 编辑
DMRG(density matrix renormalization group,密度矩阵重整化群)是号称下一代的FCI,因此在闲暇时想编译过来再玩玩。使用的source code 是量化界神童普林斯顿大学Chan组开发和维护的Block代码,下载网址: 旧版更稳定易安装,但是新版更快。下面介绍的是新版的并行编译。由于新版里面加了很多C++新的内容,因此Linux自带的编译器得换成推荐的gcc4.9及以上版本。
第一步,编译gcc依赖的数据库,需要root权限: # installlibraries as root # 下面的gmp-5.0.5,mpfr-2.4.2,mpc-0.8.1,ppl-0.12-1,isl-0.14,cloog-0.18.1都是已经解压好的。
a=/localhome/dongbo/apps/commom cd/localhome/dongbo/apps/gmp-5.0.5 ./configure --prefix=$a--enable-cxx --enable-assert CPPFLAGS=-fexceptions make &&make check && make install cd/localhome/dongbo/apps/mpfr-2.4.2 ./configure--prefix=$a --with-gmp=$a --enable-assert make &&make check && make install cd /localhome/dongbo/apps/mpc-0.8.1 ./configure--prefix=$a --with-gmp=$a --with-mpfr=$a make &&make check && make install cd /localhome/dongbo/apps/ppl-0.12-1 ./configure--prefix=$a --with-gmp=$a --enable-assertions make &&make check && make install cd/localhome/dongbo/apps/isl-0.14 ./configure--prefix=$a --with-gmp=$a --enable-assertions make &&make check && make install cd/localhome/dongbo/apps/cloog-0.18.1 ./configure--prefix=$a --with-gmp-prefix=$a --with-gmp=system --with-bits=gmp--with-isl=$a make &&make check && make install
# 到这里为止,全部依赖的数据库就安装好了,下面安装gcc # 在命令行里面输入下面两行,然后开始安装gcc
exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH: $a/lib export PATH=$a /bin:$PATH
cd/localhome/dongbo/apps/gcc-4.9.1 mkdir objdir cd objdir ../gcc-4.9.1/configure--prefix=$a --with-gmp=$a --with-mpc=$a --with-mpfr=$a --with-ppl=$a--with-cloog=$a --enable-bootstrap --enable-build-with-cxx--enable-cloog-backend=isl --disable-libjava-multilib --enable-checking=release--disable-multilib make all install>& make.log &
# 上面编译的全部内容是写在一行里面的;编译gcc比较耗时,估计至少得一小时
# 上面安装的时使用的是root权限,然后赋予自己使用权限
chown dongbo * # 切换到用户 su - dongbo
# 安装并行软件openmpi-1.8.4 # installopenmpi-1.8.4 as dongbo
cd /localhome/dongbo/apps tar zxvf openmpi-1.8.4.tar.gz mv openmpi-1.8.4 openmpi-1.8.4_src mkdir openmpi-1.8.4 cd openmpi-1.8.4_src
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH: $a/lib export PATH=$a /bin:$PATH
./configure--prefix=/localhome/dongbo/apps/openmpi-1.8.4 FC=gfortran CC=gcc F77=gfortran CXX=g++ make && makecheck && make install
# 安装基于openmpi-1.8.4并行软件的C++数据库boost-1.5.5 # install boost-1.5.5as dongbo
cd /localhome/dongbo/apps tar zxvf boost_1_55_0.tar.gz mkdir boost-1.5.5 cd boost_1_55_0 ./bootstrap.sh--prefix=/localhome/dongbo/apps/boost-1.5.5 cd/localhome/dongbo/apps/boost_1_55_0/tools/build/v2
# add a line into thefile below vi user-config.jam # 下面这一行是比较关键的一行 using mpi :/localhome/dongbo/apps/openmpi-1.8.4/bin/mpic++ ; cd/localhome/dongbo/apps/boost_1_55_0 ./b2 install | teemake.log
# boost-1.5.5的安装也比较耗时,估计也得一小时 # 所有软件的安装使用的是相同的编译器,这一点非常重要
# 最后是安装Block # 编译的时候使用intel的MKL数据库,但是不适用里面的编译器 # install Block asdongbo
cd /localhome/dongbo/Block-master
vi makefile BOOSTINCLUDE =/localhome/dongbo/apps/boost-1.5.5/include #specify boost andlapack-blas library locations BOOSTLIB =-L/localhome/dongbo/apps/boost-1.5.5/lib \ -lboost_serialization-lboost_system -lboost_filesystem LAPACKBLAS = -lblas-llapack USE_BOOST56 = no ifeq ($(USE_BOOST56),yes) B56 = -DBOOST_1_56_0 endif #use these variable toset if we will use mpi or not USE_MPI = yes MPI_LIB =/localhome/dongbo/apps/boost-1.5.5/lib USE_MKL = yes # use this variable toset if we will use integer size of 8 or not. # molpro compilationrequires I8, since their integers are long I8_OPT = yes MOLPRO = no OPENMP = no # add Molcas interfaceto libqcdmrg.so # molcas compilationw/ -64 option requires I8 as well MOLCAS = yes ifeq ($(USE_MKL), yes) MKLLIB =/opt/intel/composer_xe_2013_sp1.2.144/mkl/lib/intel64 LAPACKBLAS =-L${MKLLIB} -lmkl_intel_lp64 -lmkl_sequential -lmkl_core MKLFLAGS =/opt/intel/composer_xe_2013_sp1.2.144/mkl/include MKLOPT =-D_HAS_INTEL_MKL else MKLFLAGS = . endif RUN_UNITTEST=no ifeq ($(RUN_UNITTEST),yes) UNITTEST = -DUNITTEST endif AR=ar ARFLAGS=-qs RANLIB=ranlib ifeq ($(I8_OPT), yes) I8 = -D_FORTINT_64 endif EXECUTABLE =block.spin_adapted # change to icpc forIntel CXX = g++ MPICXX =/localhome/dongbo/apps/openmpi-1.8.4/bin/mpic++
make >& make.log # 这样整个编译过程计算完成了
# 将环境变量添加到隐藏文件~/.bashrc文件中 # add environmentvariables into bashrc # gcc openmpi-1.8.4boost-1.5.5
vi ~/.bashrc exportPATH=/localhome/dongbo/apps/common/bin:$PATH exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:/\ localhome/dongbo/apps/common/lib64:\ /localhome/dongbo/apps/common/lib:\ /localhome/dongbo/apps/openmpi-1.8.4/lib:\ /localhome/dongbo/apps/boost-1.5.5/lib
# 下面是Block的一个测试例子 # 前提是先用molpro将单双电子积分FCIDUMP文件产生 #=input file a test=# sym c1
orbitals FCIDUMP
nelec 20
spin 0
irrep 1
warmup local_3site
twodot_noise 1e-5 0.3
hf_occ integral
schedule default
maxM 500
maxiter 30 #====================#
|