A request for help


Click here for full thread
Gets Around
Click on the Terminal app from Applications/Utilities in the finder if you have not already done so. All of the following instructions assume that you are working from the command line. If you have not used a command line before these instructions may be difficult to follow, though I have tried to make them complete for a beginner. You should be able to directly copy and paste these commands into the terminal; manually typing them is more likely to produce errors.

If you have not already installed homebrew, make sure that you have the xcode command line tools installed and then install brew:

xcode-select --install


Then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"


after you have gone through the Xcode setup.

(This is just a repetition of the steps documented at http://brew.sh -- you should probably double check to make sure I'm not trying to trick you into doing anything malicious.)

Then install mpich2 and gcc (which also installs gfortran) via brew.

brew install gcc mpich2


Make a directory to hold NWChem, like $HOME/nwchem:

mkdir $HOME/nwchem


Go to the Downloads page in your web browser, http://nwchemgit.github.io/index.php/Download, and click on the newest source code release (http://nwchemgit.github.io/download.php?f=Nwchem-6.6.revision27746-src.2015-10-20.tar.gz as of this writing).

After the file has downloaded, go to your nwchem directory in the terminal, copy the downloaded file there, and unpack it.

cd $HOME/nwchem
cp $HOME/Downloads/Nwchem-6.6.revision27746-src.2015-10-20.tar.gz .
tar xzf Nwchem-6.6.revision27746-src.2015-10-20.tar.gz


If you type ls in the terminal after these steps you should see a new directory nwchem-6.6. Now you're going to configure and build:

cd nwchem-6.6
export NWCHEM_TOP=`pwd`
export HAS_BLAS="y"
export BLASOPT="-framework Accelerate"
export NWCHEM_MODULES="all"
export NWCHEM_TARGET="MACX64"
export USE_MPI="y"
export USE_MPIF="y"
export USE_MPIF4="y"
export CFLAGS_FORGA="-DMPICH_NO_ATTR_TYPE_TAGS"
export MPI_INCLUDE="/usr/local/include"
export MPI_LIB="/usr/local/lib"
export LIBMPI=" -lmpifort -lmpi -lpmpi -lpthread"
export CFLAGS_FORGA="-DMPICH_NO_ATTR_TYPE_TAGS"
cd $NWCHEM_TOP/src
make nwchem_config &> make.nwchem_config.log
make -j 4 &> build.log


It will take a while to build. If all went well, after it finishes you should be able to type ls $HOME/nwchem/nwchem-6.6/bin/MACX64 and see a file named nwchem there. If the build did not finish normally, look at the last lines in build.log and come back to the forum to explain where the build failed so you can get further help.

After the build has completed you'll need to set up some environment variables so you can use NWChem comfortably from the command line. Type open $HOME/.bash_profile; this should open your .bash_profile in TextEdit.

Add these lines to the end of the file and then save and close it:
export NWPATH=$HOME/nwchem/nwchem-6.6
export NWCHEM_EXECUTABLE=$NWPATH/bin/MACX64/nwchem
export NWCHEM_BASIS_LIBRARY=$NWPATH/src/basis/libraries/
export PATH=$PATH:$NWPATH/bin/MACX64


In the terminal, type source $HOME/.bash_profile to load the new settings into your environment.

Now try running a simple test case. In the terminal do

cd $HOME/nwchem/nwchem-6.6/QA/tests/h2o
nwchem h2o.nw | tee h2o-test.out


This should finish in a couple of seconds, having spewed a lot of information your screen and also having generated a file named h2o-test.out. If you look at this file and the reference h2o.out file that was already present, you should see a section titled "RHF ENERGY GRADIENTS". The numbers in this section in your h2o-test.out should agree with the reference h2o.out.

Now let's try a somewhat more demanding job using two processor cores instead of one.

cd $HOME/nwchem/nwchem-6.6/QA/tests/h2o_raman_1
mpirun -np 2 nwchem h2o_raman_1.nw | tee h2o_raman_1-test.out


You can use however many cores your Mac has after the -np flag above, but any current Mac will have at least 2 physical cores. This job takes about 5 minutes to finish when running on my Mac with 2 cores as shown. It will go faster if you can use more cores. After you are done, the numbers in each section of h2o_raman_1-test.out headed by "DFT Linear Response..." should closely agree with the corresponding numbers in the reference file h2o_raman_1.out.

If everything went well, you're now set up to start running your own calculations with one or multiple processor cores. You might want to download Avogadro to help setting up calculations: https://sourceforge.net/projects/avogadro/files/latest/download

It is a graphical molecule editor that allows you to visualize geometry and create a few basic types of NWChem jobs from molecular structures you have created or imported. Those automatically generated inputs can be useful as starting points even though only a handful of NWChem's many options and bundled basis sets are directly supported by Avogadro.