编译模板:NWChem


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

module load compiler/intel-compiler-mkl-2017
module load tools/openmpi-3.1.5-ifort-icc-i8

# 注意,最后一级目录必须类似于NWChem-A.B这样的形式;若用NWChemAB可能会导致编译失败,原因不详
export NWCHEM_TOP=/.../NWChem/nwchem-7.0.2
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-3.1.5-ifort-icc-i8
export MPI_LIB=/.../openmpi-3.1.5-ifort-icc-i8/lib
export MPI_INCLUDE=/.../openmpi-3.1.5-ifort-icc-i8/include
export LIBMPI="-lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi"

export NWCHEM_MODULES="all"
export MRCC_METHODS=y
export BLASOPT="-L/.../intel/mkl/lib/intel64_lin -mkl -qopenmp -lpthread -lm"
export LAPACK_LIB=$BLASOPT
export SCALAPACK="-L/.../intel/mkl/lib/intel64_lin -mkl -qopenmp -lmkl_scalapack_ilp64 -lmkl_blacs_intelmpi_ilp64 -lpthread -lm"

cd $NWCHEM_TOP/src

make nwchem_config

make FC=ifort CC=icc

运行脚本:

module load compiler/intel-compiler-mkl-2017
module load tools/openmpi-3.1.5-ifort-icc-i8

export NWCHEM_TOP=/.../NWChem/nwchem-7.0.2
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