编译模板:NWChem


1.NWChem 6.8,Linux x86_64 / Intel + mkl,OpenMP并行,含MRCC在内的全部模块
 编译:

module load intel-compiler-2015-x86_64
module load openmpi-1.6.4-intel-i8

# 注意,最后一级目录必须类似于NWChem-6.8这样的形式;若用NWChem68可能会导致编译失败,原因不详
export NWCHEM_TOP=/.../NWChem/nwchem-6.8
export NWCHEM_TARGET=LINUX64
export ARMCI_NETWORK=MPI-TS
export USE_MPI="y"
export USE_MPIF="y"
export USE_MPIF4="y"

# 以下信息可通过“mpif90 -show”获得
export MPI_LOC=/.../openmpi-1.6.4-intel-int64
export MPI_LIB=/.../openmpi-1.6.4-intel-int64/lib
export MPI_INCLUDE=/.../openmpi-1.6.4-intel-int64/include
export LIBMPI="-lmpi_f90 -lmpi_f77 -lmpi -ldl -lm -Wl,--export-dynamic -lrt -lnsl -lutil"

export NWCHEM_MODULES="all"
export MRCC_THEORY=TRUE
export BLASOPT="-L/.../intel/mkl/lib/intel64 -lmkl_intel_ilp64 -lmkl_sequential -lmkl_core"

cd $NWCHEM_TOP/src

make nwchem_config

make FC=ifort CC=icc

运行脚本:

module load intel-compiler-2015-x86_64
module load openmpi-1.6.4-intel-i8

export NWCHEM_TOP=/.../NWChem/nwchem-6.8
export NWCHEM_BASIS_LIBRARY=$NWCHEM_TOP/src/basis/libraries
# 平面波赝势计算需要定义下一行
#export NWCHEM_NWPW_LIBRARY=$NWCHEM_TOP/src/nwpw/libraryps/***/
export PATH=$NWCHEM_TOP/bin/LINUX64:$PATH

# 4核并行
mpirun -np 4 nwchem 01.nw >01.out

2.NWChem 6.6,Win32(通过MinGW + MSYS) / GCC + GFortran,MPI并行
 a) 装MinGW + MSYS + GCC + GFortran

b) 装Mpich
http://www.mpich.org/static/tarballs/1.4.1p1/mpich2-1.4.1p1-win-ia32.msi

c) 装Python(不是必须的)
https://www.python.org/ftp/python/2.7.8/python-2.7.8.msi

d) 在MSYS下解压缩NWChem 6.6

e) NWChem根目录下创建lib目录,把MPICH2安装文件复制到lib:
cp  -rp  /c/Program\ Files\ \(x86\)/MPICH2/  ~/nwchem-6.6/lib

f) 用GCC + GFortran编译BLAS + LAPACK,然后把libblas.a和liblapack.a放到lib。也可以用mkl、acml等。如果忽略这一步,使用NWChem自带的库。

g) 设定环境变量
export NWCHEM_TOP=~/nwchem-6.6
export LARGE_FILES=TRUE
export NWCHEM_MODULES=all
export NWCHEM_TARGET=LINUX
export BLASOPT="-L$NWCHEM_TOP/lib -lblas -llapack"
export USE_MPI=y
export MPI_LOC=$NWCHEM_TOP/lib/MPICH2
export MPI_LIB=$MPI_LOC/lib
export MPI_INCLUDE=$MPI_LOC/include
export LIBMPI="-lfmpich2g -lmpi"
#export PYTHONHOME=/c/Python27/
#export PYTHONVERSION=27
export DEPEND_CC=gcc

h) 编译:
cd NWCHEM_TOP/src
make nwchem_config
make -f GNUmakefile FC=gfortran DEPEND_CC=gcc