NWChem is one of the most powerful quantum chemistry and molecular dynamics program packages. It is robust, flexible, and fast, especially running on high performance computer cluster (HPC). In this post, I would like to share how to install NWChem on RHEL-based Linux distribution including RHEL and CentOS. However, I wish the step can be applied to other Linux distro as well.
Herein, there are three strategies which are not too difficult for the beginners. For the first two ways, you have to deal with source code directly. You can install NWChem either by compiling source code manually or using my program to compile NWChem automatically. The last one is the use of RHEL's package managers: yum and rpm. They can install you a ready-to-use NWChem executable (compiled binary) file. Although the last way is easier and more convenient than the first two ways, but a pre-built NWChem binary was compiled with a default setting in which some modules or special computational methods were not included.
If you have any problems, go to NWChem forum, and post your question there.
To manually install NWChem, you need to set all necessary environment variables before building a NWChem binary file. You may write a bash or simple scripts to set up configuration compilations.
Step 1. Install prerequisites packages (for RHEL & CentOS):
yum install python-devel gcc-gfortran openblas-devel openblas-serial64 openmpi-devel scalapack-openmpi-devel elpa-openmpi-devel tcsh openssh-clients whichStep 2. Download program source code.
Change to directory where you want to download the NWChem tarball to and use the following command to download file:
wget https://github.com/nwchemgit/nwchem/releases/download/6.8.1-release/nwchem-6.8.1-release.revision-v6.8-133-ge032219-src.2018-06-14.tar.bz2Wait until download completes.
Step 3. Uncompress the tarball:
tar -xvf nwchem*.tar.bz2Step 4. Create script that contains all necessary environment variable settings.
The following website is a good place to learn how to create the script: https://github.com/nwchemgit/nwchem/wiki.
Additionally, I posted a tons of example of bash script on my GitHub repository: https://github.com/rangsimanketkaew/NWChem.
Those scripts should work for your RHEL-based 64 bit machine. You can adjust the code as you need.
Step 5. My install script looks like this:
#!/bin/bash############################################################################################### Program for NWChem compilation on CentOS with OpenMPI compiled by GNU Fortran ## Written by Rangsiman Ketkaew (MSc student in Chemistry), Thammasat University, Thailand. ###############################################################################################export NWCHEM_TOP=/builddir/build/BUILD/nwchem-6.8export NWCHEM_TARGET=LINUX64export CC=gccexport FC=gfortranexport USE_ARUR=TRUEexport USE_NOFSCHECK=TRUEexport NWCHEM_FSCHECK=Nexport LARGE_FILES=TRUEexport MRCC_THEORY=Yexport EACCSD=Yexport IPCCSD=Yexport CCSDTQ=Yexport CCSDTLR=Yexport NWCHEM_LONG_PATHS=Yexport PYTHONHOME=/usrexport PYTHONVERSION=2.7export PYTHONLIBTYPE=soexport USE_PYTHON64=yexport HAS_BLAS=yesexport BLASOPT="-L/usr/lib64 -lopenblas"export BLAS_SIZE=4export MAKE=/usr/bin/makeexport LD_LIBRARY_PATH=/usr/lib64/openmpi/libexport USE_MPI=yexport USE_MPIF=yexport USE_MPIF4=yexport MPIEXEC=/usr/lib64/openmpi/bin/mpiexecexport MPI_LIB=/usr/lib64/openmpi/libexport MPI_INCLUDE=/usr/include/openmpi-x86_64export LIBMPI="-lmpi -lmpi_f90 -lmpi_f77"$MAKE nwchem_config NWCHEM_MODULES="all python" 2>&1 | tee ../make_nwchem_config_openmpi.log$MAKE 64_to_32 2>&1 | tee ../make_64_to_32_openmpi.logexport MAKEOPTS="USE_64TO32=y"$MAKE ${MAKEOPTS} 2>&1Save as shell script (*.sh) and name file that "compile-nwchem68-openmpi.sh".
Step 6. Execute script, for example, in my case I use bash, so I run command like this:
./compile-nwchem68-openmpi.shStep 7. If installation is completed without any error, there must be nwchem binary file at $NWCHEM_TOP/bin/LINUX64/ directory. Use the following command to check is nwchem exists:
ls -lh $NWCHEM_TOP/bin/LINUX64/nwchemStep 8. Create NWChem resource file and name it ".nwchemrc" (start with a full stop and without double quotation marks). The .nwchemrc file should look like this:
nwchem_basis_library /home/rangsiman/nwchem-6.8.1/src/basis/libraries/ffield amberamber_1 /home/rangsiman/nwchem-6.8.1/src/data/amber_s/amber_2 /home/rangsiman/nwchem-6.8.1/src/data/amber_x/amber_3 /home/rangsiman/nwchem-6.8.1/src/data/amber_q/amber_4 /home/rangsiman/nwchem-6.8.1/src/data/amber_u/charmm_s /home/rangsiman/src/data/charmm_s/charmm_x /home/rangsiman/nwchem-6.8.1/src/data/charmm_x/Step 9. Test program by a single CPU core and multiple CPU cores:
cd $NWCHEM_TOP/src- Single run
$NWCHEM_TOP/bin/LINUX64/nwchem nwchem.nw
- Parallel run
mpirun -np 4 $NWCHEM_TOP/bin/LINUX64/nwchem nwchem.nw
Step 10. If NWChem run smoothly without any error, Congratulations!
The following environment variable should be set to navigate CUDA configuration:
-I<Your Path to cuda>/include"Examples
export TCE_CUDA=Y export CUDA_LIBS="-L/usr/local/cuda-5.0/lib64 -L/usr/local/cuda-5.0/lib -lcudart" export CUDA_FLAGS="-arch sm_20 " export CUDA_INCLUDE="-I. -I/usr/local/cuda-5.0/include"You may use this command for compile:
make FC=<fortran compiler> CUDA=nvccCredit and example of CUDA test: http://www.nwchem-sw.org/index.php/Release66:TCE#CCSD.28T.29_method_with_CUDA
I wrote an automatic program to compile NWChem from source code, called "Automatic NWChem Compilation". It was written in Bourne shell, which should run on any Linux platform, especially RHEL-based and Ubuntu-based OS. This program will build you an NWChem executable binary with Message Passing Interface (MPI) protocol and Python 2.x for both single and parallel run.
Prerequisites
Step 1. Create working directory for NWChem installation :
mkdir nwchem-install && cd nwchem-installStep 2. Download the tarball of Automatic NWChem Compilation from https://github.com/rangsimanketkaew/NWChem/releases to your Linux using wget command:
wget https://github.com/rangsimanketkaew/NWChem/releases/download/v2.0/Automatic-NWchem-Compilation-2.0.tar.gzStep 3. Uncompress tarball file:
tar -xzvf Automatic-NWchem-Compilation-2.0.tar.gzStep 3. Change permission of all files and then move then to the working directory:
chmod +x -R ./Automatic-NWchem-Compilation-2.0cd Automatic-NWchem-Compilation-2.0Step 4. Execute program and follow the built-in instruction of compilation step-by-step:
./Automatic-NWChem-Compile.shScreenshot of program interface is shown above.
Step 5. Select 1 to see if your Linux has MPI library and check the current version of MPI library that being available:
Enter Your Choice: 1- Linux distribution version : CentOS release 6.5 (Final)- MPI architecture and version : mpirun (Open MPI) 2.0.2- Fortran Compiler libraries : -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpiStep 6. Select 2 and enter all necessary environments:
Enter Your Choice: 2Enter absolute path of NWChem source code, e.g. /home/rangsiman/nwchem-6.8.1/: /home/rangsiman/nwchem-6.8.1/Enter version of Python you are using, e.g. 2.6: 2.6Enter absolute path of Python directory, e.g. /usr/: /usr/Step 7. Configuration compilation as shown below will be saved as a shell file called "configure_nwchem_compile.sh".
# ------------------------- NWCHEM Location -------------------------export NWCHEM_TOP=/home/rangsiman/nwchem-6.8.1/export NWCHEM_TARGET=LINUX64# ------------------------- NWCHEM Functionality --------------------export USE_NOFSCHECK=TRUEexport NWCHEM_FSCHECK=Nexport LARGE_FILES=TRUEexport MRCC_THEORY=Yexport EACCSD=Yexport IPCCSD=Yexport CCSDTQ=Yexport CCSDTLR=Yexport NWCHEM_LONG_PATHS=Y# ------------------------- MPI libraries ---------------------------export USE_MPI=yexport USE_MPIF=yexport USE_MPIF4=yexport MPI_LOC=/share/apps/mpi/mvapich2-2.2b_intel2013export MPI_LIB=/libexport MPI_INCLUDE=/includeexport MPIEXEC=/bin/mpiexecexport LIBMPI=""export PATH=/bin/:$PATHexport LD_LIBRARY_PATH=/lib/:$LD_LIBRARY_PATH# ------------------------- Python Libraries ------------------------export USE_PYTHONCONFIG=yexport PYTHONVERSION=2.6export PYTHONHOME=/usr/export USE_PYTHON64=yexport PYTHONLIBTYPE=so# ------------------------- MATH libraries --------------------------export USE_64TO32=yexport BLAS_SIZE=4export BLASOPT="-lopenblas -lpthread -lrt"# ------------------------- Compile ---------------------------------make nwchem_config NWCHEM_MODULES="all python" >& compile-config.logmake -j4 64_to_32 >& compile-64_to_32.logexport MAKEOPTS="USE_64TO32=y"make -j4 >& compile-make-nwchem.logStep 8. Enter "YES" to start installation:
=====================================================================Install NWChem version 6.8.1 with Message Passing Interface (MPI)Configuration compilation has been saved.Please check /home/rangsiman/configure_nwchem_compile.sh=====================================================================Enter YES to start compiling: yWait until installation is completed. This can take almost 30 minutes.
Start to compile NWChem ... Building NWChem executable ... This will take 20-30 minutes. Please do not close this terminal.Step 9. If installation is completed without any error, there must be nwchem binary file at $NWCHEM_TOP/bin/LINUX64/ directory.
------------------------ Compile done -------------------------- Congratulations ! NWChem is compiled as executable successfully. It can be found at /home/rangsiman/nwchem-6.8.1/bin/LINUX64/nwchem Log file is at /home/rangsiman/nwchem-6.8.1/src/compile*.logStep 10. Select 3 to create NWChem resource files:
Enter Your Choice: 3Enter absolute path of NWChem top directory, e.g. /home/rangsiman/nwchem-6.8.1: /home/rangsiman/nwchem-6.8.1NWChem resouce file has been created: /home/rangsiman/.nwchemrcStep 11. Test program for single and parallel runs:
cd $NWCHEM_TOP/src$NWCHEM_TOP/bin/LINUX64/nwchem nwchem.nwmpirun -np 4 $NWCHEM_TOP/bin/LINUX64/nwchem nwchem.nwStep 12. Congratulations !
If you do not want to compile NWChem using Script, you can use do that by using yum command for install NWChem instead.
Install NWChem by this way can prevent the problem about the dependence and library.
Step 1. Use yum to show all available package of NWChem.
yum list --enablerepo=epel nwchem*Example of output is as follows:
Available Packagesnwchem.x86_64 6.6.27746-22.el6 epelnwchem-common.noarch 6.6.27746-22.el6 epelnwchem-mpich.x86_64 6.6.27746-22.el6 epelnwchem-openmpi.x86_64 6.6.27746-22.el6 epelStep 2. Install NWChem that was compiled with OpenMPI using command:
sudo yum install --enablerepo=epel nwchem-openmpi or
sudo yum install --enablerepo=epel nwchem-mpich.x86_64Press yes or y to start installation and wait for a while.
Instead of yum, you can use RPM (rpm). Binary rpm of NWChem can be found at pkgs.org --> https://pkgs.org/download/nwchem.
Choose the version of binary file carefully, it should satisfy your Linux distribution.
For example, I am using CentOS and I have successively installed ga-common (global array), ga-openmpi, nwchem-common, and nwchem-openmpi.
Step 1. Download binary rpm of all packages, for example, NWChem 6.6, using following commands:
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/g/ga-common-5.3b-14.el7.noarch.rpmwget http://dl.fedoraproject.org/pub/epel/7/x86_64/g/ga-openmpi-5.3b-14.el7.x86_64.rpmwget http://dl.fedoraproject.org/pub/epel/7/x86_64/n/nwchem-common-6.6.27746-22.el7.noarch.rpmwget http://dl.fedoraproject.org/pub/epel/7/x86_64/n/nwchem-openmpi-6.6.27746-22.el7.x86_64.rpmStep 2. Change permission of binary files using command:
chmod +x *.rpmStep 3. Install the packages using following commands (root or sudo is required):
rpm -ivh ga-common-5.3b-14.el7.noarch.rpmrpm -ivh ga-openmpi-5.3b-14.el7.x86_64.rpmrpm -ivh nwchem-common-6.6.27746-22.el7.noarch.rpmrpm -ivh nwchem-openmpi-6.6.27746-22.el7.x86_64.rpmTrick: You can install nwchem-mpich after you finished installing nwchem-common.
If installation is done without any error, check where the NWChem executable binary file is installed using command:
rpm -qi --filesbypkg nwchem-openmpiOn my cluster, NWChem is installed at /usr/lib64/openmpi/bin/nwchem-openmpi.
1. Create the NWChem resource file called .nwchemrc under the home directory:
vi $HOME/.nwchemrc2. The resource file should look like this:
nwchem_basis_library /home/rangsiman/nwchem-6.8.1/src/basis/libraries/ffield amberamber_1 /home/rangsiman/nwchem-6.8.1/src/data/amber_s/amber_2 /home/rangsiman/nwchem-6.8.1/src/data/amber_x/amber_3 /home/rangsiman/nwchem-6.8.1/src/data/amber_q/amber_4 /home/rangsiman/nwchem-6.8.1/src/data/amber_u/charmm_s /home/rangsiman/src/data/charmm_s/charmm_x /home/rangsiman/nwchem-6.8.1/src/data/charmm_x/3. Test program:
cd $NWCHEM_TOP/src$NWCHEM_TOP/bin/LINUX64/nwchem nwchem.nwFor error during compilation and solution, please visit this page first Error and Solution.
1. version nwchem 6.1 centos
1.1 http://software.opensuse.org/download.html?project=home%3Adtufys&package=nwchem
2.version nwchem 6.6 fedora/redhat
2.1 https://rpmfind.net/linux/RPM/fedora/updates/23/x86_64/n/nwchem-openmpi-6.6.27746-22.fc23.x86_64.html (nwchem-openmpi)
2.2 ftp://rpmfind.net/linux/RPM/epel/6/x86_64/nwchem-6.6.27746-22.el6.x86_64.html
2.3 https://www.rpmfind.net/linux/rpm2html/search.php?query=nwchem-common
3. version nwchem 6.6 centos
3.1 https://pkgs.org/centos-6/epel-x86_64/nwchem-6.6.27746-22.el6.x86_64.rpm.html
If you have any technical problems regarding NWChem functionality or problematic error during compilation, please post your error & question at NWChem forum. If you have a problem about the Automatic NWChem Compilation program, please talk to me by e-mail: rangsiman1993@gmail.com.
Enjoy NWChem!Enjoy NWChem!Enjoy NWChem!Rangsiman Ketkaew