Skip to content

Running NWChem on Hopper

To see the NWChem that is installed on Hopper, run:

module spider nwchem

------------------------------------------------------------------------------------------------------------------------------------------
  nwchem:
------------------------------------------------------------------------------------------------------------------------------------------
     Versions:
        nwchem/6.8.1-ip
        nwchem/7.0.2-m4
        nwchem/7.0.2-mr

------------------------------------------------------------------------------------------------------------------------------------------
  For detailed information about a specific "nwchem" package (including how to load the modules) use the module's full name.
  Note that names that have a trailing (E) are extensions provided by other modules.
  For example:

     $ module spider nwchem/7.0.2-mr
------------------------------------
This will show you the versions currently available on Hopper (the code shows versions available as on 11/2022). Depending on the version, you need to either load the gcc compilers with openmpi or the Intel OneAPI compiler. In this example, we're using the GCC compiled version with openmpi. To add this version to your environment:
module load gnu9
module load openmpi4

module load  nwchem/7.0.2-mr

Now, if you check the nwchem command, you should get an error complaining about missing input files:

$ nwchem
Output:
  Unable to open nwchem.nw --- appending .nw
 ------------------------------------------------------------------------
 nwchem: failed to open the input file                   0
 ------------------------------------------------------------------------
 ------------------------------------------------------------------------
  current input line :
     0:
 ------------------------------------------------------------------------
 ------------------------------------------------------------------------
 There is an error in the input file
 ------------------------------------------------------------------------
 For more information see the NWChem manual at https://github.com/nwchemgit/nwchem/wiki


 For further details see manual section:                                                                                                                                                                                                                                                    
0:nwchem: failed to open the input file:Received an Error in Communication
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI COMMUNICATOR 3 DUP FROM 0
with errorcode -1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------

An you should be able to run small tests. To run correctly, you need to either set it up as a batch job with Slurm or interactively on a compute node.

Running NWChem

In batch mode with Slurm

Example input file, input.nw

echo

start w6cage_ri-mp2_aug-cc-pvdz_energy

memory stack 2000 mb heap 100 mb global 2000 mb noverify

geometry units angstrom
  O        .87746626     1.70810837      .47631700
  H       1.69363812     1.19357153      .28997545
  H       1.16537360     2.60804843      .65262299
  O       -.81592121      .61034772    -1.61581462
  H       -.26718594     1.17109579    -1.04349788
  H       -.36582905     -.24649881    -1.56526881
  O       -.63660726     -.48685974     1.61880639
  H       -.19581869      .37060555     1.51121727
  H      -1.53977900     -.32481815     1.28377278
  O        .57958746    -1.69528831     -.42798860
  H        .43229451    -2.64323542     -.48817257
  H        .09134000    -1.38625895      .38012967
  O       2.79390774     -.10315373     -.17926594
  H       3.44976591     -.44577598      .43415635
  H       2.14838286     -.82929443     -.30024187
  O      -2.88225438     -.06267425      .06008357
  H      -2.28540757      .26575834     -.64623972
  H      -3.65812342      .50275705      .03758316
end

basis "ao basis" spherical noprint
  * library aug-cc-pvdz
end

basis "ri-mp2 basis" spherical noprint
  * library cc-pvdz-ri
  * library aug-cc-pvdz-ri_diffuse
end

scf
  semidirect memsize 200000000 filesize 0
  singlet
  rhf
  thresh 1e-7
  maxiter 100
  noprint "final vectors analysis" "final vector symmetries"
end

mp2
  freeze atomic
  scratchdisk 8192
end

task rimp2 energy

Example Slurm script run.slurm

#!/bin/bash
#SBATCH --job-name=nwchem_test
#SBATCH --partition=normal
#SBATCH --constraint=intel

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=48
#SBATCH --mem-per-cpu=3500M

#SBATCH --output=nwchem_test-%j.out
#SBATCH --error=nwchem_test-%j.err

## Load Modules
module load gnu9 openmpi4
module load nwchem/7.0.2-m4

## Execute
nwchem input.nw > nwchem_test-${SLURM_JOB_ID}.log

To run the example files:

  1. Create the example diretory in your scratch:
cd /scratch/$USER
mkdir nwchem 
cd nwchem
  1. Download the files with:

      wget https://wiki.orc.gmu.edu/mkdocs/examples/nwchem/input.nw
    
      wget https://wiki.orc.gmu.edu/mkdocs/examples/nwchem/run.slurm 
    
  2. Run with:

 sbatch run.slurm

This should produce a number of output files in the directory. Other nwchem cases may be run in a similar way.