NWChem workflow

NWChem home
NWChem script examples
NWChem getting started


Geometry creation for NWChem script

  • exporting as .xyz file and using the same input structure in NWChem script
    • .xyz file stores only atom positions
    • .xyz file has basically no limit on system size
    • .xyz file formatting & wiki
  • exporting as .pdb file and using Extensions > NWChem... in Avogadro and copying geometry from generated result
    • .pdb file stores atom positions and their connections (bonds)
    • .pdb file is limited to 9,999 atoms
    • .pdb file formatting, wiki

Writing NWChem input script

Any text editor can be used to edit NWChem input scripts.
Notepad++ is a better alternative to the default Notepad.
Visual Studio Code is the recommended option.
NWChem extension for VS Code to provide syntax highlighting is in the development (with additional features being considered).


The most basic NWChem input script structure

 title "Nitrogen cc-pvdz SCF geometry optimization"    # script name
 geometry                                              # geometry
   n 0 0 0  
   n 0 0 1.08  
 end                                                   #every section is closed with "end"
 basis                                                 # atom's "characteristics" library
   n library cc-pvdz  
 end  
 task scf optimize                                     # command to actually execute task

More examples in NWChem documentation


Running NWChem

Running in serial mode (1 core)

Will run in the console:

nwchem input.nw > input.out  

Will run in the background:

nwchem input.nw >& input.out &

Running with MPI (multi-core)

Will run in the console (2 cores):

mpiexec -np 2 -bind-to core nwchem input.nw

Will run in the background (2 cores):

mpiexec -np 2 -bind-to core nwchem input.nw > output.nw

Will run in the console (all available cores):

mpiexec -map-by core -bind-to core nwchem input.nw

Will run in the background (all available cores):

mpiexec -map-by core -bind-to core nwchem input.nw > output.nw

Visualizing results

  • NWChem output file
  • .cube file

(Optional) NWChem script generation using scriptmaker.py

Python script used to generate NWChem script with file structure suitable for IT4I.
scriptmaker.py is also capable of generating multiple instances of the same script with varying conditions.
When using following conditions e.g.:

cdft 5 5 charge -1.0
cdft 8 8 charge 0

NWChem input scripts with folling conditions will be generated:

cdft 5 5 charge -1.0 #cdft 5 5 charge -1.0  cdft 5 5 charge -1.0  #cdft 5 5 charge -1.0
cdft 8 8 charge 0     cdft 8 8 charge 0    #cdft 8 8 charge 0     #cdft 8 8 charge 0

(Script source code can be provided upon request)

(Optional; made for IT4I) Scripts foldmaker.sh and sweeper.sh

foldmaker.sh will generate folder structure according to the input:

bash foldmaker.sh <name_of_folders> <number of folders>

Folders with following name(s) will be generated:
name_of_the_folders1
'
'''
''''''
name_of_the_folders100

sweeper.sh will move .cube files to the parent directory and delete files not needed for restarting script.
All the important result files will be grouped together.
(Script source code can be provided upon request)